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

Side by Side Diff: chrome/browser/signin/signin_manager.cc

Issue 11649055: OAuth2 sign-in flow for ChromeOS (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/signin/signin_manager.h" 5 #include "chrome/browser/signin/signin_manager.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 profile->GetPrefs()->ClearPref(prefs::kGoogleServicesUsername); 123 profile->GetPrefs()->ClearPref(prefs::kGoogleServicesUsername);
124 124
125 std::string user = profile_->GetPrefs()->GetString( 125 std::string user = profile_->GetPrefs()->GetString(
126 prefs::kGoogleServicesUsername); 126 prefs::kGoogleServicesUsername);
127 if (!user.empty()) 127 if (!user.empty())
128 SetAuthenticatedUsername(user); 128 SetAuthenticatedUsername(user);
129 // TokenService can be null for unit tests. 129 // TokenService can be null for unit tests.
130 TokenService* token_service = TokenServiceFactory::GetForProfile(profile_); 130 TokenService* token_service = TokenServiceFactory::GetForProfile(profile_);
131 if (token_service) { 131 if (token_service) {
132 token_service->Initialize(GaiaConstants::kChromeSource, profile_); 132 token_service->Initialize(GaiaConstants::kChromeSource, profile_);
133 // ChromeOS will kick off TokenService::LoadTokensFromDB from
134 // OAuthLoginManager once the rest of the Profile is fully initialized.
135 // Starting it from here would cause OAuthLoginManager mismatch the origin
136 // of OAuth2 tokens.
137 #if !defined(OS_CHROMEOS)
133 if (!authenticated_username_.empty()) { 138 if (!authenticated_username_.empty()) {
134 token_service->LoadTokensFromDB(); 139 token_service->LoadTokensFromDB();
135 } 140 }
141 #endif
136 } 142 }
137 if (!user.empty() && !IsAllowedUsername(user)) { 143 if (!user.empty() && !IsAllowedUsername(user)) {
138 // User is signed in, but the username is invalid - the administrator must 144 // User is signed in, but the username is invalid - the administrator must
139 // have changed the policy since the last signin, so sign out the user. 145 // have changed the policy since the last signin, so sign out the user.
140 SignOut(); 146 SignOut();
141 } 147 }
142 } 148 }
143 149
144 bool SigninManager::IsInitialized() const { 150 bool SigninManager::IsInitialized() const {
145 return profile_ != NULL; 151 return profile_ != NULL;
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
626 NotifySigninValueChanged(field, value)); 632 NotifySigninValueChanged(field, value));
627 } 633 }
628 634
629 void SigninManager::NotifyDiagnosticsObservers( 635 void SigninManager::NotifyDiagnosticsObservers(
630 const TimedSigninStatusField& field, 636 const TimedSigninStatusField& field,
631 const std::string& value) { 637 const std::string& value) {
632 FOR_EACH_OBSERVER(SigninDiagnosticsObserver, 638 FOR_EACH_OBSERVER(SigninDiagnosticsObserver,
633 signin_diagnostics_observers_, 639 signin_diagnostics_observers_,
634 NotifySigninValueChanged(field, value)); 640 NotifySigninValueChanged(field, value));
635 } 641 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698