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

Unified Diff: components/user_manager/known_user.cc

Issue 2711113003: Track whether a given user session has completed initialization, and use (Closed)
Patch Set: Only expose known_user::RemovePrefsForTesting() for tests Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/user_manager/known_user.h ('k') | components/user_manager/user.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/user_manager/known_user.cc
diff --git a/components/user_manager/known_user.cc b/components/user_manager/known_user.cc
index 815d105e187f75d648fc1543cf7d0e0a184a6a7d..22db652965cebf6f1a4cd8e6e30d1b6a156c4742 100644
--- a/components/user_manager/known_user.cc
+++ b/components/user_manager/known_user.cc
@@ -53,6 +53,9 @@ const char kReauthReasonKey[] = "reauth_reason";
// Key for the GaiaId migration status.
const char kGaiaIdMigration[] = "gaia_id_migration";
+// Key of the boolean flag telling if user session has finished init yet.
+const char kProfileEverInitialized[] = "profile_ever_initialized";
+
PrefService* GetLocalState() {
if (!UserManager::IsInitialized())
return nullptr;
@@ -451,6 +454,22 @@ bool IsUsingSAML(const AccountId& account_id) {
return false;
}
+bool WasProfileEverInitialized(const AccountId& account_id) {
+ bool profile_ever_initialized;
+ if (GetBooleanPref(account_id, kProfileEverInitialized,
+ &profile_ever_initialized))
+ return profile_ever_initialized;
+
+ // Sessions created before we started setting the session_initialized flag
+ // should default to "initialized = true".
+ LOG(WARNING) << "Treating unmigrated user as profile_ever_initialized=true";
+ return true;
+}
+
+void SetProfileEverInitialized(const AccountId& account_id, bool initialized) {
+ SetBooleanPref(account_id, kProfileEverInitialized, initialized);
+}
+
void UpdateReauthReason(const AccountId& account_id, const int reauth_reason) {
SetIntegerPref(account_id, kReauthReasonKey, reauth_reason);
}
@@ -478,6 +497,11 @@ void RemovePrefs(const AccountId& account_id) {
}
}
+// Exported so tests can call this from other components.
+void RemovePrefsForTesting(const AccountId& account_id) {
+ RemovePrefs(account_id);
+}
+
void RegisterPrefs(PrefRegistrySimple* registry) {
registry->RegisterListPref(kKnownUsers);
}
« no previous file with comments | « components/user_manager/known_user.h ('k') | components/user_manager/user.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698