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" | |
20 #include "chrome/browser/extensions/requirements_checker.h" | 19 #include "chrome/browser/extensions/requirements_checker.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/web_contents_observer.h" | 23 #include "content/public/browser/web_contents_observer.h" |
25 #include "content/public/browser/web_ui_message_handler.h" | 24 #include "content/public/browser/web_ui_message_handler.h" |
26 #include "extensions/browser/extension_prefs.h" | 25 #include "extensions/browser/extension_prefs.h" |
27 #include "extensions/browser/extension_prefs_observer.h" | 26 #include "extensions/browser/extension_prefs_observer.h" |
28 #include "extensions/browser/extension_registry_observer.h" | 27 #include "extensions/browser/extension_registry_observer.h" |
| 28 #include "extensions/browser/warning_service.h" |
29 #include "url/gurl.h" | 29 #include "url/gurl.h" |
30 | 30 |
31 class ExtensionService; | 31 class ExtensionService; |
32 | 32 |
33 namespace base { | 33 namespace base { |
34 class DictionaryValue; | 34 class DictionaryValue; |
35 class FilePath; | 35 class FilePath; |
36 class ListValue; | 36 class ListValue; |
37 } | 37 } |
38 | 38 |
(...skipping 28 matching lines...) Expand all Loading... |
67 // Extension Settings UI handler. | 67 // Extension Settings UI handler. |
68 class ExtensionSettingsHandler | 68 class ExtensionSettingsHandler |
69 : public content::WebUIMessageHandler, | 69 : public content::WebUIMessageHandler, |
70 public content::NotificationObserver, | 70 public content::NotificationObserver, |
71 public content::WebContentsObserver, | 71 public content::WebContentsObserver, |
72 public ErrorConsole::Observer, | 72 public ErrorConsole::Observer, |
73 public ExtensionInstallPrompt::Delegate, | 73 public ExtensionInstallPrompt::Delegate, |
74 public ExtensionPrefsObserver, | 74 public ExtensionPrefsObserver, |
75 public ExtensionRegistryObserver, | 75 public ExtensionRegistryObserver, |
76 public ExtensionUninstallDialog::Delegate, | 76 public ExtensionUninstallDialog::Delegate, |
77 public ExtensionWarningService::Observer, | 77 public WarningService::Observer, |
78 public base::SupportsWeakPtr<ExtensionSettingsHandler> { | 78 public base::SupportsWeakPtr<ExtensionSettingsHandler> { |
79 public: | 79 public: |
80 ExtensionSettingsHandler(); | 80 ExtensionSettingsHandler(); |
81 virtual ~ExtensionSettingsHandler(); | 81 virtual ~ExtensionSettingsHandler(); |
82 | 82 |
83 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); | 83 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); |
84 | 84 |
85 // Extension Detail JSON Struct for page. |pages| is injected for unit | 85 // Extension Detail JSON Struct for page. |pages| is injected for unit |
86 // testing. | 86 // testing. |
87 // Note: |warning_service| can be NULL in unit tests. | 87 // Note: |warning_service| can be NULL in unit tests. |
88 base::DictionaryValue* CreateExtensionDetailValue( | 88 base::DictionaryValue* CreateExtensionDetailValue( |
89 const Extension* extension, | 89 const Extension* extension, |
90 const std::vector<ExtensionPage>& pages, | 90 const std::vector<ExtensionPage>& pages, |
91 const ExtensionWarningService* warning_service); | 91 const WarningService* warning_service); |
92 | 92 |
93 void GetLocalizedValues(content::WebUIDataSource* source); | 93 void GetLocalizedValues(content::WebUIDataSource* source); |
94 | 94 |
95 private: | 95 private: |
96 friend class ExtensionUITest; | 96 friend class ExtensionUITest; |
97 friend class BrokerDelegate; | 97 friend class BrokerDelegate; |
98 | 98 |
99 // content::WebContentsObserver implementation. | 99 // content::WebContentsObserver implementation. |
100 virtual void RenderViewDeleted( | 100 virtual void RenderViewDeleted( |
101 content::RenderViewHost* render_view_host) OVERRIDE; | 101 content::RenderViewHost* render_view_host) OVERRIDE; |
(...skipping 30 matching lines...) Expand all Loading... |
132 | 132 |
133 // ExtensionPrefsObserver implementation. | 133 // ExtensionPrefsObserver implementation. |
134 virtual void OnExtensionDisableReasonsChanged(const std::string& extension_id, | 134 virtual void OnExtensionDisableReasonsChanged(const std::string& extension_id, |
135 int disable_reasons) OVERRIDE; | 135 int disable_reasons) OVERRIDE; |
136 | 136 |
137 // ExtensionUninstallDialog::Delegate implementation, used for receiving | 137 // ExtensionUninstallDialog::Delegate implementation, used for receiving |
138 // notification about uninstall confirmation dialog selections. | 138 // notification about uninstall confirmation dialog selections. |
139 virtual void ExtensionUninstallAccepted() OVERRIDE; | 139 virtual void ExtensionUninstallAccepted() OVERRIDE; |
140 virtual void ExtensionUninstallCanceled() OVERRIDE; | 140 virtual void ExtensionUninstallCanceled() OVERRIDE; |
141 | 141 |
142 // ExtensionWarningService::Observer implementation. | 142 // WarningService::Observer implementation. |
143 virtual void ExtensionWarningsChanged() OVERRIDE; | 143 virtual void ExtensionWarningsChanged() OVERRIDE; |
144 | 144 |
145 // ExtensionInstallPrompt::Delegate implementation. | 145 // ExtensionInstallPrompt::Delegate implementation. |
146 virtual void InstallUIProceed() OVERRIDE; | 146 virtual void InstallUIProceed() OVERRIDE; |
147 virtual void InstallUIAbort(bool user_initiated) OVERRIDE; | 147 virtual void InstallUIAbort(bool user_initiated) OVERRIDE; |
148 | 148 |
149 // Helper method that reloads all unpacked extensions. | 149 // Helper method that reloads all unpacked extensions. |
150 void ReloadUnpackedExtensions(); | 150 void ReloadUnpackedExtensions(); |
151 | 151 |
152 // Callback for "requestExtensionsData" message. | 152 // Callback for "requestExtensionsData" message. |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 PrefChangeRegistrar pref_registrar_; | 279 PrefChangeRegistrar pref_registrar_; |
280 | 280 |
281 // This will not be empty when a requirements check is in progress. Doing | 281 // This will not be empty when a requirements check is in progress. Doing |
282 // another Check() before the previous one is complete will cause the first | 282 // another Check() before the previous one is complete will cause the first |
283 // one to abort. | 283 // one to abort. |
284 scoped_ptr<RequirementsChecker> requirements_checker_; | 284 scoped_ptr<RequirementsChecker> requirements_checker_; |
285 | 285 |
286 // The UI for showing what permissions the extension has. | 286 // The UI for showing what permissions the extension has. |
287 scoped_ptr<ExtensionInstallPrompt> prompt_; | 287 scoped_ptr<ExtensionInstallPrompt> prompt_; |
288 | 288 |
289 ScopedObserver<ExtensionWarningService, ExtensionWarningService::Observer> | 289 ScopedObserver<WarningService, WarningService::Observer> |
290 warning_service_observer_; | 290 warning_service_observer_; |
291 | 291 |
292 // An observer to listen for when Extension errors are reported. | 292 // An observer to listen for when Extension errors are reported. |
293 ScopedObserver<ErrorConsole, ErrorConsole::Observer> error_console_observer_; | 293 ScopedObserver<ErrorConsole, ErrorConsole::Observer> error_console_observer_; |
294 | 294 |
295 // An observer to listen for notable changes in the ExtensionPrefs, like | 295 // An observer to listen for notable changes in the ExtensionPrefs, like |
296 // a change in Disable Reasons. | 296 // a change in Disable Reasons. |
297 ScopedObserver<ExtensionPrefs, ExtensionPrefsObserver> | 297 ScopedObserver<ExtensionPrefs, ExtensionPrefsObserver> |
298 extension_prefs_observer_; | 298 extension_prefs_observer_; |
299 | 299 |
300 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> | 300 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> |
301 extension_registry_observer_; | 301 extension_registry_observer_; |
302 | 302 |
303 // Whether we found any DISABLE_NOT_VERIFIED extensions and want to kick off | 303 // Whether we found any DISABLE_NOT_VERIFIED extensions and want to kick off |
304 // a verification check to try and rescue them. | 304 // a verification check to try and rescue them. |
305 bool should_do_verification_check_; | 305 bool should_do_verification_check_; |
306 | 306 |
307 DISALLOW_COPY_AND_ASSIGN(ExtensionSettingsHandler); | 307 DISALLOW_COPY_AND_ASSIGN(ExtensionSettingsHandler); |
308 }; | 308 }; |
309 | 309 |
310 } // namespace extensions | 310 } // namespace extensions |
311 | 311 |
312 #endif // CHROME_BROWSER_UI_WEBUI_EXTENSIONS_EXTENSION_SETTINGS_HANDLER_H_ | 312 #endif // CHROME_BROWSER_UI_WEBUI_EXTENSIONS_EXTENSION_SETTINGS_HANDLER_H_ |
OLD | NEW |