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

Unified Diff: chrome/browser/profiles/profile_info_cache.cc

Issue 813133003: New Profile metric for Auth Errors. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Android and Windows compiler errors Created 6 years 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: chrome/browser/profiles/profile_info_cache.cc
diff --git a/chrome/browser/profiles/profile_info_cache.cc b/chrome/browser/profiles/profile_info_cache.cc
index 4e6803e2ceb57727fbdd9386df1918ab01c384ac..7ce378499524216ec461aeb80c41f111db82303b 100644
--- a/chrome/browser/profiles/profile_info_cache.cc
+++ b/chrome/browser/profiles/profile_info_cache.cc
@@ -58,6 +58,7 @@ const char kSigninRequiredKey[] = "signin_required";
const char kSupervisedUserId[] = "managed_user_id";
const char kProfileIsEphemeral[] = "is_ephemeral";
const char kActiveTimeKey[] = "active_time";
+const char kAuthErrorKey[] = "auth_error";
// First eight are generic icons, which use IDS_NUMBERED_PROFILE_NAME.
const int kDefaultNames[] = {
@@ -455,6 +456,16 @@ bool ProfileInfoCache::ProfileIsUsingDefaultAvatarAtIndex(size_t index) const {
return value;
}
+GoogleServiceAuthError::State ProfileInfoCache::ProfileAuthErrorAtIndex(
+ size_t index) const {
+ int value;
+ GetInfoForProfileAtIndex(index)->GetInteger(kAuthErrorKey, &value);
+ if (value < GoogleServiceAuthError::State::NUM_STATES)
+ return static_cast<GoogleServiceAuthError::State>(value);
+ else
noms (inactive) 2014/12/19 19:33:01 nit: You don't need the else.
Mike Lerman 2014/12/19 19:53:18 Done.
+ return GoogleServiceAuthError::State::NONE;
+}
+
size_t ProfileInfoCache::GetAvatarIconIndexOfProfileAtIndex(size_t index)
const {
std::string icon_url;
@@ -747,7 +758,19 @@ void ProfileInfoCache::SetProfileIsUsingDefaultAvatarAtIndex(
scoped_ptr<base::DictionaryValue> info(
GetInfoForProfileAtIndex(index)->DeepCopy());
- info->SetBoolean(kIsUsingDefaultAvatarKey, value);
+ info->SetBoolean(kIsUsingDefaultAvatarKey, (int)value);
noms (inactive) 2014/12/19 19:33:00 Hmm, I don't understand this change. You are setti
Mike Lerman 2014/12/19 19:53:17 Sorry, bad things with copy pasting.done.
+ // This takes ownership of |info|.
+ SetInfoForProfileAtIndex(index, info.release());
+}
+
+void ProfileInfoCache::SetProfileAuthErrorAtIndex(
+ size_t index, GoogleServiceAuthError::State value) {
+ if (value == ProfileAuthErrorAtIndex(index))
+ return;
+
+ scoped_ptr<base::DictionaryValue> info(
+ GetInfoForProfileAtIndex(index)->DeepCopy());
+ info->SetInteger(kAuthErrorKey, value);
// This takes ownership of |info|.
SetInfoForProfileAtIndex(index, info.release());
}

Powered by Google App Engine
This is Rietveld 408576698