| 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" |
| 11 #include "components/password_manager/core/browser/password_manager_settings_mig
ration_experiment.h" | 11 #include "components/password_manager/core/browser/password_manager_settings_mig
ration_experiment.h" |
| 12 #include "components/password_manager/core/common/password_manager_pref_names.h" | 12 #include "components/password_manager/core/common/password_manager_pref_names.h" |
| 13 #include "components/sync/driver/sync_service.h" | 13 #include "components/sync/driver/sync_service.h" |
| 14 #include "components/syncable_prefs/pref_service_syncable.h" | 14 #include "components/sync_preferences/pref_service_syncable.h" |
| 15 | 15 |
| 16 namespace { | 16 namespace { |
| 17 | 17 |
| 18 bool GetBooleanUserOrDefaultPrefValue(PrefService* prefs, | 18 bool GetBooleanUserOrDefaultPrefValue(PrefService* prefs, |
| 19 const std::string& name) { | 19 const std::string& name) { |
| 20 bool result = false; | 20 bool result = false; |
| 21 const base::Value* value = prefs->GetUserPrefValue(name); | 21 const base::Value* value = prefs->GetUserPrefValue(name); |
| 22 if (!value) | 22 if (!value) |
| 23 value = prefs->GetDefaultPrefValue(name); | 23 value = prefs->GetDefaultPrefValue(name); |
| 24 value->GetAsBoolean(&result); | 24 value->GetAsBoolean(&result); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 value_to_log, kMaxInitValue); | 80 value_to_log, kMaxInitValue); |
| 81 } | 81 } |
| 82 | 82 |
| 83 } // namespace | 83 } // namespace |
| 84 | 84 |
| 85 namespace password_manager { | 85 namespace password_manager { |
| 86 | 86 |
| 87 bool PasswordManagerSettingMigratorService::force_disabled_for_testing_ = false; | 87 bool PasswordManagerSettingMigratorService::force_disabled_for_testing_ = false; |
| 88 | 88 |
| 89 PasswordManagerSettingMigratorService::PasswordManagerSettingMigratorService( | 89 PasswordManagerSettingMigratorService::PasswordManagerSettingMigratorService( |
| 90 syncable_prefs::PrefServiceSyncable* prefs) | 90 sync_preferences::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 syncer::SyncService* sync_service) { | 100 syncer::SyncService* sync_service) { |
| (...skipping 128 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 |