Chromium Code Reviews| 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 <vector> | |
| 9 | |
| 10 #include "base/callback_forward.h" | |
| 8 #include "base/prefs/pref_service.h" | 11 #include "base/prefs/pref_service.h" |
| 9 #include "chrome/browser/prefs/pref_model_associator.h" | 12 #include "chrome/browser/prefs/pref_model_associator.h" |
| 10 #include "chrome/browser/prefs/synced_pref_observer.h" | 13 #include "chrome/browser/prefs/synced_pref_observer.h" |
| 11 #include "components/pref_registry/pref_registry_syncable.h" | 14 #include "components/pref_registry/pref_registry_syncable.h" |
| 12 | 15 |
| 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). |overlay_pref_names| is a list of preference names that |
| 42 // cannot be changed in the incognito preferences. | |
|
gab
2015/09/14 16:20:10
s/that cannot be changed in the incognito preferen
sdefresne
2015/09/14 17:28:29
Done.
| |
| 40 PrefServiceSyncable* CreateIncognitoPrefService( | 43 PrefServiceSyncable* CreateIncognitoPrefService( |
| 41 PrefStore* incognito_extension_prefs); | 44 PrefStore* incognito_extension_prefs, |
| 45 const std::vector<const char*>& overlay_pref_names); | |
| 42 | 46 |
| 43 // Returns true if preferences state has synchronized with the remote | 47 // Returns true if preferences state has synchronized with the remote |
| 44 // preferences. If true is returned it can be assumed the local preferences | 48 // 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 | 49 // has applied changes from the remote preferences. The two may not be |
| 46 // identical if a change is in flight (from either side). | 50 // identical if a change is in flight (from either side). |
| 47 // | 51 // |
| 48 // TODO(albertb): Given that we now support priority preferences, callers of | 52 // TODO(albertb): Given that we now support priority preferences, callers of |
| 49 // this method are likely better off making the preferences they care about | 53 // this method are likely better off making the preferences they care about |
| 50 // into priority preferences and calling IsPrioritySyncing(). | 54 // into priority preferences and calling IsPrioritySyncing(). |
| 51 bool IsSyncing(); | 55 bool IsSyncing(); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 91 | 95 |
| 92 PrefModelAssociator pref_sync_associator_; | 96 PrefModelAssociator pref_sync_associator_; |
| 93 PrefModelAssociator priority_pref_sync_associator_; | 97 PrefModelAssociator priority_pref_sync_associator_; |
| 94 | 98 |
| 95 base::ObserverList<PrefServiceSyncableObserver> observer_list_; | 99 base::ObserverList<PrefServiceSyncableObserver> observer_list_; |
| 96 | 100 |
| 97 DISALLOW_COPY_AND_ASSIGN(PrefServiceSyncable); | 101 DISALLOW_COPY_AND_ASSIGN(PrefServiceSyncable); |
| 98 }; | 102 }; |
| 99 | 103 |
| 100 #endif // CHROME_BROWSER_PREFS_PREF_SERVICE_SYNCABLE_H_ | 104 #endif // CHROME_BROWSER_PREFS_PREF_SERVICE_SYNCABLE_H_ |
| OLD | NEW |