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

Side by Side Diff: chrome/browser/chromeos/login/signin/oauth2_login_manager.h

Issue 473153002: Inline sign in extracts gaia id from HTTP header and seeds account tracker (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 6 years, 2 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_CHROMEOS_LOGIN_SIGNIN_OAUTH2_LOGIN_MANAGER_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SIGNIN_OAUTH2_LOGIN_MANAGER_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SIGNIN_OAUTH2_LOGIN_MANAGER_H_ 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SIGNIN_OAUTH2_LOGIN_MANAGER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 POST_MERGE_CONNECTION_FAILED = 6, 143 POST_MERGE_CONNECTION_FAILED = 6,
144 POST_MERGE_COUNT = 7, 144 POST_MERGE_COUNT = 7,
145 }; 145 };
146 146
147 // KeyedService implementation. 147 // KeyedService implementation.
148 virtual void Shutdown() override; 148 virtual void Shutdown() override;
149 149
150 // gaia::GaiaOAuthClient::Delegate overrides. 150 // gaia::GaiaOAuthClient::Delegate overrides.
151 virtual void OnRefreshTokenResponse(const std::string& access_token, 151 virtual void OnRefreshTokenResponse(const std::string& access_token,
152 int expires_in_seconds) override; 152 int expires_in_seconds) override;
153 virtual void OnGetUserEmailResponse(const std::string& user_email) override; 153 virtual void OnGetUserInfoResponse(
154 scoped_ptr<base::DictionaryValue> user_info) override;
154 virtual void OnOAuthError() override; 155 virtual void OnOAuthError() override;
155 virtual void OnNetworkError(int response_code) override; 156 virtual void OnNetworkError(int response_code) override;
156 157
157 // OAuth2LoginVerifier::Delegate overrides. 158 // OAuth2LoginVerifier::Delegate overrides.
158 virtual void OnSessionMergeSuccess() override; 159 virtual void OnSessionMergeSuccess() override;
159 virtual void OnSessionMergeFailure(bool connection_error) override; 160 virtual void OnSessionMergeFailure(bool connection_error) override;
160 virtual void OnListAccountsSuccess(const std::string& data) override; 161 virtual void OnListAccountsSuccess(const std::string& data) override;
161 virtual void OnListAccountsFailure(bool connection_error) override; 162 virtual void OnListAccountsFailure(bool connection_error) override;
162 163
163 // OAuth2TokenFetcher::Delegate overrides. 164 // OAuth2TokenFetcher::Delegate overrides.
164 virtual void OnOAuth2TokensAvailable( 165 virtual void OnOAuth2TokensAvailable(
165 const GaiaAuthConsumer::ClientOAuthResult& oauth2_tokens) override; 166 const GaiaAuthConsumer::ClientOAuthResult& oauth2_tokens) override;
166 virtual void OnOAuth2TokensFetchFailed() override; 167 virtual void OnOAuth2TokensFetchFailed() override;
167 168
168 // OAuth2TokenService::Observer implementation: 169 // OAuth2TokenService::Observer implementation:
169 virtual void OnRefreshTokenAvailable(const std::string& account_id) override; 170 virtual void OnRefreshTokenAvailable(const std::string& account_id) override;
170 171
171 // Signals delegate that authentication is completed, kicks off token fetching 172 // Signals delegate that authentication is completed, kicks off token fetching
172 // process. 173 // process.
173 void CompleteAuthentication(); 174 void CompleteAuthentication();
174 175
175 // Retrieves ProfileOAuth2TokenService for |user_profile_|. 176 // Retrieves ProfileOAuth2TokenService for |user_profile_|.
176 ProfileOAuth2TokenService* GetTokenService(); 177 ProfileOAuth2TokenService* GetTokenService();
177 178
178 // Retrieves the primary account for |user_profile_|. 179 // Retrieves the primary account for |user_profile_|.
179 const std::string& GetPrimaryAccountId(); 180 const std::string& GetPrimaryAccountId();
180 181
181 // Records |refresh_token_| to token service. The associated account id is 182 // Records |refresh_token_| to token service. The associated account id is
182 // assumed to be the primary account id of the user profile. If the primary 183 // assumed to be the primary account id of the user profile. If the primary
183 // account id is not present, GetAccountIdOfRefreshToken will be called to 184 // account id is not present, GetAccountInfoOfRefreshToken will be called to
184 // retrieve the associated account id. 185 // retrieve the associated account id.
bartfab (slow) 2014/10/14 17:12:37 Nit: s/id/info/
Roger Tawa OOO till Jul 10th 2014/10/16 02:39:31 Done.
185 void StoreOAuth2Token(); 186 void StoreOAuth2Token();
186 187
187 // Get the account id corresponding to the specified refresh token. 188 // Get the account info corresponding to the specified refresh token.
188 void GetAccountIdOfRefreshToken(const std::string& refresh_token); 189 void GetAccountInfoOfRefreshToken(const std::string& refresh_token);
190
191 // Update the token service and inform listeners of a new refresh token.
192 void UpdateCredentials(const std::string& account_id);
189 193
190 // Attempts to fetch OAuth2 tokens by using pre-authenticated cookie jar from 194 // Attempts to fetch OAuth2 tokens by using pre-authenticated cookie jar from
191 // provided |auth_profile|. 195 // provided |auth_profile|.
192 void FetchOAuth2Tokens(); 196 void FetchOAuth2Tokens();
193 197
194 // Reports when all tokens are loaded. 198 // Reports when all tokens are loaded.
195 void ReportOAuth2TokensLoaded(); 199 void ReportOAuth2TokensLoaded();
196 200
197 // Checks if primary account sessions cookies are stale and restores them 201 // Checks if primary account sessions cookies are stale and restores them
198 // if needed. 202 // if needed.
(...skipping 24 matching lines...) Expand all
223 227
224 // Keeps the track if we have already reported OAuth2 token being loaded 228 // Keeps the track if we have already reported OAuth2 token being loaded
225 // by OAuth2TokenService. 229 // by OAuth2TokenService.
226 Profile* user_profile_; 230 Profile* user_profile_;
227 scoped_refptr<net::URLRequestContextGetter> auth_request_context_; 231 scoped_refptr<net::URLRequestContextGetter> auth_request_context_;
228 SessionRestoreStrategy restore_strategy_; 232 SessionRestoreStrategy restore_strategy_;
229 SessionRestoreState state_; 233 SessionRestoreState state_;
230 234
231 scoped_ptr<OAuth2TokenFetcher> oauth2_token_fetcher_; 235 scoped_ptr<OAuth2TokenFetcher> oauth2_token_fetcher_;
232 scoped_ptr<OAuth2LoginVerifier> login_verifier_; 236 scoped_ptr<OAuth2LoginVerifier> login_verifier_;
233 scoped_ptr<gaia::GaiaOAuthClient> account_id_fetcher_; 237 scoped_ptr<gaia::GaiaOAuthClient> account_info_fetcher_;
234 238
235 // OAuth2 refresh token. 239 // OAuth2 refresh token.
236 std::string refresh_token_; 240 std::string refresh_token_;
237 241
238 // OAuthLogin scoped access token. 242 // OAuthLogin scoped access token.
239 std::string oauthlogin_access_token_; 243 std::string oauthlogin_access_token_;
240 244
241 // Authorization code for fetching OAuth2 tokens. 245 // Authorization code for fetching OAuth2 tokens.
242 std::string auth_code_; 246 std::string auth_code_;
243 247
244 // Session restore start time. 248 // Session restore start time.
245 base::Time session_restore_start_; 249 base::Time session_restore_start_;
246 250
247 // List of observers to notify when token availability changes. 251 // List of observers to notify when token availability changes.
248 // Makes sure list is empty on destruction. 252 // Makes sure list is empty on destruction.
249 // TODO(zelidrag|gspencer): Figure out how to get rid of ProfileHelper so we 253 // TODO(zelidrag|gspencer): Figure out how to get rid of ProfileHelper so we
250 // can change the line below to ObserverList<Observer, true>. 254 // can change the line below to ObserverList<Observer, true>.
251 ObserverList<Observer, false> observer_list_; 255 ObserverList<Observer, false> observer_list_;
252 256
253 DISALLOW_COPY_AND_ASSIGN(OAuth2LoginManager); 257 DISALLOW_COPY_AND_ASSIGN(OAuth2LoginManager);
254 }; 258 };
255 259
256 } // namespace chromeos 260 } // namespace chromeos
257 261
258 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SIGNIN_OAUTH2_LOGIN_MANAGER_H_ 262 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SIGNIN_OAUTH2_LOGIN_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698