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

Side by Side Diff: chrome/browser/extensions/extensions_ui.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_EXTENSIONS_EXTENSIONS_UI_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSIONS_UI_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSIONS_UI_H_ 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSIONS_UI_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"
Aaron Boodman 2011/03/23 21:06:54 Is this header still needed?
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
71 explicit ExtensionsDOMHandler(ExtensionService* extension_service); 70 explicit ExtensionsDOMHandler(ExtensionService* extension_service);
72 virtual ~ExtensionsDOMHandler(); 71 virtual ~ExtensionsDOMHandler();
73 72
74 // WebUIMessageHandler implementation. 73 // WebUIMessageHandler implementation.
75 virtual void RegisterMessages(); 74 virtual void RegisterMessages();
76 75
77 // Extension Detail JSON Struct for page. (static for ease of testing). 76 // Extension Detail JSON Struct for page. (static for ease of testing).
78 // Note: service can be NULL in unit tests. 77 // Note: service can be NULL in unit tests.
79 static DictionaryValue* CreateExtensionDetailValue( 78 static DictionaryValue* CreateExtensionDetailValue(
80 ExtensionService* service, 79 ExtensionService* service,
81 const Extension* extension, 80 const Extension* extension,
82 const std::vector<ExtensionPage>& pages, 81 const std::vector<ExtensionPage>& pages,
83 bool enabled, 82 bool enabled,
84 bool terminated); 83 bool terminated);
85 84
86 // ContentScript JSON Struct for page. (static for ease of testing). 85 // ContentScript JSON Struct for page. (static for ease of testing).
87 static DictionaryValue* CreateContentScriptDetailValue( 86 static DictionaryValue* CreateContentScriptDetailValue(
88 const UserScript& script, 87 const UserScript& script,
89 const FilePath& extension_path); 88 const FilePath& extension_path);
90 89
91 // ExtensionPackJob::Client 90 // ExtensionPackJob::Client
92 virtual void OnPackSuccess(const FilePath& crx_file, 91 virtual void OnPackSuccess(const FilePath& crx_file,
93 const FilePath& key_file); 92 const FilePath& key_file);
94 93
95 virtual void OnPackFailure(const std::string& error); 94 virtual void OnPackFailure(const std::string& error);
96 95
97 // ExtensionInstallUI::Delegate implementation, used for receiving 96 // ExtensionGenericDialog::Delegate:
98 // notification about uninstall confirmation dialog selections. 97 virtual void ExtensionDialogAccepted();
99 virtual void InstallUIProceed(); 98 virtual void ExtensionDialogCanceled();
100 virtual void InstallUIAbort();
101 99
102 private: 100 private:
103 // Callback for "requestExtensionsData" message. 101 // Callback for "requestExtensionsData" message.
104 void HandleRequestExtensionsData(const ListValue* args); 102 void HandleRequestExtensionsData(const ListValue* args);
105 103
106 // Callback for "toggleDeveloperMode" message. 104 // Callback for "toggleDeveloperMode" message.
107 void HandleToggleDeveloperMode(const ListValue* args); 105 void HandleToggleDeveloperMode(const ListValue* args);
108 106
109 // Callback for "inspect" message. 107 // Callback for "inspect" message.
110 void HandleInspectMessage(const ListValue* args); 108 void HandleInspectMessage(const ListValue* args);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 const NotificationDetails& details); 165 const NotificationDetails& details);
168 166
169 // Helper that lists the current active html pages for an extension. 167 // Helper that lists the current active html pages for an extension.
170 std::vector<ExtensionPage> GetActivePagesForExtension( 168 std::vector<ExtensionPage> GetActivePagesForExtension(
171 const Extension* extension); 169 const Extension* extension);
172 void GetActivePagesForExtensionProcess( 170 void GetActivePagesForExtensionProcess(
173 RenderProcessHost* process, 171 RenderProcessHost* process,
174 const Extension* extension, 172 const Extension* extension,
175 std::vector<ExtensionPage> *result); 173 std::vector<ExtensionPage> *result);
176 174
177 // Returns the ExtensionInstallUI object for this class, creating it if 175 // Returns the ExtensionGenericDialog object for this class, creating it if
178 // needed. 176 // needed.
179 ExtensionInstallUI* GetExtensionInstallUI(); 177 ExtensionGenericDialog* GetExtensionGenericDialog();
180 178
181 // Our model. 179 // Our model.
182 scoped_refptr<ExtensionService> extensions_service_; 180 scoped_refptr<ExtensionService> extensions_service_;
183 181
184 // Used to pick the directory when loading an extension. 182 // Used to pick the directory when loading an extension.
185 scoped_refptr<SelectFileDialog> load_extension_dialog_; 183 scoped_refptr<SelectFileDialog> load_extension_dialog_;
186 184
187 // Used to package the extension. 185 // Used to package the extension.
188 scoped_refptr<PackExtensionJob> pack_job_; 186 scoped_refptr<PackExtensionJob> pack_job_;
189 187
190 // Used to show confirmation UI for uninstalling/enabling extensions in 188 // Used to show confirmation UI for uninstalling/enabling extensions in
191 // incognito mode. 189 // incognito mode.
192 scoped_ptr<ExtensionInstallUI> install_ui_; 190 scoped_ptr<ExtensionGenericDialog> extension_generic_dialog_;
193 191
194 // The id of the extension we are prompting the user about. 192 // The id of the extension we are prompting the user about.
195 std::string extension_id_prompting_; 193 std::string extension_id_prompting_;
196 194
197 // We monitor changes to the extension system so that we can reload when 195 // We monitor changes to the extension system so that we can reload when
198 // necessary. 196 // necessary.
199 NotificationRegistrar registrar_; 197 NotificationRegistrar registrar_;
200 198
201 // If true, we will ignore notifications in ::Observe(). This is needed 199 // If true, we will ignore notifications in ::Observe(). This is needed
202 // to prevent reloading the page when we were the cause of the 200 // to prevent reloading the page when we were the cause of the
(...skipping 16 matching lines...) Expand all
219 217
220 static RefCountedMemory* GetFaviconResourceBytes(); 218 static RefCountedMemory* GetFaviconResourceBytes();
221 219
222 static void RegisterUserPrefs(PrefService* prefs); 220 static void RegisterUserPrefs(PrefService* prefs);
223 221
224 private: 222 private:
225 DISALLOW_COPY_AND_ASSIGN(ExtensionsUI); 223 DISALLOW_COPY_AND_ASSIGN(ExtensionsUI);
226 }; 224 };
227 225
228 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSIONS_UI_H_ 226 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSIONS_UI_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698