Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(88)

Side by Side Diff: components/pref_registry/pref_registry_syncable.h

Issue 1551433002: Switch to standard integer types in components/, part 3 of 4. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more Created 4 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_PREF_REGISTRY_PREF_REGISTRY_SYNCABLE_H_ 5 #ifndef COMPONENTS_PREF_REGISTRY_PREF_REGISTRY_SYNCABLE_H_
6 #define COMPONENTS_PREF_REGISTRY_PREF_REGISTRY_SYNCABLE_H_ 6 #define COMPONENTS_PREF_REGISTRY_PREF_REGISTRY_SYNCABLE_H_
7 7
8 #include <stdint.h>
9
8 #include <string> 10 #include <string>
9 11
10 #include "base/callback.h" 12 #include "base/callback.h"
13 #include "base/macros.h"
11 #include "base/prefs/pref_registry_simple.h" 14 #include "base/prefs/pref_registry_simple.h"
12 15
13 namespace base { 16 namespace base {
14 class DictionaryValue; 17 class DictionaryValue;
15 class FilePath; 18 class FilePath;
16 class ListValue; 19 class ListValue;
17 class Value; 20 class Value;
18 } 21 }
19 22
20 // TODO(tfarina): Change this namespace to pref_registry. 23 // TODO(tfarina): Change this namespace to pref_registry.
(...skipping 14 matching lines...) Expand all
35 // logic which is only required to support pref registration after the 38 // logic which is only required to support pref registration after the
36 // PrefService has been created which is only used by tests. We can remove this 39 // PrefService has been created which is only used by tests. We can remove this
37 // entire class and those tests with some work. 40 // entire class and those tests with some work.
38 class PrefRegistrySyncable : public PrefRegistrySimple { 41 class PrefRegistrySyncable : public PrefRegistrySimple {
39 public: 42 public:
40 // Enum of flags used when registering preferences to determine if it should 43 // Enum of flags used when registering preferences to determine if it should
41 // be synced or not. These flags are mutually exclusive, only one of them 44 // be synced or not. These flags are mutually exclusive, only one of them
42 // should ever be specified. 45 // should ever be specified.
43 // 46 //
44 // Note: These must NOT overlap with PrefRegistry::PrefRegistrationFlags. 47 // Note: These must NOT overlap with PrefRegistry::PrefRegistrationFlags.
45 enum PrefRegistrationFlags : uint32 { 48 enum PrefRegistrationFlags : uint32_t {
46 // The pref will be synced. 49 // The pref will be synced.
47 SYNCABLE_PREF = 1 << 0, 50 SYNCABLE_PREF = 1 << 0,
48 51
49 // The pref will be synced. The pref will never be encrypted and will be 52 // The pref will be synced. The pref will never be encrypted and will be
50 // synced before other datatypes. Because they're never encrypted, on first 53 // synced before other datatypes. Because they're never encrypted, on first
51 // sync, they can be synced down before the user is prompted for a 54 // sync, they can be synced down before the user is prompted for a
52 // passphrase. 55 // passphrase.
53 SYNCABLE_PRIORITY_PREF = 1 << 1, 56 SYNCABLE_PRIORITY_PREF = 1 << 1,
54 }; 57 };
55 58
56 typedef base::Callback<void(const std::string& path, uint32 flags)> 59 typedef base::Callback<void(const std::string& path, uint32_t flags)>
57 SyncableRegistrationCallback; 60 SyncableRegistrationCallback;
58 61
59 PrefRegistrySyncable(); 62 PrefRegistrySyncable();
60 63
61 // Exactly one callback can be set for the event of a syncable 64 // Exactly one callback can be set for the event of a syncable
62 // preference being registered. It will be fired after the 65 // preference being registered. It will be fired after the
63 // registration has occurred. 66 // registration has occurred.
64 // 67 //
65 // Calling this method after a callback has already been set will 68 // Calling this method after a callback has already been set will
66 // make the object forget the previous callback and use the new one 69 // make the object forget the previous callback and use the new one
67 // instead. 70 // instead.
68 void SetSyncableRegistrationCallback(const SyncableRegistrationCallback& cb); 71 void SetSyncableRegistrationCallback(const SyncableRegistrationCallback& cb);
69 72
70 // Returns a new PrefRegistrySyncable that uses the same defaults 73 // Returns a new PrefRegistrySyncable that uses the same defaults
71 // store. 74 // store.
72 scoped_refptr<PrefRegistrySyncable> ForkForIncognito(); 75 scoped_refptr<PrefRegistrySyncable> ForkForIncognito();
73 76
74 private: 77 private:
75 ~PrefRegistrySyncable() override; 78 ~PrefRegistrySyncable() override;
76 79
77 // PrefRegistrySimple overrides. 80 // PrefRegistrySimple overrides.
78 void OnPrefRegistered(const std::string& path, 81 void OnPrefRegistered(const std::string& path,
79 base::Value* default_value, 82 base::Value* default_value,
80 uint32 flags) override; 83 uint32_t flags) override;
81 84
82 SyncableRegistrationCallback callback_; 85 SyncableRegistrationCallback callback_;
83 86
84 DISALLOW_COPY_AND_ASSIGN(PrefRegistrySyncable); 87 DISALLOW_COPY_AND_ASSIGN(PrefRegistrySyncable);
85 }; 88 };
86 89
87 } // namespace user_prefs 90 } // namespace user_prefs
88 91
89 #endif // COMPONENTS_PREF_REGISTRY_PREF_REGISTRY_SYNCABLE_H_ 92 #endif // COMPONENTS_PREF_REGISTRY_PREF_REGISTRY_SYNCABLE_H_
OLDNEW
« no previous file with comments | « components/precache/core/precache_url_table_unittest.cc ('k') | components/pref_registry/pref_registry_syncable.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698