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

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

Issue 7259019: Move base/values.h into the base namespace. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 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_EXTENSION_SETTINGS_HANDLER_H_ 5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_EXTENSION_SETTINGS_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_EXTENSION_SETTINGS_HANDLER_H_ 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_EXTENSION_SETTINGS_HANDLER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "chrome/browser/extensions/extension_uninstall_dialog.h" 13 #include "chrome/browser/extensions/extension_uninstall_dialog.h"
14 #include "chrome/browser/extensions/pack_extension_job.h" 14 #include "chrome/browser/extensions/pack_extension_job.h"
15 #include "chrome/browser/ui/shell_dialogs.h" 15 #include "chrome/browser/ui/shell_dialogs.h"
16 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" 16 #include "chrome/browser/ui/webui/chrome_url_data_manager.h"
17 #include "chrome/browser/ui/webui/chrome_web_ui.h" 17 #include "chrome/browser/ui/webui/chrome_web_ui.h"
18 #include "chrome/common/extensions/extension_resource.h" 18 #include "chrome/common/extensions/extension_resource.h"
19 #include "content/common/notification_observer.h" 19 #include "content/common/notification_observer.h"
20 #include "content/common/notification_registrar.h" 20 #include "content/common/notification_registrar.h"
21 #include "googleurl/src/gurl.h" 21 #include "googleurl/src/gurl.h"
22 22
23 class DictionaryValue;
24 class Extension; 23 class Extension;
25 class ExtensionService; 24 class ExtensionService;
26 class FilePath; 25 class FilePath;
27 class ListValue;
28 class PrefService; 26 class PrefService;
29 class RenderProcessHost; 27 class RenderProcessHost;
30 class UserScript; 28 class UserScript;
31 29
30 namespace base {
31 class DictionaryValue;
32 class ListValue;
33 }
34
32 // Information about a page running in an extension, for example a toolstrip, 35 // Information about a page running in an extension, for example a toolstrip,
33 // a background page, or a tab contents. 36 // a background page, or a tab contents.
34 struct ExtensionPage { 37 struct ExtensionPage {
35 ExtensionPage(const GURL& url, int render_process_id, int render_view_id, 38 ExtensionPage(const GURL& url, int render_process_id, int render_view_id,
36 bool incognito) 39 bool incognito)
37 : url(url), 40 : url(url),
38 render_process_id(render_process_id), 41 render_process_id(render_process_id),
39 render_view_id(render_view_id), 42 render_view_id(render_view_id),
40 incognito(incognito) {} 43 incognito(incognito) {}
41 GURL url; 44 GURL url;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 // work for them. 80 // work for them.
78 // 2. We want to desaturate the icons of the disabled extensions to make them 81 // 2. We want to desaturate the icons of the disabled extensions to make them
79 // look disabled. 82 // look disabled.
80 class IconLoader : public base::RefCountedThreadSafe<IconLoader> { 83 class IconLoader : public base::RefCountedThreadSafe<IconLoader> {
81 public: 84 public:
82 explicit IconLoader(ExtensionsDOMHandler* handler); 85 explicit IconLoader(ExtensionsDOMHandler* handler);
83 86
84 // Load |icons|. Will call handler->OnIconsLoaded when complete. IconLoader 87 // Load |icons|. Will call handler->OnIconsLoaded when complete. IconLoader
85 // takes ownership of both arguments. 88 // takes ownership of both arguments.
86 void LoadIcons(std::vector<ExtensionResource>* icons, 89 void LoadIcons(std::vector<ExtensionResource>* icons,
87 DictionaryValue* json); 90 base::DictionaryValue* json);
88 91
89 // Cancel the load. IconLoader won't try to call back to the handler after 92 // Cancel the load. IconLoader won't try to call back to the handler after
90 // this. 93 // this.
91 void Cancel(); 94 void Cancel();
92 95
93 private: 96 private:
94 // Load the icons and call ReportResultOnUIThread when done. This method 97 // Load the icons and call ReportResultOnUIThread when done. This method
95 // takes ownership of both arguments. 98 // takes ownership of both arguments.
96 void LoadIconsOnFileThread(std::vector<ExtensionResource>* icons, 99 void LoadIconsOnFileThread(std::vector<ExtensionResource>* icons,
97 DictionaryValue* json); 100 base::DictionaryValue* json);
98 101
99 // Report back to the handler. This method takes ownership of |json|. 102 // Report back to the handler. This method takes ownership of |json|.
100 void ReportResultOnUIThread(DictionaryValue* json); 103 void ReportResultOnUIThread(base::DictionaryValue* json);
101 104
102 // The handler we will report back to. 105 // The handler we will report back to.
103 ExtensionsDOMHandler* handler_; 106 ExtensionsDOMHandler* handler_;
104 }; 107 };
105 108
106 explicit ExtensionsDOMHandler(ExtensionService* extension_service); 109 explicit ExtensionsDOMHandler(ExtensionService* extension_service);
107 virtual ~ExtensionsDOMHandler(); 110 virtual ~ExtensionsDOMHandler();
108 111
109 // WebUIMessageHandler implementation. 112 // WebUIMessageHandler implementation.
110 virtual void RegisterMessages(); 113 virtual void RegisterMessages();
111 114
112 // Extension Detail JSON Struct for page. (static for ease of testing). 115 // Extension Detail JSON Struct for page. (static for ease of testing).
113 // Note: service can be NULL in unit tests. 116 // Note: service can be NULL in unit tests.
114 static DictionaryValue* CreateExtensionDetailValue( 117 static base::DictionaryValue* CreateExtensionDetailValue(
115 ExtensionService* service, 118 ExtensionService* service,
116 const Extension* extension, 119 const Extension* extension,
117 const std::vector<ExtensionPage>& pages, 120 const std::vector<ExtensionPage>& pages,
118 bool enabled, 121 bool enabled,
119 bool terminated); 122 bool terminated);
120 123
121 // ContentScript JSON Struct for page. (static for ease of testing). 124 // ContentScript JSON Struct for page. (static for ease of testing).
122 static DictionaryValue* CreateContentScriptDetailValue( 125 static base::DictionaryValue* CreateContentScriptDetailValue(
123 const UserScript& script, 126 const UserScript& script,
124 const FilePath& extension_path); 127 const FilePath& extension_path);
125 128
126 // ExtensionPackJob::Client 129 // ExtensionPackJob::Client
127 virtual void OnPackSuccess(const FilePath& crx_file, 130 virtual void OnPackSuccess(const FilePath& crx_file,
128 const FilePath& key_file); 131 const FilePath& key_file);
129 132
130 virtual void OnPackFailure(const std::string& error); 133 virtual void OnPackFailure(const std::string& error);
131 134
132 // ExtensionUninstallDialog::Delegate: 135 // ExtensionUninstallDialog::Delegate:
133 virtual void ExtensionDialogAccepted(); 136 virtual void ExtensionDialogAccepted();
134 virtual void ExtensionDialogCanceled(); 137 virtual void ExtensionDialogCanceled();
135 138
136 private: 139 private:
137 // Callback for "requestExtensionsData" message. 140 // Callback for "requestExtensionsData" message.
138 void HandleRequestExtensionsData(const ListValue* args); 141 void HandleRequestExtensionsData(const base::ListValue* args);
139 142
140 // Callback for "toggleDeveloperMode" message. 143 // Callback for "toggleDeveloperMode" message.
141 void HandleToggleDeveloperMode(const ListValue* args); 144 void HandleToggleDeveloperMode(const base::ListValue* args);
142 145
143 // Callback for "inspect" message. 146 // Callback for "inspect" message.
144 void HandleInspectMessage(const ListValue* args); 147 void HandleInspectMessage(const base::ListValue* args);
145 148
146 // Callback for "reload" message. 149 // Callback for "reload" message.
147 void HandleReloadMessage(const ListValue* args); 150 void HandleReloadMessage(const base::ListValue* args);
148 151
149 // Callback for "enable" message. 152 // Callback for "enable" message.
150 void HandleEnableMessage(const ListValue* args); 153 void HandleEnableMessage(const base::ListValue* args);
151 154
152 // Callback for "enableIncognito" message. 155 // Callback for "enableIncognito" message.
153 void HandleEnableIncognitoMessage(const ListValue* args); 156 void HandleEnableIncognitoMessage(const base::ListValue* args);
154 157
155 // Callback for "allowFileAcces" message. 158 // Callback for "allowFileAcces" message.
156 void HandleAllowFileAccessMessage(const ListValue* args); 159 void HandleAllowFileAccessMessage(const base::ListValue* args);
157 160
158 // Callback for "uninstall" message. 161 // Callback for "uninstall" message.
159 void HandleUninstallMessage(const ListValue* args); 162 void HandleUninstallMessage(const base::ListValue* args);
160 163
161 // Callback for "options" message. 164 // Callback for "options" message.
162 void HandleOptionsMessage(const ListValue* args); 165 void HandleOptionsMessage(const base::ListValue* args);
163 166
164 // Callback for "showButton" message. 167 // Callback for "showButton" message.
165 void HandleShowButtonMessage(const ListValue* args); 168 void HandleShowButtonMessage(const base::ListValue* args);
166 169
167 // Callback for "load" message. 170 // Callback for "load" message.
168 void HandleLoadMessage(const ListValue* args); 171 void HandleLoadMessage(const base::ListValue* args);
169 172
170 // Callback for "pack" message. 173 // Callback for "pack" message.
171 void HandlePackMessage(const ListValue* args); 174 void HandlePackMessage(const base::ListValue* args);
172 175
173 // Callback for "autoupdate" message. 176 // Callback for "autoupdate" message.
174 void HandleAutoUpdateMessage(const ListValue* args); 177 void HandleAutoUpdateMessage(const base::ListValue* args);
175 178
176 // Utility for calling javascript window.alert in the page. 179 // Utility for calling javascript window.alert in the page.
177 void ShowAlert(const std::string& message); 180 void ShowAlert(const std::string& message);
178 181
179 // Callback for "selectFilePath" message. 182 // Callback for "selectFilePath" message.
180 void HandleSelectFilePathMessage(const ListValue* args); 183 void HandleSelectFilePathMessage(const base::ListValue* args);
181 184
182 // Utility for callbacks that get an extension ID as the sole argument. 185 // Utility for callbacks that get an extension ID as the sole argument.
183 const Extension* GetExtension(const ListValue* args); 186 const Extension* GetExtension(const base::ListValue* args);
184 187
185 // Forces a UI update if appropriate after a notification is received. 188 // Forces a UI update if appropriate after a notification is received.
186 void MaybeUpdateAfterNotification(); 189 void MaybeUpdateAfterNotification();
187 190
188 // SelectFileDialog::Listener 191 // SelectFileDialog::Listener
189 virtual void FileSelected(const FilePath& path, 192 virtual void FileSelected(const FilePath& path,
190 int index, void* params); 193 int index, void* params);
191 virtual void MultiFilesSelected( 194 virtual void MultiFilesSelected(
192 const std::vector<FilePath>& files, void* params); 195 const std::vector<FilePath>& files, void* params);
193 virtual void FileSelectionCanceled(void* params) {} 196 virtual void FileSelectionCanceled(void* params) {}
(...skipping 12 matching lines...) Expand all
206 std::vector<ExtensionPage> *result); 209 std::vector<ExtensionPage> *result);
207 210
208 // Returns the best icon to display in the UI for an extension, or an empty 211 // Returns the best icon to display in the UI for an extension, or an empty
209 // ExtensionResource if no good icon exists. 212 // ExtensionResource if no good icon exists.
210 ExtensionResource PickExtensionIcon(const Extension* extension); 213 ExtensionResource PickExtensionIcon(const Extension* extension);
211 214
212 // Loads the extension resources into the json data, then calls OnIconsLoaded. 215 // Loads the extension resources into the json data, then calls OnIconsLoaded.
213 // Takes ownership of |icons|. 216 // Takes ownership of |icons|.
214 // Called on the file thread. 217 // Called on the file thread.
215 void LoadExtensionIcons(std::vector<ExtensionResource>* icons, 218 void LoadExtensionIcons(std::vector<ExtensionResource>* icons,
216 DictionaryValue* json_data); 219 base::DictionaryValue* json_data);
217 220
218 // Takes ownership of |json_data| and tells HTML about it. 221 // Takes ownership of |json_data| and tells HTML about it.
219 // Called on the UI thread. 222 // Called on the UI thread.
220 void OnIconsLoaded(DictionaryValue* json_data); 223 void OnIconsLoaded(base::DictionaryValue* json_data);
221 224
222 // Returns the ExtensionUninstallDialog object for this class, creating it if 225 // Returns the ExtensionUninstallDialog object for this class, creating it if
223 // needed. 226 // needed.
224 ExtensionUninstallDialog* GetExtensionUninstallDialog(); 227 ExtensionUninstallDialog* GetExtensionUninstallDialog();
225 228
226 // Our model. Outlives us since it's owned by our containing profile. 229 // Our model. Outlives us since it's owned by our containing profile.
227 ExtensionService* const extension_service_; 230 ExtensionService* const extension_service_;
228 231
229 // Used to pick the directory when loading an extension. 232 // Used to pick the directory when loading an extension.
230 scoped_refptr<SelectFileDialog> load_extension_dialog_; 233 scoped_refptr<SelectFileDialog> load_extension_dialog_;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 269
267 static RefCountedMemory* GetFaviconResourceBytes(); 270 static RefCountedMemory* GetFaviconResourceBytes();
268 271
269 static void RegisterUserPrefs(PrefService* prefs); 272 static void RegisterUserPrefs(PrefService* prefs);
270 273
271 private: 274 private:
272 DISALLOW_COPY_AND_ASSIGN(ExtensionsUI); 275 DISALLOW_COPY_AND_ASSIGN(ExtensionsUI);
273 }; 276 };
274 277
275 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_EXTENSION_SETTINGS_HANDLER_H_ 278 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_EXTENSION_SETTINGS_HANDLER_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/options/cookies_view_handler.h ('k') | chrome/browser/ui/webui/options/font_settings_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698