| 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 "components/user_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 29 matching lines...) Expand all  Loading... | 
| 49   // but uses a fresh non-persistent overlay for the user pref store and an | 50   // but uses a fresh non-persistent overlay for the user pref store and an | 
| 50   // individual extension pref store (to cache the effective extension prefs for | 51   // individual extension pref store (to cache the effective extension prefs for | 
| 51   // incognito windows). | 52   // incognito windows). | 
| 52   PrefServiceSyncable* CreateIncognitoPrefService( | 53   PrefServiceSyncable* CreateIncognitoPrefService( | 
| 53       PrefStore* incognito_extension_prefs); | 54       PrefStore* incognito_extension_prefs); | 
| 54 | 55 | 
| 55   // Returns true if preferences state has synchronized with the remote | 56   // Returns true if preferences state has synchronized with the remote | 
| 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). | 
|  | 60   // | 
|  | 61   // TODO(albertb): Given that we now support priority preferences, callers of | 
|  | 62   // this method are likely better off making the preferences they care about | 
|  | 63   // into priority preferences and calling IsPrioritySyncing(). | 
| 59   bool IsSyncing(); | 64   bool IsSyncing(); | 
| 60 | 65 | 
|  | 66   // Returns true if priority preferences state has synchronized with the remote | 
|  | 67   // priority preferences. | 
|  | 68   bool IsPrioritySyncing(); | 
|  | 69 | 
| 61   void AddObserver(PrefServiceSyncableObserver* observer); | 70   void AddObserver(PrefServiceSyncableObserver* observer); | 
| 62   void RemoveObserver(PrefServiceSyncableObserver* observer); | 71   void RemoveObserver(PrefServiceSyncableObserver* observer); | 
| 63 | 72 | 
| 64   // TODO(zea): Have PrefServiceSyncable implement | 73   // TODO(zea): Have PrefServiceSyncable implement | 
| 65   // syncer::SyncableService directly. | 74   // syncer::SyncableService directly. | 
| 66   syncer::SyncableService* GetSyncableService(); | 75   syncer::SyncableService* GetSyncableService(const syncer::ModelType& type); | 
| 67 | 76 | 
| 68   // Do not call this after having derived an incognito or per tab pref service. | 77   // Do not call this after having derived an incognito or per tab pref service. | 
| 69   virtual void UpdateCommandLinePrefStore(PrefStore* cmd_line_store) OVERRIDE; | 78   virtual void UpdateCommandLinePrefStore(PrefStore* cmd_line_store) OVERRIDE; | 
| 70 | 79 | 
| 71  private: | 80  private: | 
| 72   friend class PrefModelAssociator; | 81   friend class PrefModelAssociator; | 
| 73 | 82 | 
| 74   void AddRegisteredSyncablePreference(const char* path); | 83   void AddRegisteredSyncablePreference( | 
|  | 84       const char* path, | 
|  | 85       const PrefRegistrySyncable::PrefSyncStatus sync_status); | 
| 75 | 86 | 
| 76   // Invoked internally when the IsSyncing() state changes. | 87   // Invoked internally when the IsSyncing() state changes. | 
| 77   void OnIsSyncingChanged(); | 88   void OnIsSyncingChanged(); | 
| 78 | 89 | 
|  | 90   // Process a local preference change. This can trigger new SyncChanges being | 
|  | 91   // sent to the syncer. | 
|  | 92   void ProcessPrefChange(const std::string& name); | 
|  | 93 | 
| 79   // Whether CreateIncognitoPrefService() has been called to create a | 94   // Whether CreateIncognitoPrefService() has been called to create a | 
| 80   // "forked" PrefService. | 95   // "forked" PrefService. | 
| 81   bool pref_service_forked_; | 96   bool pref_service_forked_; | 
| 82 | 97 | 
| 83   PrefModelAssociator pref_sync_associator_; | 98   PrefModelAssociator pref_sync_associator_; | 
|  | 99   PrefModelAssociator priority_pref_sync_associator_; | 
| 84 | 100 | 
| 85   ObserverList<PrefServiceSyncableObserver> observer_list_; | 101   ObserverList<PrefServiceSyncableObserver> observer_list_; | 
| 86 | 102 | 
| 87   DISALLOW_COPY_AND_ASSIGN(PrefServiceSyncable); | 103   DISALLOW_COPY_AND_ASSIGN(PrefServiceSyncable); | 
| 88 }; | 104 }; | 
| 89 | 105 | 
| 90 #endif  // CHROME_BROWSER_PREFS_PREF_SERVICE_SYNCABLE_H_ | 106 #endif  // CHROME_BROWSER_PREFS_PREF_SERVICE_SYNCABLE_H_ | 
| OLD | NEW | 
|---|