OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/dom_ui/chrome_url_data_manager.h" | 13 #include "chrome/browser/dom_ui/chrome_url_data_manager.h" |
14 #include "chrome/browser/dom_ui/dom_ui.h" | 14 #include "chrome/browser/dom_ui/dom_ui.h" |
15 #include "chrome/browser/extensions/extension_install_ui.h" | 15 #include "chrome/browser/extensions/extension_install_ui.h" |
16 #include "chrome/browser/extensions/pack_extension_job.h" | 16 #include "chrome/browser/extensions/pack_extension_job.h" |
17 #include "chrome/browser/shell_dialogs.h" | 17 #include "chrome/browser/shell_dialogs.h" |
18 #include "chrome/common/extensions/extension_resource.h" | 18 #include "chrome/common/extensions/extension_resource.h" |
19 #include "chrome/common/notification_observer.h" | 19 #include "chrome/common/notification_observer.h" |
20 #include "chrome/common/notification_registrar.h" | 20 #include "chrome/common/notification_registrar.h" |
21 #include "googleurl/src/gurl.h" | 21 #include "googleurl/src/gurl.h" |
22 | 22 |
23 class DictionaryValue; | 23 class DictionaryValue; |
24 class Extension; | 24 class Extension; |
25 class ExtensionsService; | 25 class ExtensionService; |
26 class FilePath; | 26 class FilePath; |
27 class ListValue; | 27 class ListValue; |
28 class PrefService; | 28 class PrefService; |
29 class RenderProcessHost; | 29 class RenderProcessHost; |
30 class UserScript; | 30 class UserScript; |
31 | 31 |
32 // Information about a page running in an extension, for example a toolstrip, | 32 // Information about a page running in an extension, for example a toolstrip, |
33 // a background page, or a tab contents. | 33 // a background page, or a tab contents. |
34 struct ExtensionPage { | 34 struct ExtensionPage { |
35 ExtensionPage(const GURL& url, int render_process_id, int render_view_id, | 35 ExtensionPage(const GURL& url, int render_process_id, int render_view_id, |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 void LoadIconsOnFileThread(std::vector<ExtensionResource>* icons, | 95 void LoadIconsOnFileThread(std::vector<ExtensionResource>* icons, |
96 DictionaryValue* json); | 96 DictionaryValue* json); |
97 | 97 |
98 // Report back to the handler. This method takes ownership of |json|. | 98 // Report back to the handler. This method takes ownership of |json|. |
99 void ReportResultOnUIThread(DictionaryValue* json); | 99 void ReportResultOnUIThread(DictionaryValue* json); |
100 | 100 |
101 // The handler we will report back to. | 101 // The handler we will report back to. |
102 ExtensionsDOMHandler* handler_; | 102 ExtensionsDOMHandler* handler_; |
103 }; | 103 }; |
104 | 104 |
105 explicit ExtensionsDOMHandler(ExtensionsService* extension_service); | 105 explicit ExtensionsDOMHandler(ExtensionService* extension_service); |
106 virtual ~ExtensionsDOMHandler(); | 106 virtual ~ExtensionsDOMHandler(); |
107 | 107 |
108 // DOMMessageHandler implementation. | 108 // DOMMessageHandler implementation. |
109 virtual void RegisterMessages(); | 109 virtual void RegisterMessages(); |
110 | 110 |
111 // Extension Detail JSON Struct for page. (static for ease of testing). | 111 // Extension Detail JSON Struct for page. (static for ease of testing). |
112 // Note: service can be NULL in unit tests. | 112 // Note: service can be NULL in unit tests. |
113 static DictionaryValue* CreateExtensionDetailValue( | 113 static DictionaryValue* CreateExtensionDetailValue( |
114 ExtensionsService* service, | 114 ExtensionService* service, |
115 const Extension* extension, | 115 const Extension* extension, |
116 const std::vector<ExtensionPage>& pages, | 116 const std::vector<ExtensionPage>& pages, |
117 bool enabled); | 117 bool enabled); |
118 | 118 |
119 // ContentScript JSON Struct for page. (static for ease of testing). | 119 // ContentScript JSON Struct for page. (static for ease of testing). |
120 static DictionaryValue* CreateContentScriptDetailValue( | 120 static DictionaryValue* CreateContentScriptDetailValue( |
121 const UserScript& script, | 121 const UserScript& script, |
122 const FilePath& extension_path); | 122 const FilePath& extension_path); |
123 | 123 |
124 // ExtensionPackJob::Client | 124 // ExtensionPackJob::Client |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 | 216 |
217 // Takes ownership of |json_data| and tells HTML about it. | 217 // Takes ownership of |json_data| and tells HTML about it. |
218 // Called on the UI thread. | 218 // Called on the UI thread. |
219 void OnIconsLoaded(DictionaryValue* json_data); | 219 void OnIconsLoaded(DictionaryValue* json_data); |
220 | 220 |
221 // Returns the ExtensionInstallUI object for this class, creating it if | 221 // Returns the ExtensionInstallUI object for this class, creating it if |
222 // needed. | 222 // needed. |
223 ExtensionInstallUI* GetExtensionInstallUI(); | 223 ExtensionInstallUI* GetExtensionInstallUI(); |
224 | 224 |
225 // Our model. | 225 // Our model. |
226 scoped_refptr<ExtensionsService> extensions_service_; | 226 scoped_refptr<ExtensionService> extensions_service_; |
227 | 227 |
228 // Used to pick the directory when loading an extension. | 228 // Used to pick the directory when loading an extension. |
229 scoped_refptr<SelectFileDialog> load_extension_dialog_; | 229 scoped_refptr<SelectFileDialog> load_extension_dialog_; |
230 | 230 |
231 // Used to package the extension. | 231 // Used to package the extension. |
232 scoped_refptr<PackExtensionJob> pack_job_; | 232 scoped_refptr<PackExtensionJob> pack_job_; |
233 | 233 |
234 // Used to load icons asynchronously on the file thread. | 234 // Used to load icons asynchronously on the file thread. |
235 scoped_refptr<IconLoader> icon_loader_; | 235 scoped_refptr<IconLoader> icon_loader_; |
236 | 236 |
(...skipping 29 matching lines...) Expand all Loading... |
266 | 266 |
267 static RefCountedMemory* GetFaviconResourceBytes(); | 267 static RefCountedMemory* GetFaviconResourceBytes(); |
268 | 268 |
269 static void RegisterUserPrefs(PrefService* prefs); | 269 static void RegisterUserPrefs(PrefService* prefs); |
270 | 270 |
271 private: | 271 private: |
272 DISALLOW_COPY_AND_ASSIGN(ExtensionsUI); | 272 DISALLOW_COPY_AND_ASSIGN(ExtensionsUI); |
273 }; | 273 }; |
274 | 274 |
275 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSIONS_UI_H_ | 275 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSIONS_UI_H_ |
OLD | NEW |