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 "ui/shell_dialogs/select_file_dialog.h" | 28 #include "ui/shell_dialogs/select_file_dialog.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 } |
(...skipping 26 matching lines...) Expand all Loading... |
63 }; | 64 }; |
64 | 65 |
65 // Extension Settings UI handler. | 66 // Extension Settings UI handler. |
66 class ExtensionSettingsHandler | 67 class ExtensionSettingsHandler |
67 : public content::WebUIMessageHandler, | 68 : public content::WebUIMessageHandler, |
68 public content::NotificationObserver, | 69 public content::NotificationObserver, |
69 public content::WebContentsObserver, | 70 public content::WebContentsObserver, |
70 public ui::SelectFileDialog::Listener, | 71 public ui::SelectFileDialog::Listener, |
71 public ErrorConsole::Observer, | 72 public ErrorConsole::Observer, |
72 public ExtensionInstallPrompt::Delegate, | 73 public ExtensionInstallPrompt::Delegate, |
73 public ExtensionPrefs::Observer, | 74 public ExtensionPrefsObserver, |
74 public ExtensionUninstallDialog::Delegate, | 75 public ExtensionUninstallDialog::Delegate, |
75 public ExtensionWarningService::Observer, | 76 public ExtensionWarningService::Observer, |
76 public base::SupportsWeakPtr<ExtensionSettingsHandler> { | 77 public base::SupportsWeakPtr<ExtensionSettingsHandler> { |
77 public: | 78 public: |
78 ExtensionSettingsHandler(); | 79 ExtensionSettingsHandler(); |
79 virtual ~ExtensionSettingsHandler(); | 80 virtual ~ExtensionSettingsHandler(); |
80 | 81 |
81 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); | 82 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); |
82 | 83 |
83 // Extension Detail JSON Struct for page. |pages| is injected for unit | 84 // Extension Detail JSON Struct for page. |pages| is injected for unit |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 virtual void FileSelectionCanceled(void* params) OVERRIDE; | 133 virtual void FileSelectionCanceled(void* params) OVERRIDE; |
133 | 134 |
134 // ErrorConsole::Observer implementation. | 135 // ErrorConsole::Observer implementation. |
135 virtual void OnErrorAdded(const ExtensionError* error) OVERRIDE; | 136 virtual void OnErrorAdded(const ExtensionError* error) OVERRIDE; |
136 | 137 |
137 // content::NotificationObserver implementation. | 138 // content::NotificationObserver implementation. |
138 virtual void Observe(int type, | 139 virtual void Observe(int type, |
139 const content::NotificationSource& source, | 140 const content::NotificationSource& source, |
140 const content::NotificationDetails& details) OVERRIDE; | 141 const content::NotificationDetails& details) OVERRIDE; |
141 | 142 |
142 // ExtensionPrefs::Observer implementation. | 143 // ExtensionPrefsObserver implementation. |
143 virtual void OnExtensionDisableReasonsChanged(const std::string& extension_id, | 144 virtual void OnExtensionDisableReasonsChanged(const std::string& extension_id, |
144 int disable_reasons) OVERRIDE; | 145 int disable_reasons) OVERRIDE; |
145 | 146 |
146 // ExtensionUninstallDialog::Delegate implementation, used for receiving | 147 // ExtensionUninstallDialog::Delegate implementation, used for receiving |
147 // notification about uninstall confirmation dialog selections. | 148 // notification about uninstall confirmation dialog selections. |
148 virtual void ExtensionUninstallAccepted() OVERRIDE; | 149 virtual void ExtensionUninstallAccepted() OVERRIDE; |
149 virtual void ExtensionUninstallCanceled() OVERRIDE; | 150 virtual void ExtensionUninstallCanceled() OVERRIDE; |
150 | 151 |
151 // ExtensionWarningService::Observer implementation. | 152 // ExtensionWarningService::Observer implementation. |
152 virtual void ExtensionWarningsChanged() OVERRIDE; | 153 virtual void ExtensionWarningsChanged() OVERRIDE; |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 scoped_ptr<ExtensionInstallPrompt> prompt_; | 299 scoped_ptr<ExtensionInstallPrompt> prompt_; |
299 | 300 |
300 ScopedObserver<ExtensionWarningService, ExtensionWarningService::Observer> | 301 ScopedObserver<ExtensionWarningService, ExtensionWarningService::Observer> |
301 warning_service_observer_; | 302 warning_service_observer_; |
302 | 303 |
303 // An observer to listen for when Extension errors are reported. | 304 // An observer to listen for when Extension errors are reported. |
304 ScopedObserver<ErrorConsole, ErrorConsole::Observer> error_console_observer_; | 305 ScopedObserver<ErrorConsole, ErrorConsole::Observer> error_console_observer_; |
305 | 306 |
306 // An observer to listen for notable changes in the ExtensionPrefs, like | 307 // An observer to listen for notable changes in the ExtensionPrefs, like |
307 // a change in Disable Reasons. | 308 // a change in Disable Reasons. |
308 ScopedObserver<ExtensionPrefs, ExtensionPrefs::Observer> | 309 ScopedObserver<ExtensionPrefs, ExtensionPrefsObserver> |
309 extension_prefs_observer_; | 310 extension_prefs_observer_; |
310 | 311 |
311 // Whether we found any DISABLE_NOT_VERIFIED extensions and want to kick off | 312 // Whether we found any DISABLE_NOT_VERIFIED extensions and want to kick off |
312 // a verification check to try and rescue them. | 313 // a verification check to try and rescue them. |
313 bool should_do_verification_check_; | 314 bool should_do_verification_check_; |
314 | 315 |
315 DISALLOW_COPY_AND_ASSIGN(ExtensionSettingsHandler); | 316 DISALLOW_COPY_AND_ASSIGN(ExtensionSettingsHandler); |
316 }; | 317 }; |
317 | 318 |
318 } // namespace extensions | 319 } // namespace extensions |
319 | 320 |
320 #endif // CHROME_BROWSER_UI_WEBUI_EXTENSIONS_EXTENSION_SETTINGS_HANDLER_H_ | 321 #endif // CHROME_BROWSER_UI_WEBUI_EXTENSIONS_EXTENSION_SETTINGS_HANDLER_H_ |
OLD | NEW |