summaryrefslogtreecommitdiff
path: root/chromium/google_apis
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2015-08-26 12:17:21 +0200
committerAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2015-08-26 12:17:55 +0000
commitc3d0bb5bb15d008606b18b865841e19cd9bb5847 (patch)
tree25706f444200c7c4895371e78075b98f6f4c020b /chromium/google_apis
parent3a97ca8dd9b96b599ae2d33e40df0dd2f7ea5859 (diff)
downloadqtwebengine-chromium-c3d0bb5bb15d008606b18b865841e19cd9bb5847.tar.gz
BASELINE: Update chromium to 45.0.2454.79
Also remove third_party trace-viewer and hunspell again. Change-Id: Iee0b3b27abcef9b1e87a0e39b71f6b785d1d19be Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Diffstat (limited to 'chromium/google_apis')
-rw-r--r--chromium/google_apis/gaia/fake_oauth2_token_service_delegate.cc37
-rw-r--r--chromium/google_apis/gaia/fake_oauth2_token_service_delegate.h18
-rw-r--r--chromium/google_apis/gaia/oauth2_token_service_delegate.cc11
-rw-r--r--chromium/google_apis/gaia/oauth2_token_service_delegate.h9
4 files changed, 62 insertions, 13 deletions
diff --git a/chromium/google_apis/gaia/fake_oauth2_token_service_delegate.cc b/chromium/google_apis/gaia/fake_oauth2_token_service_delegate.cc
index 580025ceeb0..1ce991cb20a 100644
--- a/chromium/google_apis/gaia/fake_oauth2_token_service_delegate.cc
+++ b/chromium/google_apis/gaia/fake_oauth2_token_service_delegate.cc
@@ -5,6 +5,11 @@
#include "google_apis/gaia/fake_oauth2_token_service_delegate.h"
#include "google_apis/gaia/oauth2_access_token_fetcher_impl.h"
+FakeOAuth2TokenServiceDelegate::AccountInfo::AccountInfo(
+ const std::string& refresh_token)
+ : refresh_token(refresh_token),
+ error(GoogleServiceAuthError::NONE) {}
+
FakeOAuth2TokenServiceDelegate::FakeOAuth2TokenServiceDelegate(
net::URLRequestContextGetter* request_context)
: request_context_(request_context) {
@@ -18,11 +23,10 @@ FakeOAuth2TokenServiceDelegate::CreateAccessTokenFetcher(
const std::string& account_id,
net::URLRequestContextGetter* getter,
OAuth2AccessTokenConsumer* consumer) {
- std::map<std::string, std::string>::const_iterator it =
- refresh_tokens_.find(account_id);
+ AccountInfoMap::const_iterator it = refresh_tokens_.find(account_id);
DCHECK(it != refresh_tokens_.end());
- std::string refresh_token(it->second);
- return new OAuth2AccessTokenFetcherImpl(consumer, getter, refresh_token);
+ return new OAuth2AccessTokenFetcherImpl(consumer, getter,
+ it->second->refresh_token);
}
bool FakeOAuth2TokenServiceDelegate::RefreshTokenIsAvailable(
@@ -30,19 +34,24 @@ bool FakeOAuth2TokenServiceDelegate::RefreshTokenIsAvailable(
return !GetRefreshToken(account_id).empty();
}
+bool FakeOAuth2TokenServiceDelegate::RefreshTokenHasError(
+ const std::string& account_id) const {
+ auto it = refresh_tokens_.find(account_id);
+ // TODO(rogerta): should we distinguish between transient and persistent?
+ return it == refresh_tokens_.end() ? false : IsError(it->second->error);
+}
+
std::string FakeOAuth2TokenServiceDelegate::GetRefreshToken(
const std::string& account_id) const {
- std::map<std::string, std::string>::const_iterator it =
- refresh_tokens_.find(account_id);
+ AccountInfoMap::const_iterator it = refresh_tokens_.find(account_id);
if (it != refresh_tokens_.end())
- return it->second;
+ return it->second->refresh_token;
return std::string();
}
std::vector<std::string> FakeOAuth2TokenServiceDelegate::GetAccounts() {
std::vector<std::string> account_ids;
- for (std::map<std::string, std::string>::const_iterator iter =
- refresh_tokens_.begin();
+ for (AccountInfoMap::const_iterator iter = refresh_tokens_.begin();
iter != refresh_tokens_.end(); ++iter) {
account_ids.push_back(iter->first);
}
@@ -76,7 +85,7 @@ void FakeOAuth2TokenServiceDelegate::IssueRefreshTokenForUser(
refresh_tokens_.erase(account_id);
FireRefreshTokenRevoked(account_id);
} else {
- refresh_tokens_[account_id] = token;
+ refresh_tokens_[account_id].reset(new AccountInfo(token));
FireRefreshTokenAvailable(account_id);
// TODO(atwilson): Maybe we should also call FireRefreshTokensLoaded() here?
}
@@ -91,3 +100,11 @@ net::URLRequestContextGetter*
FakeOAuth2TokenServiceDelegate::GetRequestContext() const {
return request_context_.get();
}
+
+void FakeOAuth2TokenServiceDelegate::SetLastErrorForAccount(
+ const std::string& account_id,
+ const GoogleServiceAuthError& error) {
+ auto it = refresh_tokens_.find(account_id);
+ DCHECK(it != refresh_tokens_.end());
+ it->second->error = error;
+}
diff --git a/chromium/google_apis/gaia/fake_oauth2_token_service_delegate.h b/chromium/google_apis/gaia/fake_oauth2_token_service_delegate.h
index d75a22f5728..127039ca1bf 100644
--- a/chromium/google_apis/gaia/fake_oauth2_token_service_delegate.h
+++ b/chromium/google_apis/gaia/fake_oauth2_token_service_delegate.h
@@ -5,6 +5,8 @@
#ifndef CHROME_BROWSER_SIGNIN_FAKE_OAUTH2_TOKEN_SERVICE_DELEGATE_H_
#define CHROME_BROWSER_SIGNIN_FAKE_OAUTH2_TOKEN_SERVICE_DELEGATE_H_
+#include "base/memory/linked_ptr.h"
+#include "google_apis/gaia/google_service_auth_error.h"
#include "google_apis/gaia/oauth2_token_service_delegate.h"
#include "net/url_request/url_request_context_getter.h"
@@ -20,6 +22,7 @@ class FakeOAuth2TokenServiceDelegate : public OAuth2TokenServiceDelegate {
// Overriden to make sure it works on Android.
bool RefreshTokenIsAvailable(const std::string& account_id) const override;
+ bool RefreshTokenHasError(const std::string& account_id) const override;
std::vector<std::string> GetAccounts() override;
void RevokeAllCredentials() override;
@@ -36,13 +39,24 @@ class FakeOAuth2TokenServiceDelegate : public OAuth2TokenServiceDelegate {
request_context_ = request_context;
}
+ void SetLastErrorForAccount(const std::string& account_id,
+ const GoogleServiceAuthError& error);
+
private:
+ struct AccountInfo {
+ AccountInfo(const std::string& refresh_token);
+
+ const std::string refresh_token;
+ GoogleServiceAuthError error;
+ };
+
void IssueRefreshTokenForUser(const std::string& account_id,
const std::string& token);
std::string GetRefreshToken(const std::string& account_id) const;
- // Maps account ids to their refresh token strings.
- std::map<std::string, std::string> refresh_tokens_;
+ // Maps account ids to info.
+ typedef std::map<std::string, linked_ptr<AccountInfo>> AccountInfoMap;
+ AccountInfoMap refresh_tokens_;
scoped_refptr<net::URLRequestContextGetter> request_context_;
diff --git a/chromium/google_apis/gaia/oauth2_token_service_delegate.cc b/chromium/google_apis/gaia/oauth2_token_service_delegate.cc
index afe6e6ffaf1..2f976145ea1 100644
--- a/chromium/google_apis/gaia/oauth2_token_service_delegate.cc
+++ b/chromium/google_apis/gaia/oauth2_token_service_delegate.cc
@@ -46,6 +46,12 @@ void OAuth2TokenServiceDelegate::RemoveObserver(
observer_list_.RemoveObserver(observer);
}
+// static
+bool OAuth2TokenServiceDelegate::IsError(const GoogleServiceAuthError& error) {
+ // TODO(rogerta): should we distinguish between transient and persistent?
+ return error.state() != GoogleServiceAuthError::NONE;
+}
+
void OAuth2TokenServiceDelegate::StartBatchChanges() {
++batch_change_depth_;
if (batch_change_depth_ == 1)
@@ -95,6 +101,11 @@ net::URLRequestContextGetter* OAuth2TokenServiceDelegate::GetRequestContext()
return nullptr;
}
+bool OAuth2TokenServiceDelegate::RefreshTokenHasError(
+ const std::string& account_id) const {
+ return false;
+}
+
std::vector<std::string> OAuth2TokenServiceDelegate::GetAccounts() {
return std::vector<std::string>();
}
diff --git a/chromium/google_apis/gaia/oauth2_token_service_delegate.h b/chromium/google_apis/gaia/oauth2_token_service_delegate.h
index cb38c2eb0e5..3a2d39fb246 100644
--- a/chromium/google_apis/gaia/oauth2_token_service_delegate.h
+++ b/chromium/google_apis/gaia/oauth2_token_service_delegate.h
@@ -29,8 +29,9 @@ class OAuth2TokenServiceDelegate {
OAuth2AccessTokenConsumer* consumer) = 0;
virtual bool RefreshTokenIsAvailable(const std::string& account_id) const = 0;
+ virtual bool RefreshTokenHasError(const std::string& account_id) const;
virtual void UpdateAuthError(const std::string& account_id,
- const GoogleServiceAuthError& error){};
+ const GoogleServiceAuthError& error) {}
virtual std::vector<std::string> GetAccounts();
virtual void RevokeAllCredentials(){};
@@ -70,6 +71,12 @@ class OAuth2TokenServiceDelegate {
DISALLOW_COPY_AND_ASSIGN(ScopedBatchChange);
};
+ // This function is called by derived classes to help implement
+ // RefreshTokenHasError(). It centralizes the code for determining if
+ // |error| is worthy of being reported as an error for purposes of
+ // RefreshTokenHasError().
+ static bool IsError(const GoogleServiceAuthError& error);
+
private:
// List of observers to notify when refresh token availability changes.
// Makes sure list is empty on destruction.