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

Unified Diff: components/user_manager/user_manager_base.cc

Issue 1114543002: UMA to track the reason for re-auth (draft). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Code review fixes. Created 5 years, 8 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/user_manager_base.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/user_manager/user_manager_base.cc
diff --git a/components/user_manager/user_manager_base.cc b/components/user_manager/user_manager_base.cc
index 2cee60b6d7984a004b968ea063f727709d524539..a8ee4b1f2ab2252e63559886bf4d9b9840f842f3 100644
--- a/components/user_manager/user_manager_base.cc
+++ b/components/user_manager/user_manager_base.cc
@@ -88,6 +88,9 @@ const char kUsingSAMLKey[] = "using_saml";
// Key of Device Id.
const char kDeviceId[] = "device_id";
+// Key of the reason for re-auth.
+const char kReauthReasonKey[] = "reauth_reason";
+
// Upper bound for a histogram metric reporting the amount of time between
// one regular user logging out and a different regular user logging in.
const int kLogoutToLoginDelayMaxSec = 1800;
@@ -549,6 +552,16 @@ bool UserManagerBase::FindUsingSAML(const std::string& user_id) {
return false;
}
+void UserManagerBase::UpdateReauthReason(const std::string& user_id,
+ const int reauth_reason) {
+ SetKnownUserIntegerPref(user_id, kReauthReasonKey, reauth_reason);
+}
+
+bool UserManagerBase::FindReauthReason(const std::string& user_id,
+ int* out_value) {
+ return GetKnownUserIntegerPref(user_id, kReauthReasonKey, out_value);
+}
+
void UserManagerBase::UpdateUserAccountData(
const std::string& user_id,
const UserAccountData& account_data) {
@@ -837,6 +850,7 @@ void UserManagerBase::EnsureUsersLoaded() {
}
user->set_oauth_token_status(LoadUserOAuthStatus(*it));
user->set_force_online_signin(LoadForceOnlineSignin(*it));
+ user->set_using_saml(FindUsingSAML(*it));
users_.push_back(user);
base::string16 display_name;
@@ -1075,6 +1089,24 @@ void UserManagerBase::SetKnownUserBooleanPref(const UserID& user_id,
UpdateKnownUserPrefs(user_id, dict, false);
}
+bool UserManagerBase::GetKnownUserIntegerPref(const UserID& user_id,
+ const std::string& path,
+ int* out_value) {
+ const base::DictionaryValue* user_pref_dict = nullptr;
+ if (!FindKnownUserPrefs(user_id, &user_pref_dict))
+ return false;
+ return user_pref_dict->GetInteger(path, out_value);
+}
+
+void UserManagerBase::SetKnownUserIntegerPref(const UserID& user_id,
+ const std::string& path,
+ const int in_value) {
+ ListPrefUpdate update(GetLocalState(), kKnownUsers);
+ base::DictionaryValue dict;
+ dict.SetInteger(path, in_value);
+ UpdateKnownUserPrefs(user_id, dict, false);
+}
+
void UserManagerBase::UpdateGaiaID(const UserID& user_id,
const std::string& gaia_id) {
SetKnownUserStringPref(user_id, kGAIAIdKey, gaia_id);
« no previous file with comments | « components/user_manager/user_manager_base.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698