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 | 7 |
8 #include <set> | 8 #include <set> |
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 "base/prefs/public/pref_change_registrar.h" | 13 #include "base/prefs/public/pref_change_registrar.h" |
14 #include "base/scoped_observer.h" | 14 #include "base/scoped_observer.h" |
15 #include "chrome/browser/extensions/extension_install_prompt.h" | |
16 #include "chrome/browser/extensions/extension_install_ui.h" | 15 #include "chrome/browser/extensions/extension_install_ui.h" |
17 #include "chrome/browser/extensions/extension_uninstall_dialog.h" | 16 #include "chrome/browser/extensions/extension_uninstall_dialog.h" |
18 #include "chrome/browser/extensions/extension_warning_service.h" | 17 #include "chrome/browser/extensions/extension_warning_service.h" |
19 #include "chrome/browser/extensions/requirements_checker.h" | 18 #include "chrome/browser/extensions/requirements_checker.h" |
20 #include "chrome/common/extensions/extension_resource.h" | 19 #include "chrome/common/extensions/extension_resource.h" |
21 #include "content/public/browser/navigation_controller.h" | 20 #include "content/public/browser/navigation_controller.h" |
22 #include "content/public/browser/notification_observer.h" | 21 #include "content/public/browser/notification_observer.h" |
23 #include "content/public/browser/notification_registrar.h" | 22 #include "content/public/browser/notification_registrar.h" |
24 #include "content/public/browser/render_view_host.h" | 23 #include "content/public/browser/render_view_host.h" |
25 #include "content/public/browser/web_contents_observer.h" | 24 #include "content/public/browser/web_contents_observer.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 int render_view_id; | 59 int render_view_id; |
61 bool incognito; | 60 bool incognito; |
62 }; | 61 }; |
63 | 62 |
64 // Extension Settings UI handler. | 63 // Extension Settings UI handler. |
65 class ExtensionSettingsHandler | 64 class ExtensionSettingsHandler |
66 : public content::WebUIMessageHandler, | 65 : public content::WebUIMessageHandler, |
67 public content::NotificationObserver, | 66 public content::NotificationObserver, |
68 public content::WebContentsObserver, | 67 public content::WebContentsObserver, |
69 public ui::SelectFileDialog::Listener, | 68 public ui::SelectFileDialog::Listener, |
70 public ExtensionInstallPrompt::Delegate, | |
71 public ExtensionUninstallDialog::Delegate, | 69 public ExtensionUninstallDialog::Delegate, |
72 public extensions::ExtensionWarningService::Observer, | 70 public extensions::ExtensionWarningService::Observer, |
73 public base::SupportsWeakPtr<ExtensionSettingsHandler> { | 71 public base::SupportsWeakPtr<ExtensionSettingsHandler> { |
74 public: | 72 public: |
75 ExtensionSettingsHandler(); | 73 ExtensionSettingsHandler(); |
76 virtual ~ExtensionSettingsHandler(); | 74 virtual ~ExtensionSettingsHandler(); |
77 | 75 |
78 static void RegisterUserPrefs(PrefRegistrySyncable* registry); | 76 static void RegisterUserPrefs(PrefRegistrySyncable* registry); |
79 | 77 |
80 // Extension Detail JSON Struct for page. |pages| is injected for unit | 78 // Extension Detail JSON Struct for page. |pages| is injected for unit |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 const content::NotificationDetails& details) OVERRIDE; | 114 const content::NotificationDetails& details) OVERRIDE; |
117 | 115 |
118 // ExtensionUninstallDialog::Delegate implementation, used for receiving | 116 // ExtensionUninstallDialog::Delegate implementation, used for receiving |
119 // notification about uninstall confirmation dialog selections. | 117 // notification about uninstall confirmation dialog selections. |
120 virtual void ExtensionUninstallAccepted() OVERRIDE; | 118 virtual void ExtensionUninstallAccepted() OVERRIDE; |
121 virtual void ExtensionUninstallCanceled() OVERRIDE; | 119 virtual void ExtensionUninstallCanceled() OVERRIDE; |
122 | 120 |
123 // extensions::ExtensionWarningService::Observer implementation. | 121 // extensions::ExtensionWarningService::Observer implementation. |
124 virtual void ExtensionWarningsChanged() OVERRIDE; | 122 virtual void ExtensionWarningsChanged() OVERRIDE; |
125 | 123 |
126 // ExtensionInstallPrompt::Delegate implementation. | |
127 virtual void InstallUIProceed() OVERRIDE; | |
128 virtual void InstallUIAbort(bool user_initiated) OVERRIDE; | |
129 | |
130 // Helper method that reloads all unpacked extensions. | 124 // Helper method that reloads all unpacked extensions. |
131 void ReloadUnpackedExtensions(); | 125 void ReloadUnpackedExtensions(); |
132 | 126 |
133 // Callback for "requestExtensionsData" message. | 127 // Callback for "requestExtensionsData" message. |
134 void HandleRequestExtensionsData(const base::ListValue* args); | 128 void HandleRequestExtensionsData(const base::ListValue* args); |
135 | 129 |
136 // Callback for "toggleDeveloperMode" message. | 130 // Callback for "toggleDeveloperMode" message. |
137 void HandleToggleDeveloperMode(const base::ListValue* args); | 131 void HandleToggleDeveloperMode(const base::ListValue* args); |
138 | 132 |
139 // Callback for "inspect" message. | 133 // Callback for "inspect" message. |
(...skipping 16 matching lines...) Expand all Loading... |
156 | 150 |
157 // Callback for "allowFileAcces" message. | 151 // Callback for "allowFileAcces" message. |
158 void HandleAllowFileAccessMessage(const base::ListValue* args); | 152 void HandleAllowFileAccessMessage(const base::ListValue* args); |
159 | 153 |
160 // Callback for "uninstall" message. | 154 // Callback for "uninstall" message. |
161 void HandleUninstallMessage(const base::ListValue* args); | 155 void HandleUninstallMessage(const base::ListValue* args); |
162 | 156 |
163 // Callback for "options" message. | 157 // Callback for "options" message. |
164 void HandleOptionsMessage(const base::ListValue* args); | 158 void HandleOptionsMessage(const base::ListValue* args); |
165 | 159 |
166 // Callback for "permissions" message. | |
167 void HandlePermissionsMessage(const base::ListValue* args); | |
168 | |
169 // Callback for "showButton" message. | 160 // Callback for "showButton" message. |
170 void HandleShowButtonMessage(const base::ListValue* args); | 161 void HandleShowButtonMessage(const base::ListValue* args); |
171 | 162 |
172 // Callback for "autoupdate" message. | 163 // Callback for "autoupdate" message. |
173 void HandleAutoUpdateMessage(const base::ListValue* args); | 164 void HandleAutoUpdateMessage(const base::ListValue* args); |
174 | 165 |
175 // Callback for "loadUnpackedExtension" message. | 166 // Callback for "loadUnpackedExtension" message. |
176 void HandleLoadUnpackedExtensionMessage(const base::ListValue* args); | 167 void HandleLoadUnpackedExtensionMessage(const base::ListValue* args); |
177 | 168 |
178 // Utility for calling JavaScript window.alert in the page. | 169 // Utility for calling JavaScript window.alert in the page. |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 | 237 |
247 content::NotificationRegistrar registrar_; | 238 content::NotificationRegistrar registrar_; |
248 | 239 |
249 PrefChangeRegistrar pref_registrar_; | 240 PrefChangeRegistrar pref_registrar_; |
250 | 241 |
251 // This will not be empty when a requirements check is in progress. Doing | 242 // This will not be empty when a requirements check is in progress. Doing |
252 // another Check() before the previous one is complete will cause the first | 243 // another Check() before the previous one is complete will cause the first |
253 // one to abort. | 244 // one to abort. |
254 scoped_ptr<extensions::RequirementsChecker> requirements_checker_; | 245 scoped_ptr<extensions::RequirementsChecker> requirements_checker_; |
255 | 246 |
256 // The UI for showing what permissions the extension has. | |
257 scoped_ptr<ExtensionInstallPrompt> prompt_; | |
258 | |
259 ScopedObserver<extensions::ExtensionWarningService, | 247 ScopedObserver<extensions::ExtensionWarningService, |
260 extensions::ExtensionWarningService::Observer> | 248 extensions::ExtensionWarningService::Observer> |
261 warning_service_observer_; | 249 warning_service_observer_; |
262 | 250 |
263 DISALLOW_COPY_AND_ASSIGN(ExtensionSettingsHandler); | 251 DISALLOW_COPY_AND_ASSIGN(ExtensionSettingsHandler); |
264 }; | 252 }; |
265 | 253 |
266 #endif // CHROME_BROWSER_UI_WEBUI_EXTENSIONS_EXTENSION_SETTINGS_HANDLER_H_ | 254 #endif // CHROME_BROWSER_UI_WEBUI_EXTENSIONS_EXTENSION_SETTINGS_HANDLER_H_ |
OLD | NEW |