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

Side by Side Diff: chrome/browser/signin/profile_oauth2_token_service.h

Issue 33173005: Correctly deal with tokens for supervised users in ProfileOAuth2TokenService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 7 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_SIGNIN_PROFILE_OAUTH2_TOKEN_SERVICE_H_ 5 #ifndef CHROME_BROWSER_SIGNIN_PROFILE_OAUTH2_TOKEN_SERVICE_H_
6 #define CHROME_BROWSER_SIGNIN_PROFILE_OAUTH2_TOKEN_SERVICE_H_ 6 #define CHROME_BROWSER_SIGNIN_PROFILE_OAUTH2_TOKEN_SERVICE_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/gtest_prod_util.h" 10 #include "base/gtest_prod_util.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 public WebDataServiceConsumer { 45 public WebDataServiceConsumer {
46 public: 46 public:
47 // content::NotificationObserver listening for TokenService updates. 47 // content::NotificationObserver listening for TokenService updates.
48 virtual void Observe(int type, 48 virtual void Observe(int type,
49 const content::NotificationSource& source, 49 const content::NotificationSource& source,
50 const content::NotificationDetails& details) OVERRIDE; 50 const content::NotificationDetails& details) OVERRIDE;
51 51
52 // Initializes this token service with the profile. 52 // Initializes this token service with the profile.
53 virtual void Initialize(Profile* profile); 53 virtual void Initialize(Profile* profile);
54 54
55 // Loads credentials from a backing persistent store to make them available
56 // after service is used between profile restarts.
57 // Usually it's not necessary to directly call this method.
58 // TODO(bauerb): Make this method private once this class initializes itself
59 // automatically.
60 void LoadCredentials();
61
55 // BrowserContextKeyedService implementation. 62 // BrowserContextKeyedService implementation.
56 virtual void Shutdown() OVERRIDE; 63 virtual void Shutdown() OVERRIDE;
57 64
58 // Gets an account id of the primary account related to the profile. 65 // Gets an account id of the primary account related to the profile.
59 std::string GetPrimaryAccountId(); 66 std::string GetPrimaryAccountId();
60 67
61 // Lists account IDs of all accounts with a refresh token. 68 // Lists account IDs of all accounts with a refresh token.
62 virtual std::vector<std::string> GetAccounts() OVERRIDE; 69 virtual std::vector<std::string> GetAccounts() OVERRIDE;
63 70
64 // Updates a |refresh_token| for an |account_id|. Credentials are persisted, 71 // Updates a |refresh_token| for an |account_id|. Credentials are persisted,
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 // to information about the account. 147 // to information about the account.
141 typedef std::map<std::string, linked_ptr<AccountInfo> > AccountInfoMap; 148 typedef std::map<std::string, linked_ptr<AccountInfo> > AccountInfoMap;
142 149
143 FRIEND_TEST_ALL_PREFIXES(ProfileOAuth2TokenServiceTest, 150 FRIEND_TEST_ALL_PREFIXES(ProfileOAuth2TokenServiceTest,
144 TokenServiceUpdateClearsCache); 151 TokenServiceUpdateClearsCache);
145 FRIEND_TEST_ALL_PREFIXES(ProfileOAuth2TokenServiceTest, 152 FRIEND_TEST_ALL_PREFIXES(ProfileOAuth2TokenServiceTest,
146 PersistenceDBUpgrade); 153 PersistenceDBUpgrade);
147 FRIEND_TEST_ALL_PREFIXES(ProfileOAuth2TokenServiceTest, 154 FRIEND_TEST_ALL_PREFIXES(ProfileOAuth2TokenServiceTest,
148 PersistenceLoadCredentials); 155 PersistenceLoadCredentials);
149 156
157 // When migrating an old login-scoped refresh token, this returns the account
158 // ID with which the token was associated.
159 std::string GetAccountIdForMigratingRefreshToken();
160
150 // WebDataServiceConsumer implementation: 161 // WebDataServiceConsumer implementation:
151 virtual void OnWebDataServiceRequestDone( 162 virtual void OnWebDataServiceRequestDone(
152 WebDataServiceBase::Handle handle, 163 WebDataServiceBase::Handle handle,
153 const WDTypedResult* result) OVERRIDE; 164 const WDTypedResult* result) OVERRIDE;
154 165
155 // Loads credentials from a backing persistent store to make them available
156 // after service is used between profile restarts.
157 void LoadCredentials();
158
159 // Loads credentials into in memory stucture. 166 // Loads credentials into in memory stucture.
160 void LoadAllCredentialsIntoMemory( 167 void LoadAllCredentialsIntoMemory(
161 const std::map<std::string, std::string>& db_tokens); 168 const std::map<std::string, std::string>& db_tokens);
162 169
163 // Loads a single pair of |account_id|, |refresh_token| into memory. 170 // Loads a single pair of |account_id|, |refresh_token| into memory.
164 void LoadCredentialsIntoMemory(const std::string& account_id, 171 void LoadCredentialsIntoMemory(const std::string& account_id,
165 const std::string& refresh_token); 172 const std::string& refresh_token);
166 173
167 // The profile with which this instance was initialized, or NULL. 174 // The profile with which this instance was initialized, or NULL.
168 Profile* profile_; 175 Profile* profile_;
(...skipping 10 matching lines...) Expand all
179 // wrench menu). 186 // wrench menu).
180 scoped_ptr<SigninGlobalError> signin_global_error_; 187 scoped_ptr<SigninGlobalError> signin_global_error_;
181 188
182 // Registrar for notifications from the TokenService. 189 // Registrar for notifications from the TokenService.
183 content::NotificationRegistrar registrar_; 190 content::NotificationRegistrar registrar_;
184 191
185 DISALLOW_COPY_AND_ASSIGN(ProfileOAuth2TokenService); 192 DISALLOW_COPY_AND_ASSIGN(ProfileOAuth2TokenService);
186 }; 193 };
187 194
188 #endif // CHROME_BROWSER_SIGNIN_PROFILE_OAUTH2_TOKEN_SERVICE_H_ 195 #endif // CHROME_BROWSER_SIGNIN_PROFILE_OAUTH2_TOKEN_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698