OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_DOM_UI_CORE_OPTIONS_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_DOM_UI_CORE_OPTIONS_HANDLER_H_ |
6 #define CHROME_BROWSER_DOM_UI_CORE_OPTIONS_HANDLER_H_ | 6 #define CHROME_BROWSER_DOM_UI_CORE_OPTIONS_HANDLER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/values.h" | 12 #include "base/values.h" |
13 #include "chrome/browser/dom_ui/options_ui.h" | 13 #include "chrome/browser/dom_ui/options_ui.h" |
| 14 #include "chrome/browser/prefs/pref_change_registrar.h" |
14 | 15 |
15 // Core options UI handler. | 16 // Core options UI handler. |
16 // Handles resource and JS calls common to all options sub-pages. | 17 // Handles resource and JS calls common to all options sub-pages. |
17 class CoreOptionsHandler : public OptionsPageUIHandler { | 18 class CoreOptionsHandler : public OptionsPageUIHandler { |
18 public: | 19 public: |
19 CoreOptionsHandler(); | 20 CoreOptionsHandler(); |
20 | 21 |
21 // OptionsUIHandler implementation. | 22 // OptionsUIHandler implementation. |
22 virtual void GetLocalizedValues(DictionaryValue* localized_strings); | 23 virtual void GetLocalizedValues(DictionaryValue* localized_strings); |
23 virtual void Uninitialize(); | 24 virtual void Uninitialize(); |
24 | 25 |
25 | |
26 // NotificationObserver implementation. | 26 // NotificationObserver implementation. |
27 virtual void Observe(NotificationType type, | 27 virtual void Observe(NotificationType type, |
28 const NotificationSource& source, | 28 const NotificationSource& source, |
29 const NotificationDetails& details); | 29 const NotificationDetails& details); |
30 | 30 |
31 // DOMMessageHandler implementation. | 31 // DOMMessageHandler implementation. |
32 virtual void RegisterMessages(); | 32 virtual void RegisterMessages(); |
| 33 virtual DOMMessageHandler* Attach(DOMUI* dom_ui); |
33 | 34 |
34 protected: | 35 protected: |
35 // Fetches a pref value of given |pref_name|. | 36 // Fetches a pref value of given |pref_name|. |
36 // Note that caller owns the returned Value. | 37 // Note that caller owns the returned Value. |
37 virtual Value* FetchPref(const std::string& pref_name); | 38 virtual Value* FetchPref(const std::string& pref_name); |
38 | 39 |
39 // Observes a pref of given |pref_name|. | 40 // Observes a pref of given |pref_name|. |
40 virtual void ObservePref(const std::string& pref_name); | 41 virtual void ObservePref(const std::string& pref_name); |
41 | 42 |
42 // Sets a pref value |value_string| of |pref_type| to given |pref_name|. | 43 // Sets a pref value |value_string| of |pref_type| to given |pref_name|. |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 void HandleSetObjectPref(const ListValue* args); | 81 void HandleSetObjectPref(const ListValue* args); |
81 | 82 |
82 void HandleSetPref(const ListValue* args, Value::ValueType type); | 83 void HandleSetPref(const ListValue* args, Value::ValueType type); |
83 | 84 |
84 // Callback for the "coreOptionsUserMetricsAction" message. This records | 85 // Callback for the "coreOptionsUserMetricsAction" message. This records |
85 // an action that should be tracked if metrics recording is enabled. | 86 // an action that should be tracked if metrics recording is enabled. |
86 void HandleUserMetricsAction(const ListValue* args); | 87 void HandleUserMetricsAction(const ListValue* args); |
87 | 88 |
88 void NotifyPrefChanged(const std::string* pref_name); | 89 void NotifyPrefChanged(const std::string* pref_name); |
89 | 90 |
| 91 PrefChangeRegistrar registrar_; |
| 92 |
90 DISALLOW_COPY_AND_ASSIGN(CoreOptionsHandler); | 93 DISALLOW_COPY_AND_ASSIGN(CoreOptionsHandler); |
91 }; | 94 }; |
92 | 95 |
93 #endif // CHROME_BROWSER_DOM_UI_CORE_OPTIONS_HANDLER_H_ | 96 #endif // CHROME_BROWSER_DOM_UI_CORE_OPTIONS_HANDLER_H_ |
OLD | NEW |