| 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 COMPONENTS_SYNC_BASE_SYNC_PREFS_H_ |    5 #ifndef COMPONENTS_SYNC_BASE_SYNC_PREFS_H_ | 
|    6 #define COMPONENTS_SYNC_BASE_SYNC_PREFS_H_ |    6 #define COMPONENTS_SYNC_BASE_SYNC_PREFS_H_ | 
|    7  |    7  | 
|    8 #include <stdint.h> |    8 #include <stdint.h> | 
|    9  |    9  | 
|   10 #include <map> |   10 #include <map> | 
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  177   // initialization after transition. |  177   // initialization after transition. | 
|  178   void SetNigoriSpecificsForPassphraseTransition( |  178   void SetNigoriSpecificsForPassphraseTransition( | 
|  179       const sync_pb::NigoriSpecifics& nigori_specifics); |  179       const sync_pb::NigoriSpecifics& nigori_specifics); | 
|  180   void GetNigoriSpecificsForPassphraseTransition( |  180   void GetNigoriSpecificsForPassphraseTransition( | 
|  181       sync_pb::NigoriSpecifics* nigori_specifics) const; |  181       sync_pb::NigoriSpecifics* nigori_specifics) const; | 
|  182  |  182  | 
|  183   // Gets the local sync backend enabled state and its database location. |  183   // Gets the local sync backend enabled state and its database location. | 
|  184   bool IsLocalSyncEnabled() const; |  184   bool IsLocalSyncEnabled() const; | 
|  185   base::FilePath GetLocalSyncBackendDir() const; |  185   base::FilePath GetLocalSyncBackendDir() const; | 
|  186  |  186  | 
 |  187   // Returns a ModelTypeSet based on |types| expanded to include pref groups | 
 |  188   // (see |pref_groups_|), but as a subset of |registered_types|. | 
 |  189   ModelTypeSet ResolvePrefGroups(ModelTypeSet registered_types, | 
 |  190                                  ModelTypeSet types) const; | 
 |  191  | 
|  187  private: |  192  private: | 
|  188   void RegisterPrefGroups(); |  193   void RegisterPrefGroups(); | 
|  189  |  194  | 
|  190   static void RegisterDataTypePreferredPref( |  195   static void RegisterDataTypePreferredPref( | 
|  191       user_prefs::PrefRegistrySyncable* prefs, |  196       user_prefs::PrefRegistrySyncable* prefs, | 
|  192       ModelType type, |  197       ModelType type, | 
|  193       bool is_preferred); |  198       bool is_preferred); | 
|  194   bool GetDataTypePreferred(ModelType type) const; |  199   bool GetDataTypePreferred(ModelType type) const; | 
|  195   void SetDataTypePreferred(ModelType type, bool is_preferred); |  200   void SetDataTypePreferred(ModelType type, bool is_preferred); | 
|  196  |  201  | 
|  197   // Returns a ModelTypeSet based on |types| expanded to include pref groups |  | 
|  198   // (see |pref_groups_|), but as a subset of |registered_types|. |  | 
|  199   ModelTypeSet ResolvePrefGroups(ModelTypeSet registered_types, |  | 
|  200                                  ModelTypeSet types) const; |  | 
|  201  |  | 
|  202   void OnSyncManagedPrefChanged(); |  202   void OnSyncManagedPrefChanged(); | 
|  203  |  203  | 
|  204   // May be null. |  204   // May be null. | 
|  205   PrefService* const pref_service_; |  205   PrefService* const pref_service_; | 
|  206  |  206  | 
|  207   base::ObserverList<SyncPrefObserver> sync_pref_observers_; |  207   base::ObserverList<SyncPrefObserver> sync_pref_observers_; | 
|  208  |  208  | 
|  209   // The preference that controls whether sync is under control by |  209   // The preference that controls whether sync is under control by | 
|  210   // configuration management. |  210   // configuration management. | 
|  211   BooleanPrefMember pref_sync_managed_; |  211   BooleanPrefMember pref_sync_managed_; | 
|  212  |  212  | 
|  213   // Groups of prefs that always have the same value as a "master" pref. |  213   // Groups of prefs that always have the same value as a "master" pref. | 
|  214   // For example, the APPS group has {APP_NOTIFICATIONS, APP_SETTINGS} |  214   // For example, the APPS group has {APP_NOTIFICATIONS, APP_SETTINGS} | 
|  215   // (as well as APPS, but that is implied), so |  215   // (as well as APPS, but that is implied), so | 
|  216   //   pref_groups_[APPS] =       { APP_NOTIFICATIONS, |  216   //   pref_groups_[APPS] =       { APP_NOTIFICATIONS, | 
|  217   //                                          APP_SETTINGS } |  217   //                                          APP_SETTINGS } | 
|  218   //   pref_groups_[EXTENSIONS] = { EXTENSION_SETTINGS } |  218   //   pref_groups_[EXTENSIONS] = { EXTENSION_SETTINGS } | 
|  219   // etc. |  219   // etc. | 
|  220   typedef std::map<ModelType, ModelTypeSet> PrefGroupsMap; |  220   typedef std::map<ModelType, ModelTypeSet> PrefGroupsMap; | 
|  221   PrefGroupsMap pref_groups_; |  221   PrefGroupsMap pref_groups_; | 
|  222  |  222  | 
|  223   DISALLOW_COPY_AND_ASSIGN(SyncPrefs); |  223   DISALLOW_COPY_AND_ASSIGN(SyncPrefs); | 
|  224 }; |  224 }; | 
|  225  |  225  | 
|  226 }  // namespace syncer |  226 }  // namespace syncer | 
|  227  |  227  | 
|  228 #endif  // COMPONENTS_SYNC_BASE_SYNC_PREFS_H_ |  228 #endif  // COMPONENTS_SYNC_BASE_SYNC_PREFS_H_ | 
| OLD | NEW |