OLD | NEW |
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 #include "components/signin/core/browser/signin_manager.h" | 5 #include "components/signin/core/browser/signin_manager.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 SignOut(signin_metrics::GOOGLE_SERVICE_NAME_PATTERN_CHANGED, | 262 SignOut(signin_metrics::GOOGLE_SERVICE_NAME_PATTERN_CHANGED, |
263 signin_metrics::SignoutDelete::IGNORE_METRIC); | 263 signin_metrics::SignoutDelete::IGNORE_METRIC); |
264 } | 264 } |
265 } | 265 } |
266 | 266 |
267 bool SigninManager::IsSigninAllowed() const { | 267 bool SigninManager::IsSigninAllowed() const { |
268 return signin_allowed_.GetValue(); | 268 return signin_allowed_.GetValue(); |
269 } | 269 } |
270 | 270 |
271 void SigninManager::OnSigninAllowedPrefChanged() { | 271 void SigninManager::OnSigninAllowedPrefChanged() { |
272 if (!IsSigninAllowed()) | 272 if (!IsSigninAllowed() && (IsAuthenticated() || AuthInProgress())) |
273 SignOut(signin_metrics::SIGNOUT_PREF_CHANGED, | 273 SignOut(signin_metrics::SIGNOUT_PREF_CHANGED, |
274 signin_metrics::SignoutDelete::IGNORE_METRIC); | 274 signin_metrics::SignoutDelete::IGNORE_METRIC); |
275 } | 275 } |
276 | 276 |
277 // static | 277 // static |
278 bool SigninManager::IsUsernameAllowedByPolicy(const std::string& username, | 278 bool SigninManager::IsUsernameAllowedByPolicy(const std::string& username, |
279 const std::string& policy) { | 279 const std::string& policy) { |
280 if (policy.empty()) | 280 if (policy.empty()) |
281 return true; | 281 return true; |
282 | 282 |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 account_tracker_service()->SetMigrationDone(); | 424 account_tracker_service()->SetMigrationDone(); |
425 token_service_->RemoveObserver(this); | 425 token_service_->RemoveObserver(this); |
426 } | 426 } |
427 } | 427 } |
428 | 428 |
429 void SigninManager::ProhibitSignout(bool prohibit_signout) { | 429 void SigninManager::ProhibitSignout(bool prohibit_signout) { |
430 prohibit_signout_ = prohibit_signout; | 430 prohibit_signout_ = prohibit_signout; |
431 } | 431 } |
432 | 432 |
433 bool SigninManager::IsSignoutProhibited() const { return prohibit_signout_; } | 433 bool SigninManager::IsSignoutProhibited() const { return prohibit_signout_; } |
OLD | NEW |