Chromium Code Reviews| 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 #if !defined(OS_CHROMEOS) | |
|
Joao da Silva
2013/01/11 16:45:07
It's not clear to me why this was added, can you e
zel
2013/01/11 19:51:16
I added the comment in the code. Done.
| |
| 133 if (!authenticated_username_.empty()) { | 134 if (!authenticated_username_.empty()) { |
| 134 token_service->LoadTokensFromDB(); | 135 token_service->LoadTokensFromDB(); |
| 135 } | 136 } |
| 137 #endif | |
| 136 } | 138 } |
| 137 if (!user.empty() && !IsAllowedUsername(user)) { | 139 if (!user.empty() && !IsAllowedUsername(user)) { |
| 138 // User is signed in, but the username is invalid - the administrator must | 140 // 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. | 141 // have changed the policy since the last signin, so sign out the user. |
| 140 SignOut(); | 142 SignOut(); |
| 141 } | 143 } |
| 142 } | 144 } |
| 143 | 145 |
| 144 bool SigninManager::IsInitialized() const { | 146 bool SigninManager::IsInitialized() const { |
| 145 return profile_ != NULL; | 147 return profile_ != NULL; |
| (...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 626 NotifySigninValueChanged(field, value)); | 628 NotifySigninValueChanged(field, value)); |
| 627 } | 629 } |
| 628 | 630 |
| 629 void SigninManager::NotifyDiagnosticsObservers( | 631 void SigninManager::NotifyDiagnosticsObservers( |
| 630 const TimedSigninStatusField& field, | 632 const TimedSigninStatusField& field, |
| 631 const std::string& value) { | 633 const std::string& value) { |
| 632 FOR_EACH_OBSERVER(SigninDiagnosticsObserver, | 634 FOR_EACH_OBSERVER(SigninDiagnosticsObserver, |
| 633 signin_diagnostics_observers_, | 635 signin_diagnostics_observers_, |
| 634 NotifySigninValueChanged(field, value)); | 636 NotifySigninValueChanged(field, value)); |
| 635 } | 637 } |
| OLD | NEW |