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

Unified Diff: components/user_manager/known_user.cc

Issue 2711113003: Track whether a given user session has completed initialization, and use (Closed)
Patch Set: Review feedback 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
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..f5dfd8ade1575e372eda998ceea278d1c2cf8a5e 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);
}

Powered by Google App Engine
This is Rietveld 408576698