| 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 "chrome/browser/api/prefs/pref_change_registrar.h" | 13 #include "chrome/browser/api/prefs/pref_change_registrar.h" |
| 14 #include "chrome/browser/extensions/extension_install_ui.h" | 14 #include "chrome/browser/extensions/extension_install_ui.h" |
| 15 #include "chrome/browser/extensions/extension_uninstall_dialog.h" | 15 #include "chrome/browser/extensions/extension_uninstall_dialog.h" |
| 16 #include "chrome/browser/extensions/extension_warning_set.h" | 16 #include "chrome/browser/extensions/extension_warning_service.h" |
| 17 #include "chrome/browser/extensions/requirements_checker.h" | 17 #include "chrome/browser/extensions/requirements_checker.h" |
| 18 #include "chrome/common/extensions/extension_resource.h" | 18 #include "chrome/common/extensions/extension_resource.h" |
| 19 #include "content/public/browser/navigation_controller.h" | 19 #include "content/public/browser/navigation_controller.h" |
| 20 #include "content/public/browser/notification_observer.h" | 20 #include "content/public/browser/notification_observer.h" |
| 21 #include "content/public/browser/notification_registrar.h" | 21 #include "content/public/browser/notification_registrar.h" |
| 22 #include "content/public/browser/render_view_host.h" | 22 #include "content/public/browser/render_view_host.h" |
| 23 #include "content/public/browser/web_contents_observer.h" | 23 #include "content/public/browser/web_contents_observer.h" |
| 24 #include "content/public/browser/web_ui_message_handler.h" | 24 #include "content/public/browser/web_ui_message_handler.h" |
| 25 #include "googleurl/src/gurl.h" | 25 #include "googleurl/src/gurl.h" |
| 26 #include "ui/base/dialogs/select_file_dialog.h" | 26 #include "ui/base/dialogs/select_file_dialog.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 55 bool incognito; | 55 bool incognito; |
| 56 }; | 56 }; |
| 57 | 57 |
| 58 // Extension Settings UI handler. | 58 // Extension Settings UI handler. |
| 59 class ExtensionSettingsHandler | 59 class ExtensionSettingsHandler |
| 60 : public content::WebUIMessageHandler, | 60 : public content::WebUIMessageHandler, |
| 61 public content::NotificationObserver, | 61 public content::NotificationObserver, |
| 62 public content::WebContentsObserver, | 62 public content::WebContentsObserver, |
| 63 public ui::SelectFileDialog::Listener, | 63 public ui::SelectFileDialog::Listener, |
| 64 public ExtensionUninstallDialog::Delegate, | 64 public ExtensionUninstallDialog::Delegate, |
| 65 public extensions::ExtensionWarningService::Observer, |
| 65 public base::SupportsWeakPtr<ExtensionSettingsHandler>{ | 66 public base::SupportsWeakPtr<ExtensionSettingsHandler>{ |
| 66 public: | 67 public: |
| 67 ExtensionSettingsHandler(); | 68 ExtensionSettingsHandler(); |
| 68 virtual ~ExtensionSettingsHandler(); | 69 virtual ~ExtensionSettingsHandler(); |
| 69 | 70 |
| 70 static void RegisterUserPrefs(PrefService* prefs); | 71 static void RegisterUserPrefs(PrefService* prefs); |
| 71 | 72 |
| 72 // Extension Detail JSON Struct for page. |pages| is injected for unit | 73 // Extension Detail JSON Struct for page. |pages| is injected for unit |
| 73 // testing. | 74 // testing. |
| 74 // Note: |warning_set| can be NULL in unit tests. | 75 // Note: |warning_service| can be NULL in unit tests. |
| 75 base::DictionaryValue* CreateExtensionDetailValue( | 76 base::DictionaryValue* CreateExtensionDetailValue( |
| 76 const extensions::Extension* extension, | 77 const extensions::Extension* extension, |
| 77 const std::vector<ExtensionPage>& pages, | 78 const std::vector<ExtensionPage>& pages, |
| 78 const ExtensionWarningSet* warning_set); | 79 const extensions::ExtensionWarningService* warning_service); |
| 79 | 80 |
| 80 void GetLocalizedValues(base::DictionaryValue* localized_strings); | 81 void GetLocalizedValues(base::DictionaryValue* localized_strings); |
| 81 | 82 |
| 82 // content::WebContentsObserver implementation, which reloads all unpacked | 83 // content::WebContentsObserver implementation, which reloads all unpacked |
| 83 // extensions whenever chrome://extensions is reloaded. | 84 // extensions whenever chrome://extensions is reloaded. |
| 84 virtual void NavigateToPendingEntry( | 85 virtual void NavigateToPendingEntry( |
| 85 const GURL& url, | 86 const GURL& url, |
| 86 content::NavigationController::ReloadType reload_type) OVERRIDE; | 87 content::NavigationController::ReloadType reload_type) OVERRIDE; |
| 87 | 88 |
| 88 private: | 89 private: |
| (...skipping 16 matching lines...) Expand all Loading... |
| 105 // content::NotificationObserver implementation. | 106 // content::NotificationObserver implementation. |
| 106 virtual void Observe(int type, | 107 virtual void Observe(int type, |
| 107 const content::NotificationSource& source, | 108 const content::NotificationSource& source, |
| 108 const content::NotificationDetails& details) OVERRIDE; | 109 const content::NotificationDetails& details) OVERRIDE; |
| 109 | 110 |
| 110 // ExtensionUninstallDialog::Delegate implementation, used for receiving | 111 // ExtensionUninstallDialog::Delegate implementation, used for receiving |
| 111 // notification about uninstall confirmation dialog selections. | 112 // notification about uninstall confirmation dialog selections. |
| 112 virtual void ExtensionUninstallAccepted() OVERRIDE; | 113 virtual void ExtensionUninstallAccepted() OVERRIDE; |
| 113 virtual void ExtensionUninstallCanceled() OVERRIDE; | 114 virtual void ExtensionUninstallCanceled() OVERRIDE; |
| 114 | 115 |
| 116 // extensions::ExtensionWarningService::Observer implementation. |
| 117 virtual void ExtensionWarningsChanged() OVERRIDE; |
| 118 |
| 115 // Helper method that reloads all unpacked extensions. | 119 // Helper method that reloads all unpacked extensions. |
| 116 void ReloadUnpackedExtensions(); | 120 void ReloadUnpackedExtensions(); |
| 117 | 121 |
| 118 // Callback for "requestExtensionsData" message. | 122 // Callback for "requestExtensionsData" message. |
| 119 void HandleRequestExtensionsData(const base::ListValue* args); | 123 void HandleRequestExtensionsData(const base::ListValue* args); |
| 120 | 124 |
| 121 // Callback for "toggleDeveloperMode" message. | 125 // Callback for "toggleDeveloperMode" message. |
| 122 void HandleToggleDeveloperMode(const base::ListValue* args); | 126 void HandleToggleDeveloperMode(const base::ListValue* args); |
| 123 | 127 |
| 124 // Callback for "inspect" message. | 128 // Callback for "inspect" message. |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 | 231 |
| 228 // This will not be empty when a requirements check is in progress. Doing | 232 // This will not be empty when a requirements check is in progress. Doing |
| 229 // another Check() before the previous one is complete will cause the first | 233 // another Check() before the previous one is complete will cause the first |
| 230 // one to abort. | 234 // one to abort. |
| 231 scoped_ptr<extensions::RequirementsChecker> requirements_checker_; | 235 scoped_ptr<extensions::RequirementsChecker> requirements_checker_; |
| 232 | 236 |
| 233 DISALLOW_COPY_AND_ASSIGN(ExtensionSettingsHandler); | 237 DISALLOW_COPY_AND_ASSIGN(ExtensionSettingsHandler); |
| 234 }; | 238 }; |
| 235 | 239 |
| 236 #endif // CHROME_BROWSER_UI_WEBUI_EXTENSIONS_EXTENSION_SETTINGS_HANDLER_H_ | 240 #endif // CHROME_BROWSER_UI_WEBUI_EXTENSIONS_EXTENSION_SETTINGS_HANDLER_H_ |
| OLD | NEW |