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_VALUE_STORE_H_ | 5 #ifndef CHROME_BROWSER_PREFS_PREF_VALUE_STORE_H_ |
6 #define CHROME_BROWSER_PREFS_PREF_VALUE_STORE_H_ | 6 #define CHROME_BROWSER_PREFS_PREF_VALUE_STORE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 28 matching lines...) Expand all Loading... |
39 // be non-null if any preferences are to be registered. | 39 // be non-null if any preferences are to be registered. |
40 // | 40 // |
41 // |pref_notifier| facilitates broadcasting preference change notifications | 41 // |pref_notifier| facilitates broadcasting preference change notifications |
42 // to the world. | 42 // to the world. |
43 PrefValueStore(PrefStore* managed_prefs, | 43 PrefValueStore(PrefStore* managed_prefs, |
44 PrefStore* extension_prefs, | 44 PrefStore* extension_prefs, |
45 PrefStore* command_line_prefs, | 45 PrefStore* command_line_prefs, |
46 PrefStore* user_prefs, | 46 PrefStore* user_prefs, |
47 PrefStore* recommended_prefs, | 47 PrefStore* recommended_prefs, |
48 PrefStore* default_prefs, | 48 PrefStore* default_prefs, |
49 PrefModelAssociator* pref_sync_associator, | |
50 PrefNotifier* pref_notifier); | 49 PrefNotifier* pref_notifier); |
51 virtual ~PrefValueStore(); | 50 virtual ~PrefValueStore(); |
52 | 51 |
53 // Creates a clone of this PrefValueStore with PrefStores overwritten | 52 // Creates a clone of this PrefValueStore with PrefStores overwritten |
54 // by the parameters passed, if unequal NULL. | 53 // by the parameters passed, if unequal NULL. |
55 PrefValueStore* CloneAndSpecialize(PrefStore* managed_prefs, | 54 PrefValueStore* CloneAndSpecialize(PrefStore* managed_prefs, |
56 PrefStore* extension_prefs, | 55 PrefStore* extension_prefs, |
57 PrefStore* command_line_prefs, | 56 PrefStore* command_line_prefs, |
58 PrefStore* user_prefs, | 57 PrefStore* user_prefs, |
59 PrefStore* recommended_prefs, | 58 PrefStore* recommended_prefs, |
60 PrefStore* default_prefs, | 59 PrefStore* default_prefs, |
61 PrefModelAssociator* pref_sync_associator, | |
62 PrefNotifier* pref_notifier); | 60 PrefNotifier* pref_notifier); |
63 | 61 |
| 62 // TODO(joi): Remove this completely; the part PrefModelAssociator |
| 63 // needs can be handled simply as a PrefObserver. |
| 64 void set_sync_associator(PrefModelAssociator* sync_associator); |
| 65 |
64 // Gets the value for the given preference name that has the specified value | 66 // Gets the value for the given preference name that has the specified value |
65 // type. Values stored in a PrefStore that have the matching |name| but | 67 // type. Values stored in a PrefStore that have the matching |name| but |
66 // a non-matching |type| are silently skipped. Returns true if a valid value | 68 // a non-matching |type| are silently skipped. Returns true if a valid value |
67 // was found in any of the available PrefStores. Most callers should use | 69 // was found in any of the available PrefStores. Most callers should use |
68 // Preference::GetValue() instead of calling this method directly. | 70 // Preference::GetValue() instead of calling this method directly. |
69 bool GetValue(const std::string& name, | 71 bool GetValue(const std::string& name, |
70 base::Value::Type type, | 72 base::Value::Type type, |
71 const Value** out_value) const; | 73 const Value** out_value) const; |
72 | 74 |
73 // Gets the recommended value for the given preference name that has the | 75 // Gets the recommended value for the given preference name that has the |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 // A mapping of preference names to their registered types. | 248 // A mapping of preference names to their registered types. |
247 PrefTypeMap pref_types_; | 249 PrefTypeMap pref_types_; |
248 | 250 |
249 // True if not all of the PrefStores were initialized successfully. | 251 // True if not all of the PrefStores were initialized successfully. |
250 bool initialization_failed_; | 252 bool initialization_failed_; |
251 | 253 |
252 DISALLOW_COPY_AND_ASSIGN(PrefValueStore); | 254 DISALLOW_COPY_AND_ASSIGN(PrefValueStore); |
253 }; | 255 }; |
254 | 256 |
255 #endif // CHROME_BROWSER_PREFS_PREF_VALUE_STORE_H_ | 257 #endif // CHROME_BROWSER_PREFS_PREF_VALUE_STORE_H_ |
OLD | NEW |