| 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/pref_change_registrar.h" | 13 #include "base/prefs/pref_change_registrar.h" |
| 14 #include "base/scoped_observer.h" | 14 #include "base/scoped_observer.h" |
| 15 #include "chrome/browser/extensions/error_console/error_console.h" | 15 #include "chrome/browser/extensions/error_console/error_console.h" |
| 16 #include "chrome/browser/extensions/extension_install_prompt.h" | 16 #include "chrome/browser/extensions/extension_install_prompt.h" |
| 17 #include "chrome/browser/extensions/extension_install_ui.h" | 17 #include "chrome/browser/extensions/extension_install_ui.h" |
| 18 #include "chrome/browser/extensions/extension_uninstall_dialog.h" | 18 #include "chrome/browser/extensions/extension_uninstall_dialog.h" |
| 19 #include "chrome/browser/extensions/extension_warning_service.h" | 19 #include "chrome/browser/extensions/extension_warning_service.h" |
| 20 #include "chrome/browser/extensions/requirements_checker.h" | 20 #include "chrome/browser/extensions/requirements_checker.h" |
| 21 #include "content/public/browser/navigation_controller.h" | 21 #include "content/public/browser/navigation_controller.h" |
| 22 #include "content/public/browser/notification_observer.h" | 22 #include "content/public/browser/notification_observer.h" |
| 23 #include "content/public/browser/notification_registrar.h" | 23 #include "content/public/browser/notification_registrar.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 "extensions/browser/extension_prefs.h" | 26 #include "extensions/browser/extension_prefs.h" |
| 27 #include "extensions/browser/extension_prefs_observer.h" | 27 #include "extensions/browser/extension_prefs_observer.h" |
| 28 #include "extensions/browser/extension_registry_observer.h" |
| 28 #include "url/gurl.h" | 29 #include "url/gurl.h" |
| 29 | 30 |
| 30 class ExtensionService; | 31 class ExtensionService; |
| 31 | 32 |
| 32 namespace base { | 33 namespace base { |
| 33 class DictionaryValue; | 34 class DictionaryValue; |
| 34 class FilePath; | 35 class FilePath; |
| 35 class ListValue; | 36 class ListValue; |
| 36 } | 37 } |
| 37 | 38 |
| 38 namespace content { | 39 namespace content { |
| 39 class WebUIDataSource; | 40 class WebUIDataSource; |
| 40 } | 41 } |
| 41 | 42 |
| 42 namespace user_prefs { | 43 namespace user_prefs { |
| 43 class PrefRegistrySyncable; | 44 class PrefRegistrySyncable; |
| 44 } | 45 } |
| 45 | 46 |
| 46 namespace extensions { | 47 namespace extensions { |
| 47 class Extension; | 48 class Extension; |
| 49 class ExtensionRegistry; |
| 48 class ManagementPolicy; | 50 class ManagementPolicy; |
| 49 | 51 |
| 50 // Information about a page running in an extension, for example a popup bubble, | 52 // Information about a page running in an extension, for example a popup bubble, |
| 51 // a background page, or a tab contents. | 53 // a background page, or a tab contents. |
| 52 struct ExtensionPage { | 54 struct ExtensionPage { |
| 53 ExtensionPage(const GURL& url, | 55 ExtensionPage(const GURL& url, |
| 54 int render_process_id, | 56 int render_process_id, |
| 55 int render_view_id, | 57 int render_view_id, |
| 56 bool incognito, | 58 bool incognito, |
| 57 bool generated_background_page); | 59 bool generated_background_page); |
| 58 GURL url; | 60 GURL url; |
| 59 int render_process_id; | 61 int render_process_id; |
| 60 int render_view_id; | 62 int render_view_id; |
| 61 bool incognito; | 63 bool incognito; |
| 62 bool generated_background_page; | 64 bool generated_background_page; |
| 63 }; | 65 }; |
| 64 | 66 |
| 65 // Extension Settings UI handler. | 67 // Extension Settings UI handler. |
| 66 class ExtensionSettingsHandler | 68 class ExtensionSettingsHandler |
| 67 : public content::WebUIMessageHandler, | 69 : public content::WebUIMessageHandler, |
| 68 public content::NotificationObserver, | 70 public content::NotificationObserver, |
| 69 public content::WebContentsObserver, | 71 public content::WebContentsObserver, |
| 70 public ErrorConsole::Observer, | 72 public ErrorConsole::Observer, |
| 71 public ExtensionInstallPrompt::Delegate, | 73 public ExtensionInstallPrompt::Delegate, |
| 72 public ExtensionPrefsObserver, | 74 public ExtensionPrefsObserver, |
| 75 public ExtensionRegistryObserver, |
| 73 public ExtensionUninstallDialog::Delegate, | 76 public ExtensionUninstallDialog::Delegate, |
| 74 public ExtensionWarningService::Observer, | 77 public ExtensionWarningService::Observer, |
| 75 public base::SupportsWeakPtr<ExtensionSettingsHandler> { | 78 public base::SupportsWeakPtr<ExtensionSettingsHandler> { |
| 76 public: | 79 public: |
| 77 ExtensionSettingsHandler(); | 80 ExtensionSettingsHandler(); |
| 78 virtual ~ExtensionSettingsHandler(); | 81 virtual ~ExtensionSettingsHandler(); |
| 79 | 82 |
| 80 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); | 83 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); |
| 81 | 84 |
| 82 // Extension Detail JSON Struct for page. |pages| is injected for unit | 85 // Extension Detail JSON Struct for page. |pages| is injected for unit |
| (...skipping 25 matching lines...) Expand all Loading... |
| 108 virtual void RegisterMessages() OVERRIDE; | 111 virtual void RegisterMessages() OVERRIDE; |
| 109 | 112 |
| 110 // ErrorConsole::Observer implementation. | 113 // ErrorConsole::Observer implementation. |
| 111 virtual void OnErrorAdded(const ExtensionError* error) OVERRIDE; | 114 virtual void OnErrorAdded(const ExtensionError* error) OVERRIDE; |
| 112 | 115 |
| 113 // content::NotificationObserver implementation. | 116 // content::NotificationObserver implementation. |
| 114 virtual void Observe(int type, | 117 virtual void Observe(int type, |
| 115 const content::NotificationSource& source, | 118 const content::NotificationSource& source, |
| 116 const content::NotificationDetails& details) OVERRIDE; | 119 const content::NotificationDetails& details) OVERRIDE; |
| 117 | 120 |
| 121 // ExtensionRegistryObserver implementation. |
| 122 virtual void OnExtensionLoaded(content::BrowserContext* browser_context, |
| 123 const Extension* extension) OVERRIDE; |
| 124 virtual void OnExtensionUnloaded( |
| 125 content::BrowserContext* browser_context, |
| 126 const Extension* extension, |
| 127 UnloadedExtensionInfo::Reason reason) OVERRIDE; |
| 128 virtual void OnExtensionUninstalled(content::BrowserContext* browser_context, |
| 129 const Extension* extension) OVERRIDE; |
| 130 |
| 118 // ExtensionPrefsObserver implementation. | 131 // ExtensionPrefsObserver implementation. |
| 119 virtual void OnExtensionDisableReasonsChanged(const std::string& extension_id, | 132 virtual void OnExtensionDisableReasonsChanged(const std::string& extension_id, |
| 120 int disable_reasons) OVERRIDE; | 133 int disable_reasons) OVERRIDE; |
| 121 | 134 |
| 122 // ExtensionUninstallDialog::Delegate implementation, used for receiving | 135 // ExtensionUninstallDialog::Delegate implementation, used for receiving |
| 123 // notification about uninstall confirmation dialog selections. | 136 // notification about uninstall confirmation dialog selections. |
| 124 virtual void ExtensionUninstallAccepted() OVERRIDE; | 137 virtual void ExtensionUninstallAccepted() OVERRIDE; |
| 125 virtual void ExtensionUninstallCanceled() OVERRIDE; | 138 virtual void ExtensionUninstallCanceled() OVERRIDE; |
| 126 | 139 |
| 127 // ExtensionWarningService::Observer implementation. | 140 // ExtensionWarningService::Observer implementation. |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 warning_service_observer_; | 285 warning_service_observer_; |
| 273 | 286 |
| 274 // An observer to listen for when Extension errors are reported. | 287 // An observer to listen for when Extension errors are reported. |
| 275 ScopedObserver<ErrorConsole, ErrorConsole::Observer> error_console_observer_; | 288 ScopedObserver<ErrorConsole, ErrorConsole::Observer> error_console_observer_; |
| 276 | 289 |
| 277 // An observer to listen for notable changes in the ExtensionPrefs, like | 290 // An observer to listen for notable changes in the ExtensionPrefs, like |
| 278 // a change in Disable Reasons. | 291 // a change in Disable Reasons. |
| 279 ScopedObserver<ExtensionPrefs, ExtensionPrefsObserver> | 292 ScopedObserver<ExtensionPrefs, ExtensionPrefsObserver> |
| 280 extension_prefs_observer_; | 293 extension_prefs_observer_; |
| 281 | 294 |
| 295 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> |
| 296 extension_registry_observer_; |
| 297 |
| 282 // Whether we found any DISABLE_NOT_VERIFIED extensions and want to kick off | 298 // Whether we found any DISABLE_NOT_VERIFIED extensions and want to kick off |
| 283 // a verification check to try and rescue them. | 299 // a verification check to try and rescue them. |
| 284 bool should_do_verification_check_; | 300 bool should_do_verification_check_; |
| 285 | 301 |
| 286 DISALLOW_COPY_AND_ASSIGN(ExtensionSettingsHandler); | 302 DISALLOW_COPY_AND_ASSIGN(ExtensionSettingsHandler); |
| 287 }; | 303 }; |
| 288 | 304 |
| 289 } // namespace extensions | 305 } // namespace extensions |
| 290 | 306 |
| 291 #endif // CHROME_BROWSER_UI_WEBUI_EXTENSIONS_EXTENSION_SETTINGS_HANDLER_H_ | 307 #endif // CHROME_BROWSER_UI_WEBUI_EXTENSIONS_EXTENSION_SETTINGS_HANDLER_H_ |
| OLD | NEW |