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