Index: chrome/browser/chromeos/settings/device_oauth2_token_service.h |
diff --git a/chrome/browser/chromeos/settings/device_oauth2_token_service.h b/chrome/browser/chromeos/settings/device_oauth2_token_service.h |
index 9d4bc6a6890a7323c5d88689249a9d8c1e203358..48d8585cd883e273275fc6e2f317de7bba3611df 100644 |
--- a/chrome/browser/chromeos/settings/device_oauth2_token_service.h |
+++ b/chrome/browser/chromeos/settings/device_oauth2_token_service.h |
@@ -6,11 +6,14 @@ |
#define CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_OAUTH2_TOKEN_SERVICE_H_ |
#include <string> |
+#include <vector> |
#include "base/basictypes.h" |
#include "base/gtest_prod_util.h" |
#include "base/memory/scoped_ptr.h" |
+#include "base/values.h" |
#include "chrome/browser/signin/oauth2_token_service.h" |
+#include "google_apis/gaia/gaia_oauth_client.h" |
#include "net/url_request/url_request_context_getter.h" |
namespace net { |
@@ -31,7 +34,8 @@ namespace chromeos { |
// See |OAuth2TokenService| for usage details. |
// |
// Note that requests must be made from the UI thread. |
-class DeviceOAuth2TokenService : public OAuth2TokenService { |
+class DeviceOAuth2TokenService : public OAuth2TokenService, |
+ public gaia::GaiaOAuthClient::Delegate { |
public: |
// Persist the given refresh token on the device. Overwrites any previous |
// value. Should only be called during initial device setup. |
@@ -41,6 +45,18 @@ class DeviceOAuth2TokenService : public OAuth2TokenService { |
virtual std::string GetRefreshToken() OVERRIDE; |
+ virtual bool StartRefreshTokenValidation( |
+ const std::string refresh_token, |
+ RefreshTokenValidationConsumer* consumer) OVERRIDE; |
+ |
+ // gaia::GaiaOAuthClient::Delegate implementation. |
+ virtual void OnRefreshTokenResponse(const std::string& access_token, |
+ int expires_in_seconds) OVERRIDE; |
+ virtual void OnGetTokenInfoResponse(scoped_ptr<DictionaryValue> token_info) |
+ OVERRIDE; |
+ virtual void OnOAuthError() OVERRIDE; |
+ virtual void OnNetworkError(int response_code) OVERRIDE; |
+ |
private: |
friend class DeviceOAuth2TokenServiceFactory; |
FRIEND_TEST_ALL_PREFIXES(DeviceOAuth2TokenServiceTest, SaveEncryptedToken); |
@@ -50,6 +66,15 @@ class DeviceOAuth2TokenService : public OAuth2TokenService { |
PrefService* local_state); |
virtual ~DeviceOAuth2TokenService(); |
+ // Inform all waiting RefreshTokenValidationConsumer instances of the current |
+ // value of refresh_token_is_valid_. |
+ void InformAllConsumers(); |
+ |
+ std::vector<RefreshTokenValidationConsumer*> |
+ refresh_token_validation_consumers_; |
+ scoped_ptr<gaia::GaiaOAuthClient> gaia_oauth_client_; |
+ bool refresh_token_is_valid_; |
+ |
// Cache the decrypted refresh token, so we only decrypt once. |
std::string refresh_token_; |
PrefService* local_state_; |