| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/user_manager/known_user.h" | 5 #include "components/user_manager/known_user.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| 11 | 11 |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/metrics/histogram_macros.h" |
| 13 #include "base/values.h" | 14 #include "base/values.h" |
| 14 #include "components/prefs/pref_registry_simple.h" | 15 #include "components/prefs/pref_registry_simple.h" |
| 15 #include "components/prefs/scoped_user_pref_update.h" | 16 #include "components/prefs/scoped_user_pref_update.h" |
| 16 #include "components/user_manager/user_manager.h" | 17 #include "components/user_manager/user_manager.h" |
| 17 #include "google_apis/gaia/gaia_auth_util.h" | 18 #include "google_apis/gaia/gaia_auth_util.h" |
| 18 | 19 |
| 19 namespace user_manager { | 20 namespace user_manager { |
| 20 namespace known_user { | 21 namespace known_user { |
| 21 namespace { | 22 namespace { |
| 22 | 23 |
| (...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 | 450 |
| 450 bool IsUsingSAML(const AccountId& account_id) { | 451 bool IsUsingSAML(const AccountId& account_id) { |
| 451 bool using_saml; | 452 bool using_saml; |
| 452 if (GetBooleanPref(account_id, kUsingSAMLKey, &using_saml)) | 453 if (GetBooleanPref(account_id, kUsingSAMLKey, &using_saml)) |
| 453 return using_saml; | 454 return using_saml; |
| 454 return false; | 455 return false; |
| 455 } | 456 } |
| 456 | 457 |
| 457 bool WasProfileEverInitialized(const AccountId& account_id) { | 458 bool WasProfileEverInitialized(const AccountId& account_id) { |
| 458 bool profile_ever_initialized; | 459 bool profile_ever_initialized; |
| 459 if (GetBooleanPref(account_id, kProfileEverInitialized, | 460 const bool pref_set = GetBooleanPref(account_id, kProfileEverInitialized, |
| 460 &profile_ever_initialized)) | 461 &profile_ever_initialized); |
| 462 // TODO(atwilson): Remove migration code below once this UMA stat reports |
| 463 // that migration is completed - crbug.com/736760. |
| 464 UMA_HISTOGRAM_BOOLEAN("UserManager.ProfileEverInitializedMigrationCompleted", |
| 465 pref_set); |
| 466 if (pref_set) |
| 461 return profile_ever_initialized; | 467 return profile_ever_initialized; |
| 462 | 468 |
| 463 // Sessions created before we started setting the session_initialized flag | 469 // Sessions created before we started setting the session_initialized flag |
| 464 // should default to "initialized = true". | 470 // should default to "initialized = true". |
| 465 LOG(WARNING) << "Treating unmigrated user as profile_ever_initialized=true"; | 471 LOG(WARNING) << "Treating unmigrated user as profile_ever_initialized=true"; |
| 466 return true; | 472 return true; |
| 467 } | 473 } |
| 468 | 474 |
| 469 void SetProfileEverInitialized(const AccountId& account_id, bool initialized) { | 475 void SetProfileEverInitialized(const AccountId& account_id, bool initialized) { |
| 470 SetBooleanPref(account_id, kProfileEverInitialized, initialized); | 476 SetBooleanPref(account_id, kProfileEverInitialized, initialized); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 501 void RemovePrefsForTesting(const AccountId& account_id) { | 507 void RemovePrefsForTesting(const AccountId& account_id) { |
| 502 RemovePrefs(account_id); | 508 RemovePrefs(account_id); |
| 503 } | 509 } |
| 504 | 510 |
| 505 void RegisterPrefs(PrefRegistrySimple* registry) { | 511 void RegisterPrefs(PrefRegistrySimple* registry) { |
| 506 registry->RegisterListPref(kKnownUsers); | 512 registry->RegisterListPref(kKnownUsers); |
| 507 } | 513 } |
| 508 | 514 |
| 509 } // namespace known_user | 515 } // namespace known_user |
| 510 } // namespace user_manager | 516 } // namespace user_manager |
| OLD | NEW |