Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(463)

Unified Diff: chrome/browser/chromeos/settings/device_oauth2_token_service.h

Issue 23382008: Making OAuth2TokenService multi-login aware, updating callers, minor fixes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updates to AndroidPO2TS and removing the DCHECK(signin_manager) from GetPrimaryAccountId Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 1ce619691a64620465b91751839eee9b684e240b..6cf4270a5e457b80d9eb010ac24ef07e98d07e0e 100644
--- a/chrome/browser/chromeos/settings/device_oauth2_token_service.h
+++ b/chrome/browser/chromeos/settings/device_oauth2_token_service.h
@@ -34,12 +34,18 @@ namespace chromeos {
//
// See |OAuth2TokenService| for usage details.
//
+// When using DeviceOAuth2TokenSerivce, a value of |GetDeviceAccountId| should
+// be used in places where API expects |account_id|.
+//
// Note that requests must be made from the UI thread.
class DeviceOAuth2TokenService : public OAuth2TokenService {
public:
// Specialization of StartRequest that in parallel validates that the refresh
// token stored on the device is owned by the device service account.
- virtual scoped_ptr<Request> StartRequest(const ScopeSet& scopes,
+ // TODO(fgorski): Remove override of StartRequest to make the method
+ // non-virtual. See crbug.com/282454 for details.
+ virtual scoped_ptr<Request> StartRequest(const std::string& account_id,
+ const ScopeSet& scopes,
Consumer* consumer) OVERRIDE;
// Persist the given refresh token on the device. Overwrites any previous
@@ -48,7 +54,13 @@ class DeviceOAuth2TokenService : public OAuth2TokenService {
static void RegisterPrefs(PrefRegistrySimple* registry);
- virtual std::string GetRefreshToken() OVERRIDE;
+ // Gets the refresh token used by the service. |account_id| is expected to be
+ // a value of |GetDeviceAccountId|.
+ virtual std::string GetRefreshToken(const std::string& account_id) OVERRIDE;
+
+ // Gets the device account id for use with |StartRequest| and
+ // |IsRefreshTokenAvailable| methods.
+ const std::string& GetDeviceAccountId() const;
protected:
// Pull the robot account ID from device policy.
@@ -79,6 +91,7 @@ class DeviceOAuth2TokenService : public OAuth2TokenService {
// Cache the decrypted refresh token, so we only decrypt once.
std::string refresh_token_;
PrefService* local_state_;
+ std::string device_account_id_;
DISALLOW_COPY_AND_ASSIGN(DeviceOAuth2TokenService);
};

Powered by Google App Engine
This is Rietveld 408576698