| 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/pref_registry_syncable.h" |
| 10 | 11 |
| 11 class PrefRegistrySyncable; | 12 class PrefRegistrySyncable; |
| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 // preferences. If true is returned it can be assumed the local preferences | 57 // preferences. If true is returned it can be assumed the local preferences |
| 57 // has applied changes from the remote preferences. The two may not be | 58 // has applied changes from the remote preferences. The two may not be |
| 58 // identical if a change is in flight (from either side). | 59 // identical if a change is in flight (from either side). |
| 59 bool IsSyncing(); | 60 bool IsSyncing(); |
| 60 | 61 |
| 61 void AddObserver(PrefServiceSyncableObserver* observer); | 62 void AddObserver(PrefServiceSyncableObserver* observer); |
| 62 void RemoveObserver(PrefServiceSyncableObserver* observer); | 63 void RemoveObserver(PrefServiceSyncableObserver* observer); |
| 63 | 64 |
| 64 // TODO(zea): Have PrefServiceSyncable implement | 65 // TODO(zea): Have PrefServiceSyncable implement |
| 65 // syncer::SyncableService directly. | 66 // syncer::SyncableService directly. |
| 66 syncer::SyncableService* GetSyncableService(); | 67 syncer::SyncableService* GetSyncableService(const syncer::ModelType& type); |
| 67 | 68 |
| 68 // Do not call this after having derived an incognito or per tab pref service. | 69 // Do not call this after having derived an incognito or per tab pref service. |
| 69 virtual void UpdateCommandLinePrefStore(PrefStore* cmd_line_store) OVERRIDE; | 70 virtual void UpdateCommandLinePrefStore(PrefStore* cmd_line_store) OVERRIDE; |
| 70 | 71 |
| 71 private: | 72 private: |
| 72 friend class PrefModelAssociator; | 73 friend class PrefModelAssociator; |
| 73 | 74 |
| 74 void AddRegisteredSyncablePreference(const char* path); | 75 void AddRegisteredSyncablePreference(const char* path, |
| 76 const PrefRegistrySyncable::PrefSyncStatus sync_status); |
| 75 | 77 |
| 76 // Invoked internally when the IsSyncing() state changes. | 78 // Invoked internally when the IsSyncing() state changes. |
| 77 void OnIsSyncingChanged(); | 79 void OnIsSyncingChanged(); |
| 78 | 80 |
| 81 // Process a local preference change. This can trigger new SyncChanges being |
| 82 // sent to the syncer. |
| 83 void ProcessPrefChange(const std::string& name); |
| 84 |
| 79 // Whether CreateIncognitoPrefService() has been called to create a | 85 // Whether CreateIncognitoPrefService() has been called to create a |
| 80 // "forked" PrefService. | 86 // "forked" PrefService. |
| 81 bool pref_service_forked_; | 87 bool pref_service_forked_; |
| 82 | 88 |
| 83 PrefModelAssociator pref_sync_associator_; | 89 PrefModelAssociator pref_sync_associator_; |
| 90 PrefModelAssociator priority_pref_sync_associator_; |
| 84 | 91 |
| 85 ObserverList<PrefServiceSyncableObserver> observer_list_; | 92 ObserverList<PrefServiceSyncableObserver> observer_list_; |
| 86 | 93 |
| 87 DISALLOW_COPY_AND_ASSIGN(PrefServiceSyncable); | 94 DISALLOW_COPY_AND_ASSIGN(PrefServiceSyncable); |
| 88 }; | 95 }; |
| 89 | 96 |
| 90 #endif // CHROME_BROWSER_PREFS_PREF_SERVICE_SYNCABLE_H_ | 97 #endif // CHROME_BROWSER_PREFS_PREF_SERVICE_SYNCABLE_H_ |
| OLD | NEW |