OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_EXTENSIONS_EXTENSION_SETTINGS_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_EXTENSIONS_EXTENSION_SETTINGS_HANDLER_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_EXTENSIONS_EXTENSION_SETTINGS_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_EXTENSIONS_EXTENSION_SETTINGS_HANDLER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "chrome/browser/extensions/extension_install_ui.h" | 14 #include "chrome/browser/extensions/extension_install_ui.h" |
15 #include "chrome/browser/extensions/extension_uninstall_dialog.h" | 15 #include "chrome/browser/extensions/extension_uninstall_dialog.h" |
16 #include "chrome/browser/extensions/extension_warning_set.h" | 16 #include "chrome/browser/extensions/extension_warning_set.h" |
17 #include "chrome/browser/prefs/pref_change_registrar.h" | 17 #include "chrome/browser/prefs/pref_change_registrar.h" |
18 #include "chrome/browser/ui/select_file_dialog.h" | 18 #include "chrome/browser/ui/select_file_dialog.h" |
19 #include "chrome/common/extensions/extension_resource.h" | 19 #include "chrome/common/extensions/extension_resource.h" |
20 #include "content/public/browser/navigation_controller.h" | 20 #include "content/public/browser/navigation_controller.h" |
21 #include "content/public/browser/notification_observer.h" | 21 #include "content/public/browser/notification_observer.h" |
22 #include "content/public/browser/notification_registrar.h" | 22 #include "content/public/browser/notification_registrar.h" |
23 #include "content/public/browser/render_view_host.h" | 23 #include "content/public/browser/render_view_host.h" |
24 #include "content/public/browser/web_contents_observer.h" | 24 #include "content/public/browser/web_contents_observer.h" |
25 #include "content/public/browser/web_ui_message_handler.h" | 25 #include "content/public/browser/web_ui_message_handler.h" |
26 #include "googleurl/src/gurl.h" | 26 #include "googleurl/src/gurl.h" |
27 | 27 |
28 class Extension; | |
29 class ExtensionHost; | 28 class ExtensionHost; |
30 class ExtensionService; | 29 class ExtensionService; |
31 class FilePath; | 30 class FilePath; |
32 class PrefService; | 31 class PrefService; |
33 | 32 |
34 namespace base { | 33 namespace base { |
35 class DictionaryValue; | 34 class DictionaryValue; |
36 class ListValue; | 35 class ListValue; |
37 } | 36 } |
38 | 37 |
| 38 namespace extensions { |
| 39 class Extension; |
| 40 } |
| 41 |
39 // Information about a page running in an extension, for example a popup bubble, | 42 // Information about a page running in an extension, for example a popup bubble, |
40 // a background page, or a tab contents. | 43 // a background page, or a tab contents. |
41 struct ExtensionPage { | 44 struct ExtensionPage { |
42 ExtensionPage(const GURL& url, int render_process_id, int render_view_id, | 45 ExtensionPage(const GURL& url, int render_process_id, int render_view_id, |
43 bool incognito) | 46 bool incognito) |
44 : url(url), | 47 : url(url), |
45 render_process_id(render_process_id), | 48 render_process_id(render_process_id), |
46 render_view_id(render_view_id), | 49 render_view_id(render_view_id), |
47 incognito(incognito) {} | 50 incognito(incognito) {} |
48 GURL url; | 51 GURL url; |
(...skipping 11 matching lines...) Expand all Loading... |
60 public: | 63 public: |
61 ExtensionSettingsHandler(); | 64 ExtensionSettingsHandler(); |
62 virtual ~ExtensionSettingsHandler(); | 65 virtual ~ExtensionSettingsHandler(); |
63 | 66 |
64 static void RegisterUserPrefs(PrefService* prefs); | 67 static void RegisterUserPrefs(PrefService* prefs); |
65 | 68 |
66 // Extension Detail JSON Struct for page. |pages| is injected for unit | 69 // Extension Detail JSON Struct for page. |pages| is injected for unit |
67 // testing. | 70 // testing. |
68 // Note: |warning_set| can be NULL in unit tests. | 71 // Note: |warning_set| can be NULL in unit tests. |
69 base::DictionaryValue* CreateExtensionDetailValue( | 72 base::DictionaryValue* CreateExtensionDetailValue( |
70 const Extension* extension, | 73 const extensions::Extension* extension, |
71 const std::vector<ExtensionPage>& pages, | 74 const std::vector<ExtensionPage>& pages, |
72 const ExtensionWarningSet* warning_set); | 75 const ExtensionWarningSet* warning_set); |
73 | 76 |
74 void GetLocalizedValues(base::DictionaryValue* localized_strings); | 77 void GetLocalizedValues(base::DictionaryValue* localized_strings); |
75 | 78 |
76 // content::WebContentsObserver implementation, which reloads all unpacked | 79 // content::WebContentsObserver implementation, which reloads all unpacked |
77 // extensions whenever chrome://extensions is reloaded. | 80 // extensions whenever chrome://extensions is reloaded. |
78 virtual void NavigateToPendingEntry( | 81 virtual void NavigateToPendingEntry( |
79 const GURL& url, | 82 const GURL& url, |
80 content::NavigationController::ReloadType reload_type) OVERRIDE; | 83 content::NavigationController::ReloadType reload_type) OVERRIDE; |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 void HandleAutoUpdateMessage(const base::ListValue* args); | 140 void HandleAutoUpdateMessage(const base::ListValue* args); |
138 | 141 |
139 // Callback for "loadUnpackedExtension" message. | 142 // Callback for "loadUnpackedExtension" message. |
140 void HandleLoadUnpackedExtensionMessage(const base::ListValue* args); | 143 void HandleLoadUnpackedExtensionMessage(const base::ListValue* args); |
141 | 144 |
142 // Utility for calling JavaScript window.alert in the page. | 145 // Utility for calling JavaScript window.alert in the page. |
143 void ShowAlert(const std::string& message); | 146 void ShowAlert(const std::string& message); |
144 | 147 |
145 // Utility for callbacks that get an extension ID as the sole argument. | 148 // Utility for callbacks that get an extension ID as the sole argument. |
146 // Returns NULL if the extension isn't active. | 149 // Returns NULL if the extension isn't active. |
147 const Extension* GetActiveExtension(const base::ListValue* args); | 150 const extensions::Extension* GetActiveExtension(const base::ListValue* args); |
148 | 151 |
149 // Forces a UI update if appropriate after a notification is received. | 152 // Forces a UI update if appropriate after a notification is received. |
150 void MaybeUpdateAfterNotification(); | 153 void MaybeUpdateAfterNotification(); |
151 | 154 |
152 // Register for notifications that we need to reload the page. | 155 // Register for notifications that we need to reload the page. |
153 void MaybeRegisterForNotifications(); | 156 void MaybeRegisterForNotifications(); |
154 | 157 |
155 // Helper that lists the current inspectable html pages for an extension. | 158 // Helper that lists the current inspectable html pages for an extension. |
156 std::vector<ExtensionPage> GetInspectablePagesForExtension( | 159 std::vector<ExtensionPage> GetInspectablePagesForExtension( |
157 const Extension* extension, bool extension_is_enabled); | 160 const extensions::Extension* extension, bool extension_is_enabled); |
158 void GetInspectablePagesForExtensionProcess( | 161 void GetInspectablePagesForExtensionProcess( |
159 const std::set<content::RenderViewHost*>& views, | 162 const std::set<content::RenderViewHost*>& views, |
160 std::vector<ExtensionPage> *result); | 163 std::vector<ExtensionPage> *result); |
161 | 164 |
162 // Returns the ExtensionUninstallDialog object for this class, creating it if | 165 // Returns the ExtensionUninstallDialog object for this class, creating it if |
163 // needed. | 166 // needed. |
164 ExtensionUninstallDialog* GetExtensionUninstallDialog(); | 167 ExtensionUninstallDialog* GetExtensionUninstallDialog(); |
165 | 168 |
166 // Helper to inspect an ExtensionHost after it has been loaded. | 169 // Helper to inspect an ExtensionHost after it has been loaded. |
167 void InspectExtensionHost(ExtensionHost* host); | 170 void InspectExtensionHost(ExtensionHost* host); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 bool registered_for_notifications_; | 205 bool registered_for_notifications_; |
203 | 206 |
204 content::NotificationRegistrar registrar_; | 207 content::NotificationRegistrar registrar_; |
205 | 208 |
206 PrefChangeRegistrar pref_registrar_; | 209 PrefChangeRegistrar pref_registrar_; |
207 | 210 |
208 DISALLOW_COPY_AND_ASSIGN(ExtensionSettingsHandler); | 211 DISALLOW_COPY_AND_ASSIGN(ExtensionSettingsHandler); |
209 }; | 212 }; |
210 | 213 |
211 #endif // CHROME_BROWSER_UI_WEBUI_EXTENSIONS_EXTENSION_SETTINGS_HANDLER_H_ | 214 #endif // CHROME_BROWSER_UI_WEBUI_EXTENSIONS_EXTENSION_SETTINGS_HANDLER_H_ |
OLD | NEW |