Chromium Code Reviews| Index: chrome/browser/password_manager/password_manager_setting_migrator_service.cc |
| diff --git a/chrome/browser/password_manager/password_manager_setting_migrator_service.cc b/chrome/browser/password_manager/password_manager_setting_migrator_service.cc |
| index 301b1367abeaa1edac95534be76ed55cad8e75f5..85e03f55195e89a2fea567e178997aebc3b55b7a 100644 |
| --- a/chrome/browser/password_manager/password_manager_setting_migrator_service.cc |
| +++ b/chrome/browser/password_manager/password_manager_setting_migrator_service.cc |
| @@ -6,6 +6,7 @@ |
| #include "base/bind.h" |
| #include "base/bind_helpers.h" |
| +#include "base/metrics/histogram_macros.h" |
| #include "chrome/browser/chrome_notification_types.h" |
| #include "chrome/browser/prefs/pref_service_syncable_util.h" |
| #include "chrome/browser/profiles/profile.h" |
| @@ -29,6 +30,9 @@ bool GetBooleanUserOrDefaultPrefValue(PrefService* prefs, |
| return result; |
| } |
| +const char kSettingsReconciliationInitialValuesMetrics[] = |
|
engedy
2015/09/24 14:26:18
nit: Inline this string literal.
It's customary f
melandory
2015/09/28 07:10:12
Done.
|
| + "PasswordManager.SettingsReconciliation.InitialValues"; |
| + |
| void ChangeOnePrefBecauseAnotherPrefHasChanged( |
| PrefService* prefs, |
| const std::string& other_pref_name, |
| @@ -60,6 +64,17 @@ void SaveCurrentPrefState(PrefService* prefs, |
| prefs, password_manager::prefs::kPasswordManagerSavingEnabled); |
| } |
| +PasswordManagerPreferencesInitialValues GetInitialValue(bool legacy_pref_value, |
| + bool new_pref_value) { |
| + if (!new_pref_value && !legacy_pref_value) |
| + return N0L0; |
| + if (!new_pref_value && legacy_pref_value) |
| + return N0L1; |
| + if (new_pref_value && !legacy_pref_value) |
| + return N1L0; |
| + return N1L1; |
| +} |
| + |
| } // namespace |
| // static |
| @@ -120,9 +135,11 @@ void PasswordManagerSettingMigratorService::Observe( |
| DCHECK_EQ(chrome::NOTIFICATION_PROFILE_ADDED, type); |
| SaveCurrentPrefState(profile_->GetPrefs(), &initial_new_pref_value_, |
| &initial_legacy_pref_value_); |
| + UMA_HISTOGRAM_ENUMERATION( |
| + kSettingsReconciliationInitialValuesMetrics, |
| + GetInitialValue(initial_legacy_pref_value_, initial_new_pref_value_), |
| + NUM_INITIAL_VALUES); |
| if (!password_manager::IsSettingsMigrationActive()) { |
| - // TODO(melandory) Add histogram which will log initial values for the both |
| - // settings. |
| return; |
| } |
| if (ProfileSyncServiceFactory::HasProfileSyncService(profile_)) |
| @@ -230,4 +247,6 @@ void PasswordManagerSettingMigratorService::MigrateAfterModelAssociation( |
| UpdatePreferencesValues(prefs, false); |
| } |
| } |
| + // TODO(melandory) Add histogram which will log initial and final values for |
|
engedy
2015/09/24 14:26:18
nit: I'm not sure I understand this comment correc
melandory
2015/09/28 07:10:12
Yep.
|
| + // the both preferences. |
| } |