| 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_OPTIONS2_CORE_OPTIONS_HANDLER2_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS2_CORE_OPTIONS_HANDLER2_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS2_CORE_OPTIONS_HANDLER2_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS2_CORE_OPTIONS_HANDLER2_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/plugin_data_remover_helper.h" | 13 #include "chrome/browser/plugin_data_remover_helper.h" |
| 14 #include "chrome/browser/prefs/pref_change_registrar.h" | 14 #include "chrome/browser/prefs/pref_change_registrar.h" |
| 15 #include "chrome/browser/prefs/pref_service.h" | 15 #include "chrome/browser/prefs/pref_service.h" |
| 16 #include "chrome/browser/ui/webui/options2/options_ui2.h" | 16 #include "chrome/browser/ui/webui/options2/options_ui2.h" |
| 17 | 17 |
| 18 namespace options2 { | 18 namespace options2 { |
| 19 | 19 |
| 20 // Core options UI handler. | 20 // Core options UI handler. |
| 21 // Handles resource and JS calls common to all options sub-pages. | 21 // Handles resource and JS calls common to all options sub-pages. |
| 22 class CoreOptionsHandler : public OptionsPageUIHandler { | 22 class CoreOptionsHandler : public OptionsPageUIHandler { |
| 23 public: | 23 public: |
| 24 CoreOptionsHandler(); | 24 CoreOptionsHandler(); |
| 25 virtual ~CoreOptionsHandler(); | 25 virtual ~CoreOptionsHandler(); |
| 26 | 26 |
| 27 // OptionsPageUIHandler implementation. | 27 // OptionsPageUIHandler implementation. |
| 28 virtual void GetLocalizedValues(DictionaryValue* localized_strings) OVERRIDE; | 28 virtual void GetLocalizedValues(DictionaryValue* localized_strings) OVERRIDE; |
| 29 virtual void InitializeHandler() OVERRIDE; | |
| 30 virtual void InitializePage() OVERRIDE; | 29 virtual void InitializePage() OVERRIDE; |
| 31 virtual void Uninitialize() OVERRIDE; | 30 virtual void Uninitialize() OVERRIDE; |
| 32 | 31 |
| 33 // content::NotificationObserver implementation. | 32 // content::NotificationObserver implementation. |
| 34 virtual void Observe(int type, | 33 virtual void Observe(int type, |
| 35 const content::NotificationSource& source, | 34 const content::NotificationSource& source, |
| 36 const content::NotificationDetails& details) OVERRIDE; | 35 const content::NotificationDetails& details) OVERRIDE; |
| 37 | 36 |
| 38 // WebUIMessageHandler implementation. | 37 // WebUIMessageHandler implementation. |
| 39 virtual void RegisterMessages() OVERRIDE; | 38 virtual void RegisterMessages() OVERRIDE; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 // Value::Type, since a TYPE_STRING can require custom processing. | 90 // Value::Type, since a TYPE_STRING can require custom processing. |
| 92 enum PrefType { | 91 enum PrefType { |
| 93 TYPE_BOOLEAN = 0, | 92 TYPE_BOOLEAN = 0, |
| 94 TYPE_INTEGER, | 93 TYPE_INTEGER, |
| 95 TYPE_DOUBLE, | 94 TYPE_DOUBLE, |
| 96 TYPE_STRING, | 95 TYPE_STRING, |
| 97 TYPE_URL, | 96 TYPE_URL, |
| 98 TYPE_LIST, | 97 TYPE_LIST, |
| 99 }; | 98 }; |
| 100 | 99 |
| 101 // Callback for the "coreOptionsInitialize" message. This message will | 100 // Callback for the "coreOptionsInitializePages" message. This calls the |
| 102 // trigger the Initialize() method of all other handlers so that final | 101 // InitializePage() method of all other handlers, to pass data back to the |
| 103 // setup can be performed before the page is shown. | 102 // JavaScript on the page so it can populate the UI. |
| 104 void HandleInitialize(const ListValue* args); | 103 void HandleInitializePages(const ListValue* args); |
| 105 | 104 |
| 106 // Callback for the "fetchPrefs" message. This message accepts the list of | 105 // Callback for the "fetchPrefs" message. This message accepts the list of |
| 107 // preference names passed as the |args| parameter (ListValue). It passes | 106 // preference names passed as the |args| parameter (ListValue). It passes |
| 108 // results dictionary of preference values by calling prefsFetched() JS method | 107 // results dictionary of preference values by calling prefsFetched() JS method |
| 109 // on the page. | 108 // on the page. |
| 110 void HandleFetchPrefs(const ListValue* args); | 109 void HandleFetchPrefs(const ListValue* args); |
| 111 | 110 |
| 112 // Callback for the "observePrefs" message. This message initiates | 111 // Callback for the "observePrefs" message. This message initiates |
| 113 // notification observing for given array of preference names. | 112 // notification observing for given array of preference names. |
| 114 void HandleObservePrefs(const ListValue* args); | 113 void HandleObservePrefs(const ListValue* args); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 // Used for asynchronously updating the preference stating whether clearing | 145 // Used for asynchronously updating the preference stating whether clearing |
| 147 // LSO data is supported. | 146 // LSO data is supported. |
| 148 PluginDataRemoverHelper clear_plugin_lso_data_enabled_; | 147 PluginDataRemoverHelper clear_plugin_lso_data_enabled_; |
| 149 | 148 |
| 150 DISALLOW_COPY_AND_ASSIGN(CoreOptionsHandler); | 149 DISALLOW_COPY_AND_ASSIGN(CoreOptionsHandler); |
| 151 }; | 150 }; |
| 152 | 151 |
| 153 } // namespace options2 | 152 } // namespace options2 |
| 154 | 153 |
| 155 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS2_CORE_OPTIONS_HANDLER2_H_ | 154 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS2_CORE_OPTIONS_HANDLER2_H_ |
| OLD | NEW |