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

Side by Side Diff: components/password_manager/sync/browser/password_manager_setting_migrator_service.h

Issue 2459823002: [Sync] Rename syncable_prefs to sync_preferences. (Closed)
Patch Set: Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
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 #ifndef COMPONENTS_PASSWORD_MANAGER_SYNC_BROWSER_PASSWORD_MANAGER_SETTING_MIGRAT OR_SERVICE_H_ 5 #ifndef COMPONENTS_PASSWORD_MANAGER_SYNC_BROWSER_PASSWORD_MANAGER_SETTING_MIGRAT OR_SERVICE_H_
6 #define COMPONENTS_PASSWORD_MANAGER_SYNC_BROWSER_PASSWORD_MANAGER_SETTING_MIGRAT OR_SERVICE_H_ 6 #define COMPONENTS_PASSWORD_MANAGER_SYNC_BROWSER_PASSWORD_MANAGER_SETTING_MIGRAT OR_SERVICE_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/singleton.h" 12 #include "base/memory/singleton.h"
13 #include "components/keyed_service/core/keyed_service.h" 13 #include "components/keyed_service/core/keyed_service.h"
14 #include "components/prefs/pref_change_registrar.h" 14 #include "components/prefs/pref_change_registrar.h"
15 #include "components/syncable_prefs/pref_service_syncable_observer.h" 15 #include "components/sync_preferences/pref_service_syncable_observer.h"
16 16
17 namespace syncer { 17 namespace syncer {
18 class SyncService; 18 class SyncService;
19 } 19 }
20 20
21 namespace syncable_prefs { 21 namespace sync_preferences {
22 class PrefServiceSyncable; 22 class PrefServiceSyncable;
23 } 23 }
24 24
25 namespace password_manager { 25 namespace password_manager {
26 26
27 // Service that is responsible for reconciling the legacy "Offer to save your 27 // Service that is responsible for reconciling the legacy "Offer to save your
28 // web passwords" setting (henceforth denoted 'L', for legacy) with the new 28 // web passwords" setting (henceforth denoted 'L', for legacy) with the new
29 // "Enable Smart Lock for Passwords" setting (henceforth denoted 'N', for new). 29 // "Enable Smart Lock for Passwords" setting (henceforth denoted 'N', for new).
30 // 30 //
31 // It works as follows. 31 // It works as follows.
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 // *these cases only possible on mobile platforms, where we sync only priority 70 // *these cases only possible on mobile platforms, where we sync only priority
71 // preference data type. 71 // preference data type.
72 // 72 //
73 // The service observes changes to both preferences (e.g. changes from sync, 73 // The service observes changes to both preferences (e.g. changes from sync,
74 // changes from UI) and propagates the change to the other preference if needed. 74 // changes from UI) and propagates the change to the other preference if needed.
75 // 75 //
76 // Note: componetization of this service currently is impossible, because it 76 // Note: componetization of this service currently is impossible, because it
77 // depends on PrefServiceSyncable https://crbug.com/522536. 77 // depends on PrefServiceSyncable https://crbug.com/522536.
78 class PasswordManagerSettingMigratorService 78 class PasswordManagerSettingMigratorService
79 : public KeyedService, 79 : public KeyedService,
80 public syncable_prefs::PrefServiceSyncableObserver { 80 public sync_preferences::PrefServiceSyncableObserver {
81 public: 81 public:
82 explicit PasswordManagerSettingMigratorService( 82 explicit PasswordManagerSettingMigratorService(
83 syncable_prefs::PrefServiceSyncable* prefs); 83 sync_preferences::PrefServiceSyncable* prefs);
84 ~PasswordManagerSettingMigratorService() override; 84 ~PasswordManagerSettingMigratorService() override;
85 85
86 void Shutdown() override; 86 void Shutdown() override;
87 87
88 // PrefServiceSyncableObserver: 88 // PrefServiceSyncableObserver:
89 void OnIsSyncingChanged() override; 89 void OnIsSyncingChanged() override;
90 90
91 void InitializeMigration(syncer::SyncService* sync_service); 91 void InitializeMigration(syncer::SyncService* sync_service);
92 92
93 // Only use for testing. 93 // Only use for testing.
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 // This way index 0 corresponds to kCredentialsEnableService, last index 140 // This way index 0 corresponds to kCredentialsEnableService, last index
141 // corresponds to kPasswordManagerSavingEnabled if size of sync_data_ equals 141 // corresponds to kPasswordManagerSavingEnabled if size of sync_data_ equals
142 // to 4, otherwise the vector contains the value only for one preference. 142 // to 4, otherwise the vector contains the value only for one preference.
143 std::vector<bool> sync_data_; 143 std::vector<bool> sync_data_;
144 144
145 // The initial value for kCredentialsEnableService. 145 // The initial value for kCredentialsEnableService.
146 bool initial_new_pref_value_; 146 bool initial_new_pref_value_;
147 // The initial value for kPasswordManagerSavingEnabled. 147 // The initial value for kPasswordManagerSavingEnabled.
148 bool initial_legacy_pref_value_; 148 bool initial_legacy_pref_value_;
149 149
150 syncable_prefs::PrefServiceSyncable* prefs_; 150 sync_preferences::PrefServiceSyncable* prefs_;
151 syncer::SyncService* sync_service_; 151 syncer::SyncService* sync_service_;
152 152
153 PrefChangeRegistrar pref_change_registrar_; 153 PrefChangeRegistrar pref_change_registrar_;
154 154
155 // If true, the service will refuse to initialize despite Field Trial 155 // If true, the service will refuse to initialize despite Field Trial
156 // settings. 156 // settings.
157 // Default value is false. Only use for testing. 157 // Default value is false. Only use for testing.
158 static bool force_disabled_for_testing_; 158 static bool force_disabled_for_testing_;
159 159
160 DISALLOW_COPY_AND_ASSIGN(PasswordManagerSettingMigratorService); 160 DISALLOW_COPY_AND_ASSIGN(PasswordManagerSettingMigratorService);
161 }; 161 };
162 162
163 } // namespace password_manager 163 } // namespace password_manager
164 164
165 #endif // COMPONENTS_PASSWORD_MANAGER_SYNC_BROWSER_PASSWORD_MANAGER_SETTING_MIG RATOR_SERVICE_H_ 165 #endif // COMPONENTS_PASSWORD_MANAGER_SYNC_BROWSER_PASSWORD_MANAGER_SETTING_MIG RATOR_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698