| 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/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "chrome/browser/prefs/pref_model_associator.h" | 9 #include "chrome/browser/prefs/pref_model_associator.h" |
| 10 #include "chrome/browser/prefs/synced_pref_observer.h" |
| 10 #include "components/user_prefs/pref_registry_syncable.h" | 11 #include "components/user_prefs/pref_registry_syncable.h" |
| 11 | 12 |
| 12 class PrefServiceSyncableObserver; | 13 class PrefServiceSyncableObserver; |
| 13 class Profile; | 14 class Profile; |
| 14 | 15 |
| 15 namespace syncer { | 16 namespace syncer { |
| 16 class SyncableService; | 17 class SyncableService; |
| 17 } | 18 } |
| 18 | 19 |
| 19 // A PrefService that can be synced. Users are forced to declare | 20 // A PrefService that can be synced. Users are forced to declare |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 void AddObserver(PrefServiceSyncableObserver* observer); | 74 void AddObserver(PrefServiceSyncableObserver* observer); |
| 74 void RemoveObserver(PrefServiceSyncableObserver* observer); | 75 void RemoveObserver(PrefServiceSyncableObserver* observer); |
| 75 | 76 |
| 76 // TODO(zea): Have PrefServiceSyncable implement | 77 // TODO(zea): Have PrefServiceSyncable implement |
| 77 // syncer::SyncableService directly. | 78 // syncer::SyncableService directly. |
| 78 syncer::SyncableService* GetSyncableService(const syncer::ModelType& type); | 79 syncer::SyncableService* GetSyncableService(const syncer::ModelType& type); |
| 79 | 80 |
| 80 // Do not call this after having derived an incognito or per tab pref service. | 81 // Do not call this after having derived an incognito or per tab pref service. |
| 81 virtual void UpdateCommandLinePrefStore(PrefStore* cmd_line_store) OVERRIDE; | 82 virtual void UpdateCommandLinePrefStore(PrefStore* cmd_line_store) OVERRIDE; |
| 82 | 83 |
| 84 void AddSyncedPrefObserver(const std::string& name, |
| 85 SyncedPrefObserver* observer); |
| 86 void RemoveSyncedPrefObserver(const std::string& name, |
| 87 SyncedPrefObserver* observer); |
| 88 |
| 83 private: | 89 private: |
| 84 friend class PrefModelAssociator; | 90 friend class PrefModelAssociator; |
| 85 | 91 |
| 86 void AddRegisteredSyncablePreference( | 92 void AddRegisteredSyncablePreference( |
| 87 const char* path, | 93 const char* path, |
| 88 const user_prefs::PrefRegistrySyncable::PrefSyncStatus sync_status); | 94 const user_prefs::PrefRegistrySyncable::PrefSyncStatus sync_status); |
| 89 | 95 |
| 90 // Invoked internally when the IsSyncing() state changes. | 96 // Invoked internally when the IsSyncing() state changes. |
| 91 void OnIsSyncingChanged(); | 97 void OnIsSyncingChanged(); |
| 92 | 98 |
| 93 // Process a local preference change. This can trigger new SyncChanges being | 99 // Process a local preference change. This can trigger new SyncChanges being |
| 94 // sent to the syncer. | 100 // sent to the syncer. |
| 95 void ProcessPrefChange(const std::string& name); | 101 void ProcessPrefChange(const std::string& name); |
| 96 | 102 |
| 97 // Whether CreateIncognitoPrefService() has been called to create a | 103 // Whether CreateIncognitoPrefService() has been called to create a |
| 98 // "forked" PrefService. | 104 // "forked" PrefService. |
| 99 bool pref_service_forked_; | 105 bool pref_service_forked_; |
| 100 | 106 |
| 101 PrefModelAssociator pref_sync_associator_; | 107 PrefModelAssociator pref_sync_associator_; |
| 102 PrefModelAssociator priority_pref_sync_associator_; | 108 PrefModelAssociator priority_pref_sync_associator_; |
| 103 | 109 |
| 104 ObserverList<PrefServiceSyncableObserver> observer_list_; | 110 ObserverList<PrefServiceSyncableObserver> observer_list_; |
| 105 | 111 |
| 106 DISALLOW_COPY_AND_ASSIGN(PrefServiceSyncable); | 112 DISALLOW_COPY_AND_ASSIGN(PrefServiceSyncable); |
| 107 }; | 113 }; |
| 108 | 114 |
| 109 #endif // CHROME_BROWSER_PREFS_PREF_SERVICE_SYNCABLE_H_ | 115 #endif // CHROME_BROWSER_PREFS_PREF_SERVICE_SYNCABLE_H_ |
| OLD | NEW |