| OLD | NEW |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/password_manager/sync/browser/password_manager_setting_migr
ator_service.h" | 5 #include "components/password_manager/sync/browser/password_manager_setting_migr
ator_service.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/metrics/histogram_macros.h" | 9 #include "base/metrics/histogram_macros.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 syncable_prefs::PrefServiceSyncable* prefs) | 90 syncable_prefs::PrefServiceSyncable* prefs) |
| 91 : prefs_(prefs), sync_service_(nullptr) { | 91 : prefs_(prefs), sync_service_(nullptr) { |
| 92 SaveCurrentPrefState(prefs_, &initial_new_pref_value_, | 92 SaveCurrentPrefState(prefs_, &initial_new_pref_value_, |
| 93 &initial_legacy_pref_value_); | 93 &initial_legacy_pref_value_); |
| 94 } | 94 } |
| 95 | 95 |
| 96 PasswordManagerSettingMigratorService:: | 96 PasswordManagerSettingMigratorService:: |
| 97 ~PasswordManagerSettingMigratorService() {} | 97 ~PasswordManagerSettingMigratorService() {} |
| 98 | 98 |
| 99 void PasswordManagerSettingMigratorService::InitializeMigration( | 99 void PasswordManagerSettingMigratorService::InitializeMigration( |
| 100 sync_driver::SyncService* sync_service) { | 100 syncer::SyncService* sync_service) { |
| 101 if (force_disabled_for_testing_) | 101 if (force_disabled_for_testing_) |
| 102 return; | 102 return; |
| 103 SaveCurrentPrefState(prefs_, &initial_new_pref_value_, | 103 SaveCurrentPrefState(prefs_, &initial_new_pref_value_, |
| 104 &initial_legacy_pref_value_); | 104 &initial_legacy_pref_value_); |
| 105 const int kMaxInitialValues = 4; | 105 const int kMaxInitialValues = 4; |
| 106 UMA_HISTOGRAM_ENUMERATION( | 106 UMA_HISTOGRAM_ENUMERATION( |
| 107 "PasswordManager.SettingsReconciliation.InitialValues", | 107 "PasswordManager.SettingsReconciliation.InitialValues", |
| 108 (static_cast<int>(initial_new_pref_value_) << 1 | | 108 (static_cast<int>(initial_new_pref_value_) << 1 | |
| 109 static_cast<int>(initial_legacy_pref_value_)), | 109 static_cast<int>(initial_legacy_pref_value_)), |
| 110 kMaxInitialValues); | 110 kMaxInitialValues); |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 UpdatePreferencesValues(prefs, true); | 229 UpdatePreferencesValues(prefs, true); |
| 230 } else { | 230 } else { |
| 231 UpdatePreferencesValues(prefs, false); | 231 UpdatePreferencesValues(prefs, false); |
| 232 } | 232 } |
| 233 } | 233 } |
| 234 TrackInitialAndFinalValues(prefs, initial_new_pref_value_, | 234 TrackInitialAndFinalValues(prefs, initial_new_pref_value_, |
| 235 initial_legacy_pref_value_); | 235 initial_legacy_pref_value_); |
| 236 } | 236 } |
| 237 | 237 |
| 238 } // namespace password_manager | 238 } // namespace password_manager |
| OLD | NEW |