| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |