| 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 "chrome/browser/prefs/pref_model_associator.h" | 8 #include "chrome/browser/prefs/pref_model_associator.h" |
| 9 #include "chrome/browser/prefs/pref_service.h" | 9 #include "chrome/browser/prefs/pref_service.h" |
| 10 | 10 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 UNSYNCABLE_PREF, | 26 UNSYNCABLE_PREF, |
| 27 SYNCABLE_PREF | 27 SYNCABLE_PREF |
| 28 }; | 28 }; |
| 29 | 29 |
| 30 // You may wish to use PrefServiceBuilder or one of its subclasses | 30 // You may wish to use PrefServiceBuilder or one of its subclasses |
| 31 // for simplified construction. | 31 // for simplified construction. |
| 32 PrefServiceSyncable( | 32 PrefServiceSyncable( |
| 33 PrefNotifierImpl* pref_notifier, | 33 PrefNotifierImpl* pref_notifier, |
| 34 PrefValueStore* pref_value_store, | 34 PrefValueStore* pref_value_store, |
| 35 PersistentPrefStore* user_prefs, | 35 PersistentPrefStore* user_prefs, |
| 36 DefaultPrefStore* default_store, | 36 PrefRegistry* pref_registry, |
| 37 base::Callback<void(PersistentPrefStore::PrefReadError)> | 37 base::Callback<void(PersistentPrefStore::PrefReadError)> |
| 38 read_error_callback, | 38 read_error_callback, |
| 39 bool async); | 39 bool async); |
| 40 virtual ~PrefServiceSyncable(); | 40 virtual ~PrefServiceSyncable(); |
| 41 | 41 |
| 42 // Creates an incognito copy of the pref service that shares most pref stores | 42 // Creates an incognito copy of the pref service that shares most pref stores |
| 43 // but uses a fresh non-persistent overlay for the user pref store and an | 43 // but uses a fresh non-persistent overlay for the user pref store and an |
| 44 // individual extension pref store (to cache the effective extension prefs for | 44 // individual extension pref store (to cache the effective extension prefs for |
| 45 // incognito windows). | 45 // incognito windows). |
| 46 PrefServiceSyncable* CreateIncognitoPrefService( | 46 PrefServiceSyncable* CreateIncognitoPrefService( |
| 47 PrefStore* incognito_extension_prefs); | 47 PrefStore* incognito_extension_prefs); |
| 48 | 48 |
| 49 // Returns true if preferences state has synchronized with the remote | 49 // Returns true if preferences state has synchronized with the remote |
| 50 // 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 |
| 51 // 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 |
| 52 // identical if a change is in flight (from either side). | 52 // identical if a change is in flight (from either side). |
| 53 bool IsSyncing(); | 53 bool IsSyncing(); |
| 54 | 54 |
| 55 void AddObserver(PrefServiceSyncableObserver* observer); | 55 void AddObserver(PrefServiceSyncableObserver* observer); |
| 56 void RemoveObserver(PrefServiceSyncableObserver* observer); | 56 void RemoveObserver(PrefServiceSyncableObserver* observer); |
| 57 | 57 |
| 58 virtual void UnregisterPreference(const char* path) OVERRIDE; | |
| 59 | |
| 60 void RegisterBooleanPref(const char* path, | 58 void RegisterBooleanPref(const char* path, |
| 61 bool default_value, | 59 bool default_value, |
| 62 PrefSyncStatus sync_status); | 60 PrefSyncStatus sync_status); |
| 63 void RegisterIntegerPref(const char* path, | 61 void RegisterIntegerPref(const char* path, |
| 64 int default_value, | 62 int default_value, |
| 65 PrefSyncStatus sync_status); | 63 PrefSyncStatus sync_status); |
| 66 void RegisterDoublePref(const char* path, | 64 void RegisterDoublePref(const char* path, |
| 67 double default_value, | 65 double default_value, |
| 68 PrefSyncStatus sync_status); | 66 PrefSyncStatus sync_status); |
| 69 void RegisterStringPref(const char* path, | 67 void RegisterStringPref(const char* path, |
| (...skipping 24 matching lines...) Expand all Loading... |
| 94 void RegisterLocalizedStringPref(const char* path, | 92 void RegisterLocalizedStringPref(const char* path, |
| 95 int locale_default_message_id, | 93 int locale_default_message_id, |
| 96 PrefSyncStatus sync_status); | 94 PrefSyncStatus sync_status); |
| 97 void RegisterInt64Pref(const char* path, | 95 void RegisterInt64Pref(const char* path, |
| 98 int64 default_value, | 96 int64 default_value, |
| 99 PrefSyncStatus sync_status); | 97 PrefSyncStatus sync_status); |
| 100 void RegisterUint64Pref(const char* path, | 98 void RegisterUint64Pref(const char* path, |
| 101 uint64 default_value, | 99 uint64 default_value, |
| 102 PrefSyncStatus sync_status); | 100 PrefSyncStatus sync_status); |
| 103 | 101 |
| 102 void UnregisterPreference(const char* path); |
| 103 |
| 104 // TODO(zea): Have PrefServiceSyncable implement | 104 // TODO(zea): Have PrefServiceSyncable implement |
| 105 // syncer::SyncableService directly. | 105 // syncer::SyncableService directly. |
| 106 syncer::SyncableService* GetSyncableService(); | 106 syncer::SyncableService* GetSyncableService(); |
| 107 | 107 |
| 108 // Do not call this after having derived an incognito or per tab pref service. | 108 // Do not call this after having derived an incognito or per tab pref service. |
| 109 virtual void UpdateCommandLinePrefStore(PrefStore* cmd_line_store) OVERRIDE; | 109 virtual void UpdateCommandLinePrefStore(PrefStore* cmd_line_store) OVERRIDE; |
| 110 | 110 |
| 111 private: | 111 private: |
| 112 friend class PrefModelAssociator; | 112 friend class PrefModelAssociator; |
| 113 | 113 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 126 bool pref_service_forked_; | 126 bool pref_service_forked_; |
| 127 | 127 |
| 128 PrefModelAssociator pref_sync_associator_; | 128 PrefModelAssociator pref_sync_associator_; |
| 129 | 129 |
| 130 ObserverList<PrefServiceSyncableObserver> observer_list_; | 130 ObserverList<PrefServiceSyncableObserver> observer_list_; |
| 131 | 131 |
| 132 DISALLOW_COPY_AND_ASSIGN(PrefServiceSyncable); | 132 DISALLOW_COPY_AND_ASSIGN(PrefServiceSyncable); |
| 133 }; | 133 }; |
| 134 | 134 |
| 135 #endif // CHROME_BROWSER_PREFS_PREF_SERVICE_SYNCABLE_H_ | 135 #endif // CHROME_BROWSER_PREFS_PREF_SERVICE_SYNCABLE_H_ |
| OLD | NEW |