| 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> |
| 11 #include <memory> | 11 #include <memory> |
| 12 #include <string> | 12 #include <string> |
| 13 | 13 |
| 14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
| 15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
| 17 #include "base/observer_list.h" | 17 #include "base/observer_list.h" |
| 18 #include "base/threading/non_thread_safe.h" | 18 #include "base/sequence_checker.h" |
| 19 #include "base/time/time.h" | 19 #include "base/time/time.h" |
| 20 #include "build/build_config.h" | 20 #include "build/build_config.h" |
| 21 #include "components/prefs/pref_member.h" | 21 #include "components/prefs/pref_member.h" |
| 22 #include "components/sync/base/model_type.h" | 22 #include "components/sync/base/model_type.h" |
| 23 #include "components/sync/protocol/sync.pb.h" | 23 #include "components/sync/protocol/sync.pb.h" |
| 24 | 24 |
| 25 class PrefService; | 25 class PrefService; |
| 26 | 26 |
| 27 namespace user_prefs { | 27 namespace user_prefs { |
| 28 class PrefRegistrySyncable; | 28 class PrefRegistrySyncable; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 46 // | 46 // |
| 47 // TODO(akalin): Some classes still read the prefs directly. Consider | 47 // TODO(akalin): Some classes still read the prefs directly. Consider |
| 48 // passing down a pointer to SyncPrefs to them. A list of files: | 48 // passing down a pointer to SyncPrefs to them. A list of files: |
| 49 // | 49 // |
| 50 // profile_sync_service_startup_unittest.cc | 50 // profile_sync_service_startup_unittest.cc |
| 51 // profile_sync_service.cc | 51 // profile_sync_service.cc |
| 52 // sync_setup_flow.cc | 52 // sync_setup_flow.cc |
| 53 // sync_setup_wizard.cc | 53 // sync_setup_wizard.cc |
| 54 // sync_setup_wizard_unittest.cc | 54 // sync_setup_wizard_unittest.cc |
| 55 // two_client_preferences_sync_test.cc | 55 // two_client_preferences_sync_test.cc |
| 56 class SyncPrefs : NON_EXPORTED_BASE(public base::NonThreadSafe), | 56 class SyncPrefs : public base::SupportsWeakPtr<SyncPrefs> { |
| 57 public base::SupportsWeakPtr<SyncPrefs> { | |
| 58 public: | 57 public: |
| 59 // |pref_service| may not be null. | 58 // |pref_service| may not be null. |
| 60 // Does not take ownership of |pref_service|. | 59 // Does not take ownership of |pref_service|. |
| 61 explicit SyncPrefs(PrefService* pref_service); | 60 explicit SyncPrefs(PrefService* pref_service); |
| 62 | 61 |
| 63 // For testing. | 62 // For testing. |
| 64 SyncPrefs(); | 63 SyncPrefs(); |
| 65 | 64 |
| 66 virtual ~SyncPrefs(); | 65 virtual ~SyncPrefs(); |
| 67 | 66 |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 // Groups of prefs that always have the same value as a "master" pref. | 212 // Groups of prefs that always have the same value as a "master" pref. |
| 214 // For example, the APPS group has {APP_NOTIFICATIONS, APP_SETTINGS} | 213 // For example, the APPS group has {APP_NOTIFICATIONS, APP_SETTINGS} |
| 215 // (as well as APPS, but that is implied), so | 214 // (as well as APPS, but that is implied), so |
| 216 // pref_groups_[APPS] = { APP_NOTIFICATIONS, | 215 // pref_groups_[APPS] = { APP_NOTIFICATIONS, |
| 217 // APP_SETTINGS } | 216 // APP_SETTINGS } |
| 218 // pref_groups_[EXTENSIONS] = { EXTENSION_SETTINGS } | 217 // pref_groups_[EXTENSIONS] = { EXTENSION_SETTINGS } |
| 219 // etc. | 218 // etc. |
| 220 using PrefGroupsMap = std::map<ModelType, ModelTypeSet>; | 219 using PrefGroupsMap = std::map<ModelType, ModelTypeSet>; |
| 221 PrefGroupsMap pref_groups_; | 220 PrefGroupsMap pref_groups_; |
| 222 | 221 |
| 222 SEQUENCE_CHECKER(sequence_checker_); |
| 223 |
| 223 DISALLOW_COPY_AND_ASSIGN(SyncPrefs); | 224 DISALLOW_COPY_AND_ASSIGN(SyncPrefs); |
| 224 }; | 225 }; |
| 225 | 226 |
| 226 } // namespace syncer | 227 } // namespace syncer |
| 227 | 228 |
| 228 #endif // COMPONENTS_SYNC_BASE_SYNC_PREFS_H_ | 229 #endif // COMPONENTS_SYNC_BASE_SYNC_PREFS_H_ |
| OLD | NEW |