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

Side by Side Diff: components/sync_preferences/pref_service_syncable.cc

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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/syncable_prefs/pref_service_syncable.h" 5 #include "components/sync_preferences/pref_service_syncable.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
11 #include "base/value_conversions.h" 11 #include "base/value_conversions.h"
12 #include "components/pref_registry/pref_registry_syncable.h" 12 #include "components/pref_registry/pref_registry_syncable.h"
13 #include "components/prefs/default_pref_store.h" 13 #include "components/prefs/default_pref_store.h"
14 #include "components/prefs/overlay_user_pref_store.h" 14 #include "components/prefs/overlay_user_pref_store.h"
15 #include "components/prefs/pref_notifier_impl.h" 15 #include "components/prefs/pref_notifier_impl.h"
16 #include "components/prefs/pref_registry.h" 16 #include "components/prefs/pref_registry.h"
17 #include "components/prefs/pref_value_store.h" 17 #include "components/prefs/pref_value_store.h"
18 #include "components/syncable_prefs/pref_model_associator.h" 18 #include "components/sync_preferences/pref_model_associator.h"
19 #include "components/syncable_prefs/pref_service_syncable_observer.h" 19 #include "components/sync_preferences/pref_service_syncable_observer.h"
20 20
21 namespace syncable_prefs { 21 namespace sync_preferences {
22 22
23 PrefServiceSyncable::PrefServiceSyncable( 23 PrefServiceSyncable::PrefServiceSyncable(
24 PrefNotifierImpl* pref_notifier, 24 PrefNotifierImpl* pref_notifier,
25 PrefValueStore* pref_value_store, 25 PrefValueStore* pref_value_store,
26 PersistentPrefStore* user_prefs, 26 PersistentPrefStore* user_prefs,
27 user_prefs::PrefRegistrySyncable* pref_registry, 27 user_prefs::PrefRegistrySyncable* pref_registry,
28 const PrefModelAssociatorClient* pref_model_associator_client, 28 const PrefModelAssociatorClient* pref_model_associator_client,
29 base::Callback<void(PersistentPrefStore::PrefReadError)> 29 base::Callback<void(PersistentPrefStore::PrefReadError)>
30 read_error_callback, 30 read_error_callback,
31 bool async) 31 bool async)
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 PrefStore* incognito_extension_pref_store, 72 PrefStore* incognito_extension_pref_store,
73 const std::vector<const char*>& overlay_pref_names) { 73 const std::vector<const char*>& overlay_pref_names) {
74 pref_service_forked_ = true; 74 pref_service_forked_ = true;
75 PrefNotifierImpl* pref_notifier = new PrefNotifierImpl(); 75 PrefNotifierImpl* pref_notifier = new PrefNotifierImpl();
76 OverlayUserPrefStore* incognito_pref_store = 76 OverlayUserPrefStore* incognito_pref_store =
77 new OverlayUserPrefStore(user_pref_store_.get()); 77 new OverlayUserPrefStore(user_pref_store_.get());
78 for (const char* overlay_pref_name : overlay_pref_names) 78 for (const char* overlay_pref_name : overlay_pref_names)
79 incognito_pref_store->RegisterOverlayPref(overlay_pref_name); 79 incognito_pref_store->RegisterOverlayPref(overlay_pref_name);
80 80
81 scoped_refptr<user_prefs::PrefRegistrySyncable> forked_registry = 81 scoped_refptr<user_prefs::PrefRegistrySyncable> forked_registry =
82 static_cast<user_prefs::PrefRegistrySyncable*>( 82 static_cast<user_prefs::PrefRegistrySyncable*>(pref_registry_.get())
83 pref_registry_.get())->ForkForIncognito(); 83 ->ForkForIncognito();
84 PrefServiceSyncable* incognito_service = new PrefServiceSyncable( 84 PrefServiceSyncable* incognito_service = new PrefServiceSyncable(
85 pref_notifier, 85 pref_notifier,
86 pref_value_store_->CloneAndSpecialize(NULL, // managed 86 pref_value_store_->CloneAndSpecialize(NULL, // managed
87 NULL, // supervised_user 87 NULL, // supervised_user
88 incognito_extension_pref_store, 88 incognito_extension_pref_store,
89 NULL, // command_line_prefs 89 NULL, // command_line_prefs
90 incognito_pref_store, 90 incognito_pref_store,
91 NULL, // recommended 91 NULL, // recommended
92 forked_registry->defaults().get(), 92 forked_registry->defaults().get(),
93 pref_notifier), 93 pref_notifier),
94 incognito_pref_store, 94 incognito_pref_store, forked_registry.get(),
95 forked_registry.get(), 95 pref_sync_associator_.client(), read_error_callback_, false);
96 pref_sync_associator_.client(),
97 read_error_callback_,
98 false);
99 return incognito_service; 96 return incognito_service;
100 } 97 }
101 98
102 bool PrefServiceSyncable::IsSyncing() { 99 bool PrefServiceSyncable::IsSyncing() {
103 return pref_sync_associator_.models_associated(); 100 return pref_sync_associator_.models_associated();
104 } 101 }
105 102
106 bool PrefServiceSyncable::IsPrioritySyncing() { 103 bool PrefServiceSyncable::IsPrioritySyncing() {
107 return priority_pref_sync_associator_.models_associated(); 104 return priority_pref_sync_associator_.models_associated();
108 } 105 }
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 void PrefServiceSyncable::OnIsSyncingChanged() { 179 void PrefServiceSyncable::OnIsSyncingChanged() {
183 for (auto& observer : observer_list_) 180 for (auto& observer : observer_list_)
184 observer.OnIsSyncingChanged(); 181 observer.OnIsSyncingChanged();
185 } 182 }
186 183
187 void PrefServiceSyncable::ProcessPrefChange(const std::string& name) { 184 void PrefServiceSyncable::ProcessPrefChange(const std::string& name) {
188 pref_sync_associator_.ProcessPrefChange(name); 185 pref_sync_associator_.ProcessPrefChange(name);
189 priority_pref_sync_associator_.ProcessPrefChange(name); 186 priority_pref_sync_associator_.ProcessPrefChange(name);
190 } 187 }
191 188
192 } // namespace syncable_prefs 189 } // namespace sync_preferences
OLDNEW
« no previous file with comments | « components/sync_preferences/pref_service_syncable.h ('k') | components/sync_preferences/pref_service_syncable_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698