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

Side by Side Diff: chrome/browser/chromeos/login/oauth2_login_manager.cc

Issue 14354006: Reset the OAuth2LoginManager fetchers when restoring a new session. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 #include "chrome/browser/chromeos/login/oauth2_login_manager.h" 5 #include "chrome/browser/chromeos/login/oauth2_login_manager.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 // TokenService notifications of a user that was previously active. 60 // TokenService notifications of a user that was previously active.
61 // http://crbug.com/230342 61 // http://crbug.com/230342
62 registrar_.RemoveAll(); 62 registrar_.RemoveAll();
63 user_profile_ = user_profile; 63 user_profile_ = user_profile;
64 auth_request_context_ = auth_request_context; 64 auth_request_context_ = auth_request_context;
65 state_ = OAuthLoginManager::SESSION_RESTORE_IN_PROGRESS; 65 state_ = OAuthLoginManager::SESSION_RESTORE_IN_PROGRESS;
66 restore_strategy_ = restore_strategy; 66 restore_strategy_ = restore_strategy;
67 refresh_token_ = oauth2_refresh_token; 67 refresh_token_ = oauth2_refresh_token;
68 auth_code_ = auth_code; 68 auth_code_ = auth_code;
69 69
70 // TODO(nkostylev): drop the previous fetchers if RestoreSession() is invoked
71 // for a second Profile, when using multi-profiles. This avoids the DCHECKs
72 // below until OAuthLoginManager fully supports multi-profiles.
73 Stop();
74
70 // TODO(zelidrag): Remove eventually the next line in some future milestone. 75 // TODO(zelidrag): Remove eventually the next line in some future milestone.
71 RemoveLegacyTokens(); 76 RemoveLegacyTokens();
72 77
73 // Reuse the access token fetched by the OAuth2PolicyFetcher, if it was 78 // Reuse the access token fetched by the OAuth2PolicyFetcher, if it was
74 // used to fetch policies before Profile creation. 79 // used to fetch policies before Profile creation.
75 if (oauth2_policy_fetcher_.get() && 80 if (oauth2_policy_fetcher_.get() &&
76 oauth2_policy_fetcher_->has_oauth2_tokens()) { 81 oauth2_policy_fetcher_->has_oauth2_tokens()) {
77 VLOG(1) << "Resuming profile creation after fetching policy token"; 82 VLOG(1) << "Resuming profile creation after fetching policy token";
78 // We already have tokens, no need to get them from the cookie jar again. 83 // We already have tokens, no need to get them from the cookie jar again.
79 if (restore_strategy_ == RESTORE_FROM_COOKIE_JAR) 84 if (restore_strategy_ == RESTORE_FROM_COOKIE_JAR)
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 } 303 }
299 304
300 void OAuth2LoginManager::StartTokenService( 305 void OAuth2LoginManager::StartTokenService(
301 const GaiaAuthConsumer::ClientLoginResult& gaia_credentials) { 306 const GaiaAuthConsumer::ClientLoginResult& gaia_credentials) {
302 TokenService* token_service = SetupTokenService(); 307 TokenService* token_service = SetupTokenService();
303 token_service->UpdateCredentials(gaia_credentials); 308 token_service->UpdateCredentials(gaia_credentials);
304 CompleteAuthentication(); 309 CompleteAuthentication();
305 } 310 }
306 311
307 } // namespace chromeos 312 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698