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

Side by Side Diff: chrome/browser/ui/webui/options/core_options_handler.h

Issue 8102019: redesign and reimplement proxy config service and tracker, revise proxy ui on cros (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #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/ui/webui/options/options_ui.h" 16 #include "chrome/browser/ui/webui/options/options_ui.h"
16 17
17 // Core options UI handler. 18 // Core options UI handler.
18 // Handles resource and JS calls common to all options sub-pages. 19 // Handles resource and JS calls common to all options sub-pages.
19 class CoreOptionsHandler : public OptionsPageUIHandler { 20 class CoreOptionsHandler : public OptionsPageUIHandler {
20 public: 21 public:
21 CoreOptionsHandler(); 22 CoreOptionsHandler();
22 virtual ~CoreOptionsHandler(); 23 virtual ~CoreOptionsHandler();
23 24
24 // OptionsPageUIHandler implementation. 25 // OptionsPageUIHandler implementation.
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 // Clears pref value for given |pref_name|. 60 // Clears pref value for given |pref_name|.
60 void ClearPref(const std::string& pref_name, const std::string& metric); 61 void ClearPref(const std::string& pref_name, const std::string& metric);
61 62
62 // Stops observing given preference identified by |path|. 63 // Stops observing given preference identified by |path|.
63 virtual void StopObservingPref(const std::string& path); 64 virtual void StopObservingPref(const std::string& path);
64 65
65 // Records a user metric action for the given value. 66 // Records a user metric action for the given value.
66 void ProcessUserMetric(const Value* value, 67 void ProcessUserMetric(const Value* value,
67 const std::string& metric); 68 const std::string& metric);
68 69
70 // Notifies registered JS callbacks on change in |pref_name| preference.
71 // |controlling_pref_name| controls if |pref_name| is managed by
72 // policy/extension; empty |controlling_pref_name| indicates no other pref is
73 // controlling |pref_name|.
74 void NotifyPrefChanged(const std::string& pref_name,
75 const std::string& controlling_pref_name);
76
77 // Creates dictioary value for |pref|, |controlling_pref| controls if |pref|
Mattias Nissler (ping if slow) 2011/10/19 19:27:36 s/dictioary/dictionary/
kuan 2011/10/20 00:41:11 Done.
78 // is managed by policy/managed; NULL indicates no ordher pref is controlling
Mattias Nissler (ping if slow) 2011/10/19 19:27:36 s/ordher/other/
kuan 2011/10/20 00:41:11 Done.
79 // |pref|.
80 DictionaryValue* CreateValueForPref(const PrefService::Preference* pref,
81 const PrefService::Preference* controlling_pref);
Mattias Nissler (ping if slow) 2011/10/19 19:27:36 parameters should be aligned.
kuan 2011/10/20 00:41:11 Done.
82
69 typedef std::multimap<std::string, std::wstring> PreferenceCallbackMap; 83 typedef std::multimap<std::string, std::wstring> PreferenceCallbackMap;
70 PreferenceCallbackMap pref_callback_map_; 84 PreferenceCallbackMap pref_callback_map_;
85
71 private: 86 private:
72 // Type of preference value received from the page. This doesn't map 1:1 to 87 // Type of preference value received from the page. This doesn't map 1:1 to
73 // Value::Type, since a TYPE_STRING can require custom processing. 88 // Value::Type, since a TYPE_STRING can require custom processing.
74 enum PrefType { 89 enum PrefType {
75 TYPE_BOOLEAN = 0, 90 TYPE_BOOLEAN = 0,
76 TYPE_INTEGER, 91 TYPE_INTEGER,
77 TYPE_DOUBLE, 92 TYPE_DOUBLE,
78 TYPE_STRING, 93 TYPE_STRING,
79 TYPE_URL, 94 TYPE_URL,
80 TYPE_LIST, 95 TYPE_LIST,
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 // item 1 - name of the metric identifier (optional). 130 // item 1 - name of the metric identifier (optional).
116 void HandleClearPref(const ListValue* args); 131 void HandleClearPref(const ListValue* args);
117 132
118 // Callback for the "coreOptionsUserMetricsAction" message. This records 133 // Callback for the "coreOptionsUserMetricsAction" message. This records
119 // an action that should be tracked if metrics recording is enabled. |args| 134 // an action that should be tracked if metrics recording is enabled. |args|
120 // is an array that contains a single item, the name of the metric identifier. 135 // is an array that contains a single item, the name of the metric identifier.
121 void HandleUserMetricsAction(const ListValue* args); 136 void HandleUserMetricsAction(const ListValue* args);
122 137
123 void UpdateClearPluginLSOData(); 138 void UpdateClearPluginLSOData();
124 139
125 void NotifyPrefChanged(const std::string* pref_name);
126
127 OptionsPageUIHandlerHost* handlers_host_; 140 OptionsPageUIHandlerHost* handlers_host_;
128 PrefChangeRegistrar registrar_; 141 PrefChangeRegistrar registrar_;
129 142
130 // Used for asynchronously updating the preference stating whether clearing 143 // Used for asynchronously updating the preference stating whether clearing
131 // LSO data is supported. 144 // LSO data is supported.
132 PluginDataRemoverHelper clear_plugin_lso_data_enabled_; 145 PluginDataRemoverHelper clear_plugin_lso_data_enabled_;
133 146
134 DISALLOW_COPY_AND_ASSIGN(CoreOptionsHandler); 147 DISALLOW_COPY_AND_ASSIGN(CoreOptionsHandler);
135 }; 148 };
136 149
137 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_CORE_OPTIONS_HANDLER_H_ 150 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_CORE_OPTIONS_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698