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/extension_install_prompt.h" | 16 #include "chrome/browser/extensions/extension_install_prompt.h" |
16 #include "chrome/browser/extensions/extension_install_ui.h" | 17 #include "chrome/browser/extensions/extension_install_ui.h" |
17 #include "chrome/browser/extensions/extension_uninstall_dialog.h" | 18 #include "chrome/browser/extensions/extension_uninstall_dialog.h" |
18 #include "chrome/browser/extensions/extension_warning_service.h" | 19 #include "chrome/browser/extensions/extension_warning_service.h" |
19 #include "chrome/browser/extensions/requirements_checker.h" | 20 #include "chrome/browser/extensions/requirements_checker.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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 bool incognito; | 61 bool incognito; |
61 bool generated_background_page; | 62 bool generated_background_page; |
62 }; | 63 }; |
63 | 64 |
64 // Extension Settings UI handler. | 65 // Extension Settings UI handler. |
65 class ExtensionSettingsHandler | 66 class ExtensionSettingsHandler |
66 : public content::WebUIMessageHandler, | 67 : public content::WebUIMessageHandler, |
67 public content::NotificationObserver, | 68 public content::NotificationObserver, |
68 public content::WebContentsObserver, | 69 public content::WebContentsObserver, |
69 public ui::SelectFileDialog::Listener, | 70 public ui::SelectFileDialog::Listener, |
| 71 public ErrorConsole::Observer, |
70 public ExtensionInstallPrompt::Delegate, | 72 public ExtensionInstallPrompt::Delegate, |
71 public ExtensionUninstallDialog::Delegate, | 73 public ExtensionUninstallDialog::Delegate, |
72 public ExtensionWarningService::Observer, | 74 public ExtensionWarningService::Observer, |
73 public base::SupportsWeakPtr<ExtensionSettingsHandler> { | 75 public base::SupportsWeakPtr<ExtensionSettingsHandler> { |
74 public: | 76 public: |
75 ExtensionSettingsHandler(); | 77 ExtensionSettingsHandler(); |
76 virtual ~ExtensionSettingsHandler(); | 78 virtual ~ExtensionSettingsHandler(); |
77 | 79 |
78 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); | 80 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); |
79 | 81 |
(...skipping 25 matching lines...) Expand all Loading... |
105 | 107 |
106 // WebUIMessageHandler implementation. | 108 // WebUIMessageHandler implementation. |
107 virtual void RegisterMessages() OVERRIDE; | 109 virtual void RegisterMessages() OVERRIDE; |
108 | 110 |
109 // SelectFileDialog::Listener implementation. | 111 // SelectFileDialog::Listener implementation. |
110 virtual void FileSelected(const base::FilePath& path, | 112 virtual void FileSelected(const base::FilePath& path, |
111 int index, | 113 int index, |
112 void* params) OVERRIDE; | 114 void* params) OVERRIDE; |
113 virtual void MultiFilesSelected( | 115 virtual void MultiFilesSelected( |
114 const std::vector<base::FilePath>& files, void* params) OVERRIDE; | 116 const std::vector<base::FilePath>& files, void* params) OVERRIDE; |
115 virtual void FileSelectionCanceled(void* params) OVERRIDE {} | 117 virtual void FileSelectionCanceled(void* params) OVERRIDE; |
| 118 |
| 119 // ErrorConsole::Observer implementation. |
| 120 virtual void OnErrorAdded(const ExtensionError* error) OVERRIDE; |
116 | 121 |
117 // content::NotificationObserver implementation. | 122 // content::NotificationObserver implementation. |
118 virtual void Observe(int type, | 123 virtual void Observe(int type, |
119 const content::NotificationSource& source, | 124 const content::NotificationSource& source, |
120 const content::NotificationDetails& details) OVERRIDE; | 125 const content::NotificationDetails& details) OVERRIDE; |
121 | 126 |
122 // ExtensionUninstallDialog::Delegate implementation, used for receiving | 127 // ExtensionUninstallDialog::Delegate implementation, used for receiving |
123 // notification about uninstall confirmation dialog selections. | 128 // notification about uninstall confirmation dialog selections. |
124 virtual void ExtensionUninstallAccepted() OVERRIDE; | 129 virtual void ExtensionUninstallAccepted() OVERRIDE; |
125 virtual void ExtensionUninstallCanceled() OVERRIDE; | 130 virtual void ExtensionUninstallCanceled() OVERRIDE; |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 // another Check() before the previous one is complete will cause the first | 261 // another Check() before the previous one is complete will cause the first |
257 // one to abort. | 262 // one to abort. |
258 scoped_ptr<RequirementsChecker> requirements_checker_; | 263 scoped_ptr<RequirementsChecker> requirements_checker_; |
259 | 264 |
260 // The UI for showing what permissions the extension has. | 265 // The UI for showing what permissions the extension has. |
261 scoped_ptr<ExtensionInstallPrompt> prompt_; | 266 scoped_ptr<ExtensionInstallPrompt> prompt_; |
262 | 267 |
263 ScopedObserver<ExtensionWarningService, ExtensionWarningService::Observer> | 268 ScopedObserver<ExtensionWarningService, ExtensionWarningService::Observer> |
264 warning_service_observer_; | 269 warning_service_observer_; |
265 | 270 |
| 271 // An observer to listen for when Extension errors are reported. |
| 272 ScopedObserver<ErrorConsole, ErrorConsole::Observer> error_console_observer_; |
| 273 |
266 DISALLOW_COPY_AND_ASSIGN(ExtensionSettingsHandler); | 274 DISALLOW_COPY_AND_ASSIGN(ExtensionSettingsHandler); |
267 }; | 275 }; |
268 | 276 |
269 } // namespace extensions | 277 } // namespace extensions |
270 | 278 |
271 #endif // CHROME_BROWSER_UI_WEBUI_EXTENSIONS_EXTENSION_SETTINGS_HANDLER_H_ | 279 #endif // CHROME_BROWSER_UI_WEBUI_EXTENSIONS_EXTENSION_SETTINGS_HANDLER_H_ |
OLD | NEW |