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_UI_WEBUI_OPTIONS_CORE_OPTIONS_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_CORE_OPTIONS_HANDLER_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_CORE_OPTIONS_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_CORE_OPTIONS_HANDLER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 | 81 |
82 // Calls JS callbacks to report a change in the value of the |name| | 82 // Calls JS callbacks to report a change in the value of the |name| |
83 // preference. |value| is the new value for |name|. Called from | 83 // preference. |value| is the new value for |name|. Called from |
84 // Notify*Changed methods to fire off the notifications. | 84 // Notify*Changed methods to fire off the notifications. |
85 void DispatchPrefChangeNotification(const std::string& name, | 85 void DispatchPrefChangeNotification(const std::string& name, |
86 scoped_ptr<base::Value> value); | 86 scoped_ptr<base::Value> value); |
87 | 87 |
88 // Creates dictionary value for the pref described by |pref_name|. | 88 // Creates dictionary value for the pref described by |pref_name|. |
89 // If |controlling_pref| is not empty, it describes the pref that manages | 89 // If |controlling_pref| is not empty, it describes the pref that manages |
90 // |pref| via policy or extension. | 90 // |pref| via policy or extension. |
91 base::Value* CreateValueForPref(const std::string& pref_name, | 91 virtual base::Value* CreateValueForPref( |
92 const std::string& controlling_pref_name); | 92 const std::string& pref_name, |
| 93 const std::string& controlling_pref_name); |
93 | 94 |
94 typedef std::multimap<std::string, std::string> PreferenceCallbackMap; | 95 typedef std::multimap<std::string, std::string> PreferenceCallbackMap; |
95 PreferenceCallbackMap pref_callback_map_; | 96 PreferenceCallbackMap pref_callback_map_; |
96 | 97 |
97 private: | 98 private: |
98 // Type of preference value received from the page. This doesn't map 1:1 to | 99 // Type of preference value received from the page. This doesn't map 1:1 to |
99 // Value::Type, since a TYPE_STRING can require custom processing. | 100 // Value::Type, since a TYPE_STRING can require custom processing. |
100 enum PrefType { | 101 enum PrefType { |
101 TYPE_BOOLEAN = 0, | 102 TYPE_BOOLEAN = 0, |
102 TYPE_INTEGER, | 103 TYPE_INTEGER, |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 typedef std::map<std::string, base::Callback<bool(const base::Value*)> > | 173 typedef std::map<std::string, base::Callback<bool(const base::Value*)> > |
173 PrefChangeFilterMap; | 174 PrefChangeFilterMap; |
174 PrefChangeFilterMap pref_change_filters_; | 175 PrefChangeFilterMap pref_change_filters_; |
175 | 176 |
176 DISALLOW_COPY_AND_ASSIGN(CoreOptionsHandler); | 177 DISALLOW_COPY_AND_ASSIGN(CoreOptionsHandler); |
177 }; | 178 }; |
178 | 179 |
179 } // namespace options | 180 } // namespace options |
180 | 181 |
181 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_CORE_OPTIONS_HANDLER_H_ | 182 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_CORE_OPTIONS_HANDLER_H_ |
OLD | NEW |