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

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

Issue 6721013: extensions: Refactor ExtensionInstallUI class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove the file Created 9 years, 9 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/scoped_ptr.h" 12 #include "base/scoped_ptr.h"
13 #include "chrome/browser/extensions/extension_install_ui.h" 13 #include "chrome/browser/extensions/extension_install_ui.h"
14 #include "chrome/browser/extensions/extension_generic_dialog.h"
14 #include "chrome/browser/extensions/pack_extension_job.h" 15 #include "chrome/browser/extensions/pack_extension_job.h"
15 #include "chrome/browser/ui/shell_dialogs.h" 16 #include "chrome/browser/ui/shell_dialogs.h"
16 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" 17 #include "chrome/browser/ui/webui/chrome_url_data_manager.h"
17 #include "chrome/common/extensions/extension_resource.h" 18 #include "chrome/common/extensions/extension_resource.h"
18 #include "content/browser/webui/web_ui.h" 19 #include "content/browser/webui/web_ui.h"
19 #include "content/common/notification_observer.h" 20 #include "content/common/notification_observer.h"
20 #include "content/common/notification_registrar.h" 21 #include "content/common/notification_registrar.h"
21 #include "googleurl/src/gurl.h" 22 #include "googleurl/src/gurl.h"
22 23
23 class DictionaryValue; 24 class DictionaryValue;
(...skipping 29 matching lines...) Expand all
53 int request_id); 54 int request_id);
54 virtual std::string GetMimeType(const std::string&) const; 55 virtual std::string GetMimeType(const std::string&) const;
55 56
56 private: 57 private:
57 ~ExtensionsUIHTMLSource() {} 58 ~ExtensionsUIHTMLSource() {}
58 59
59 DISALLOW_COPY_AND_ASSIGN(ExtensionsUIHTMLSource); 60 DISALLOW_COPY_AND_ASSIGN(ExtensionsUIHTMLSource);
60 }; 61 };
61 62
62 // The handler for JavaScript messages related to the "extensions" view. 63 // The handler for JavaScript messages related to the "extensions" view.
63 class ExtensionsDOMHandler 64 class ExtensionsDOMHandler : public WebUIMessageHandler,
64 : public WebUIMessageHandler, 65 public NotificationObserver,
65 public NotificationObserver, 66 public PackExtensionJob::Client,
66 public PackExtensionJob::Client, 67 public SelectFileDialog::Listener,
67 public SelectFileDialog::Listener, 68 public ExtensionGenericDialog::Delegate {
68 public ExtensionInstallUI::Delegate {
69 public: 69 public:
70 70
71 // Helper class that loads the icons for the extensions in the management UI. 71 // Helper class that loads the icons for the extensions in the management UI.
72 // We do this with native code instead of just using chrome-extension:// URLs 72 // We do this with native code instead of just using chrome-extension:// URLs
73 // for two reasons: 73 // for two reasons:
74 // 74 //
75 // 1. We need to support the disabled extensions, too, and using URLs won't 75 // 1. We need to support the disabled extensions, too, and using URLs won't
76 // work for them. 76 // work for them.
77 // 2. We want to desaturate the icons of the disabled extensions to make them 77 // 2. We want to desaturate the icons of the disabled extensions to make them
78 // look disabled. 78 // look disabled.
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 static DictionaryValue* CreateContentScriptDetailValue( 121 static DictionaryValue* CreateContentScriptDetailValue(
122 const UserScript& script, 122 const UserScript& script,
123 const FilePath& extension_path); 123 const FilePath& extension_path);
124 124
125 // ExtensionPackJob::Client 125 // ExtensionPackJob::Client
126 virtual void OnPackSuccess(const FilePath& crx_file, 126 virtual void OnPackSuccess(const FilePath& crx_file,
127 const FilePath& key_file); 127 const FilePath& key_file);
128 128
129 virtual void OnPackFailure(const std::string& error); 129 virtual void OnPackFailure(const std::string& error);
130 130
131 // ExtensionInstallUI::Delegate implementation, used for receiving 131 // ExtensionGenericDialog::Delegate:
132 // notification about uninstall confirmation dialog selections. 132 virtual void ExtensionDialogAccepted();
133 virtual void InstallUIProceed(); 133 virtual void ExtensionDialogCanceled();
134 virtual void InstallUIAbort();
135 134
136 private: 135 private:
137 // Callback for "requestExtensionsData" message. 136 // Callback for "requestExtensionsData" message.
138 void HandleRequestExtensionsData(const ListValue* args); 137 void HandleRequestExtensionsData(const ListValue* args);
139 138
140 // Callback for "toggleDeveloperMode" message. 139 // Callback for "toggleDeveloperMode" message.
141 void HandleToggleDeveloperMode(const ListValue* args); 140 void HandleToggleDeveloperMode(const ListValue* args);
142 141
143 // Callback for "inspect" message. 142 // Callback for "inspect" message.
144 void HandleInspectMessage(const ListValue* args); 143 void HandleInspectMessage(const ListValue* args);
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 // Loads the extension resources into the json data, then calls OnIconsLoaded. 211 // Loads the extension resources into the json data, then calls OnIconsLoaded.
213 // Takes ownership of |icons|. 212 // Takes ownership of |icons|.
214 // Called on the file thread. 213 // Called on the file thread.
215 void LoadExtensionIcons(std::vector<ExtensionResource>* icons, 214 void LoadExtensionIcons(std::vector<ExtensionResource>* icons,
216 DictionaryValue* json_data); 215 DictionaryValue* json_data);
217 216
218 // Takes ownership of |json_data| and tells HTML about it. 217 // Takes ownership of |json_data| and tells HTML about it.
219 // Called on the UI thread. 218 // Called on the UI thread.
220 void OnIconsLoaded(DictionaryValue* json_data); 219 void OnIconsLoaded(DictionaryValue* json_data);
221 220
222 // Returns the ExtensionInstallUI object for this class, creating it if 221 // Returns the ExtensionGenericDialog object for this class, creating it if
223 // needed. 222 // needed.
224 ExtensionInstallUI* GetExtensionInstallUI(); 223 ExtensionGenericDialog* GetExtensionGenericDialog();
225 224
226 // Our model. 225 // Our model.
227 scoped_refptr<ExtensionService> extensions_service_; 226 scoped_refptr<ExtensionService> extensions_service_;
228 227
229 // Used to pick the directory when loading an extension. 228 // Used to pick the directory when loading an extension.
230 scoped_refptr<SelectFileDialog> load_extension_dialog_; 229 scoped_refptr<SelectFileDialog> load_extension_dialog_;
231 230
232 // Used to package the extension. 231 // Used to package the extension.
233 scoped_refptr<PackExtensionJob> pack_job_; 232 scoped_refptr<PackExtensionJob> pack_job_;
234 233
235 // Used to load icons asynchronously on the file thread. 234 // Used to load icons asynchronously on the file thread.
236 scoped_refptr<IconLoader> icon_loader_; 235 scoped_refptr<IconLoader> icon_loader_;
237 236
238 // Used to show confirmation UI for uninstalling/enabling extensions in 237 // Used to show confirmation UI for uninstalling/enabling extensions in
239 // incognito mode. 238 // incognito mode.
240 scoped_ptr<ExtensionInstallUI> install_ui_; 239 scoped_ptr<ExtensionGenericDialog> extension_generic_dialog_;
241 240
242 // The id of the extension we are prompting the user about. 241 // The id of the extension we are prompting the user about.
243 std::string extension_id_prompting_; 242 std::string extension_id_prompting_;
244 243
245 // We monitor changes to the extension system so that we can reload when 244 // We monitor changes to the extension system so that we can reload when
246 // necessary. 245 // necessary.
247 NotificationRegistrar registrar_; 246 NotificationRegistrar registrar_;
248 247
249 // If true, we will ignore notifications in ::Observe(). This is needed 248 // If true, we will ignore notifications in ::Observe(). This is needed
250 // to prevent reloading the page when we were the cause of the 249 // to prevent reloading the page when we were the cause of the
(...skipping 16 matching lines...) Expand all
267 266
268 static RefCountedMemory* GetFaviconResourceBytes(); 267 static RefCountedMemory* GetFaviconResourceBytes();
269 268
270 static void RegisterUserPrefs(PrefService* prefs); 269 static void RegisterUserPrefs(PrefService* prefs);
271 270
272 private: 271 private:
273 DISALLOW_COPY_AND_ASSIGN(ExtensionsUI); 272 DISALLOW_COPY_AND_ASSIGN(ExtensionsUI);
274 }; 273 };
275 274
276 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_EXTENSION_SETTINGS_HANDLER_H_ 275 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_EXTENSION_SETTINGS_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698