OLD | NEW |
---|---|
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 #ifndef CHROME_BROWSER_PREFS_PREF_SERVICE_SYNCABLE_H_ | 5 #ifndef CHROME_BROWSER_PREFS_PREF_SERVICE_SYNCABLE_H_ |
6 #define CHROME_BROWSER_PREFS_PREF_SERVICE_SYNCABLE_H_ | 6 #define CHROME_BROWSER_PREFS_PREF_SERVICE_SYNCABLE_H_ |
7 | 7 |
8 #include "base/callback_forward.h" | |
8 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
9 #include "chrome/browser/prefs/pref_model_associator.h" | 10 #include "chrome/browser/prefs/pref_model_associator.h" |
10 #include "chrome/browser/prefs/synced_pref_observer.h" | 11 #include "chrome/browser/prefs/synced_pref_observer.h" |
11 #include "components/pref_registry/pref_registry_syncable.h" | 12 #include "components/pref_registry/pref_registry_syncable.h" |
12 | 13 |
14 class OverlayUserPrefStore; | |
15 class PrefModelAssociatorClient; | |
gab
2015/09/11 12:58:32
This fwd-decl doesn't belong in this CL yet.
sdefresne
2015/09/14 13:17:26
Ack.
| |
13 class PrefServiceSyncableObserver; | 16 class PrefServiceSyncableObserver; |
14 | 17 |
15 namespace syncer { | 18 namespace syncer { |
16 class SyncableService; | 19 class SyncableService; |
17 } | 20 } |
18 | 21 |
19 // A PrefService that can be synced. Users are forced to declare | 22 // A PrefService that can be synced. Users are forced to declare |
20 // whether preferences are syncable or not when registering them to | 23 // whether preferences are syncable or not when registering them to |
21 // this PrefService. | 24 // this PrefService. |
22 class PrefServiceSyncable : public PrefService { | 25 class PrefServiceSyncable : public PrefService { |
23 public: | 26 public: |
24 // You may wish to use PrefServiceFactory or one of its subclasses | 27 // You may wish to use PrefServiceFactory or one of its subclasses |
25 // for simplified construction. | 28 // for simplified construction. |
26 PrefServiceSyncable( | 29 PrefServiceSyncable(PrefNotifierImpl* pref_notifier, |
27 PrefNotifierImpl* pref_notifier, | 30 PrefValueStore* pref_value_store, |
28 PrefValueStore* pref_value_store, | 31 PersistentPrefStore* user_prefs, |
29 PersistentPrefStore* user_prefs, | 32 user_prefs::PrefRegistrySyncable* pref_registry, |
30 user_prefs::PrefRegistrySyncable* pref_registry, | 33 base::Callback<void(PersistentPrefStore::PrefReadError)> |
31 base::Callback<void(PersistentPrefStore::PrefReadError)> | 34 read_error_callback, |
32 read_error_callback, | 35 bool async); |
33 bool async); | |
34 ~PrefServiceSyncable() override; | 36 ~PrefServiceSyncable() override; |
35 | 37 |
36 // Creates an incognito copy of the pref service that shares most pref stores | 38 // Creates an incognito copy of the pref service that shares most pref stores |
37 // but uses a fresh non-persistent overlay for the user pref store and an | 39 // but uses a fresh non-persistent overlay for the user pref store and an |
38 // individual extension pref store (to cache the effective extension prefs for | 40 // individual extension pref store (to cache the effective extension prefs for |
39 // incognito windows). | 41 // incognito windows). |incognito_pref_created_cb| will be invoked with the |
42 // new incognito pref store before the pref registry is created in case some | |
43 // of the preference need to be overriden in incognito (may be null). | |
40 PrefServiceSyncable* CreateIncognitoPrefService( | 44 PrefServiceSyncable* CreateIncognitoPrefService( |
41 PrefStore* incognito_extension_prefs); | 45 PrefStore* incognito_extension_prefs, |
46 const base::Callback<void(OverlayUserPrefStore*)>& | |
47 incognito_pref_created_cb); | |
42 | 48 |
43 // Returns true if preferences state has synchronized with the remote | 49 // Returns true if preferences state has synchronized with the remote |
44 // preferences. If true is returned it can be assumed the local preferences | 50 // preferences. If true is returned it can be assumed the local preferences |
45 // has applied changes from the remote preferences. The two may not be | 51 // has applied changes from the remote preferences. The two may not be |
46 // identical if a change is in flight (from either side). | 52 // identical if a change is in flight (from either side). |
47 // | 53 // |
48 // TODO(albertb): Given that we now support priority preferences, callers of | 54 // TODO(albertb): Given that we now support priority preferences, callers of |
49 // this method are likely better off making the preferences they care about | 55 // this method are likely better off making the preferences they care about |
50 // into priority preferences and calling IsPrioritySyncing(). | 56 // into priority preferences and calling IsPrioritySyncing(). |
51 bool IsSyncing(); | 57 bool IsSyncing(); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
91 | 97 |
92 PrefModelAssociator pref_sync_associator_; | 98 PrefModelAssociator pref_sync_associator_; |
93 PrefModelAssociator priority_pref_sync_associator_; | 99 PrefModelAssociator priority_pref_sync_associator_; |
94 | 100 |
95 base::ObserverList<PrefServiceSyncableObserver> observer_list_; | 101 base::ObserverList<PrefServiceSyncableObserver> observer_list_; |
96 | 102 |
97 DISALLOW_COPY_AND_ASSIGN(PrefServiceSyncable); | 103 DISALLOW_COPY_AND_ASSIGN(PrefServiceSyncable); |
98 }; | 104 }; |
99 | 105 |
100 #endif // CHROME_BROWSER_PREFS_PREF_SERVICE_SYNCABLE_H_ | 106 #endif // CHROME_BROWSER_PREFS_PREF_SERVICE_SYNCABLE_H_ |
OLD | NEW |