Chromium Code Reviews| 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/public/pref_change_registrar.h" | 13 #include "base/prefs/public/pref_change_registrar.h" |
| 14 #include "base/prefs/public/pref_observer.h" | 14 #include "base/prefs/public/pref_observer.h" |
| 15 #include "chrome/browser/extensions/extension_install_ui.h" | 15 #include "chrome/browser/extensions/extension_install_ui.h" |
| 16 #include "chrome/browser/extensions/extension_uninstall_dialog.h" | 16 #include "chrome/browser/extensions/extension_uninstall_dialog.h" |
| 17 #include "chrome/browser/extensions/extension_warning_set.h" | 17 #include "chrome/browser/extensions/extension_warning_service.h" |
| 18 #include "chrome/browser/extensions/requirements_checker.h" | 18 #include "chrome/browser/extensions/requirements_checker.h" |
| 19 #include "chrome/common/extensions/extension_resource.h" | 19 #include "chrome/common/extensions/extension_resource.h" |
| 20 #include "content/public/browser/navigation_controller.h" | 20 #include "content/public/browser/navigation_controller.h" |
| 21 #include "content/public/browser/notification_observer.h" | 21 #include "content/public/browser/notification_observer.h" |
| 22 #include "content/public/browser/notification_registrar.h" | 22 #include "content/public/browser/notification_registrar.h" |
| 23 #include "content/public/browser/render_view_host.h" | 23 #include "content/public/browser/render_view_host.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 "googleurl/src/gurl.h" | 26 #include "googleurl/src/gurl.h" |
| 27 #include "ui/base/dialogs/select_file_dialog.h" | 27 #include "ui/base/dialogs/select_file_dialog.h" |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 57 }; | 57 }; |
| 58 | 58 |
| 59 // Extension Settings UI handler. | 59 // Extension Settings UI handler. |
| 60 class ExtensionSettingsHandler | 60 class ExtensionSettingsHandler |
| 61 : public content::WebUIMessageHandler, | 61 : public content::WebUIMessageHandler, |
| 62 public content::NotificationObserver, | 62 public content::NotificationObserver, |
| 63 public PrefObserver, | 63 public PrefObserver, |
| 64 public content::WebContentsObserver, | 64 public content::WebContentsObserver, |
| 65 public ui::SelectFileDialog::Listener, | 65 public ui::SelectFileDialog::Listener, |
| 66 public ExtensionUninstallDialog::Delegate, | 66 public ExtensionUninstallDialog::Delegate, |
| 67 public extensions::ExtensionWarningService::Observer, | |
| 67 public base::SupportsWeakPtr<ExtensionSettingsHandler>{ | 68 public base::SupportsWeakPtr<ExtensionSettingsHandler>{ |
|
Evan Stade
2012/11/13 20:21:54
can you add a space before the curly
battre
2012/11/14 12:30:54
Done.
| |
| 68 public: | 69 public: |
| 69 ExtensionSettingsHandler(); | 70 ExtensionSettingsHandler(); |
| 70 virtual ~ExtensionSettingsHandler(); | 71 virtual ~ExtensionSettingsHandler(); |
| 71 | 72 |
| 72 static void RegisterUserPrefs(PrefService* prefs); | 73 static void RegisterUserPrefs(PrefService* prefs); |
| 73 | 74 |
| 74 // Extension Detail JSON Struct for page. |pages| is injected for unit | 75 // Extension Detail JSON Struct for page. |pages| is injected for unit |
| 75 // testing. | 76 // testing. |
| 76 // Note: |warning_set| can be NULL in unit tests. | 77 // Note: |warning_service| can be NULL in unit tests. |
| 77 base::DictionaryValue* CreateExtensionDetailValue( | 78 base::DictionaryValue* CreateExtensionDetailValue( |
| 78 const extensions::Extension* extension, | 79 const extensions::Extension* extension, |
| 79 const std::vector<ExtensionPage>& pages, | 80 const std::vector<ExtensionPage>& pages, |
| 80 const ExtensionWarningSet* warning_set); | 81 const extensions::ExtensionWarningService* warning_service); |
| 81 | 82 |
| 82 void GetLocalizedValues(base::DictionaryValue* localized_strings); | 83 void GetLocalizedValues(base::DictionaryValue* localized_strings); |
| 83 | 84 |
| 84 // content::WebContentsObserver implementation, which reloads all unpacked | 85 // content::WebContentsObserver implementation, which reloads all unpacked |
| 85 // extensions whenever chrome://extensions is reloaded. | 86 // extensions whenever chrome://extensions is reloaded. |
| 86 virtual void NavigateToPendingEntry( | 87 virtual void NavigateToPendingEntry( |
| 87 const GURL& url, | 88 const GURL& url, |
| 88 content::NavigationController::ReloadType reload_type) OVERRIDE; | 89 content::NavigationController::ReloadType reload_type) OVERRIDE; |
| 89 | 90 |
| 90 private: | 91 private: |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 111 | 112 |
| 112 // PrefObserver implementation. | 113 // PrefObserver implementation. |
| 113 virtual void OnPreferenceChanged(PrefServiceBase* service, | 114 virtual void OnPreferenceChanged(PrefServiceBase* service, |
| 114 const std::string& pref_name) OVERRIDE; | 115 const std::string& pref_name) OVERRIDE; |
| 115 | 116 |
| 116 // ExtensionUninstallDialog::Delegate implementation, used for receiving | 117 // ExtensionUninstallDialog::Delegate implementation, used for receiving |
| 117 // notification about uninstall confirmation dialog selections. | 118 // notification about uninstall confirmation dialog selections. |
| 118 virtual void ExtensionUninstallAccepted() OVERRIDE; | 119 virtual void ExtensionUninstallAccepted() OVERRIDE; |
| 119 virtual void ExtensionUninstallCanceled() OVERRIDE; | 120 virtual void ExtensionUninstallCanceled() OVERRIDE; |
| 120 | 121 |
| 122 // extensions::ExtensionWarningService::Observer implementation. | |
| 123 virtual void ExtensionWarningsChanged() OVERRIDE; | |
| 124 | |
| 121 // Helper method that reloads all unpacked extensions. | 125 // Helper method that reloads all unpacked extensions. |
| 122 void ReloadUnpackedExtensions(); | 126 void ReloadUnpackedExtensions(); |
| 123 | 127 |
| 124 // Callback for "requestExtensionsData" message. | 128 // Callback for "requestExtensionsData" message. |
| 125 void HandleRequestExtensionsData(const base::ListValue* args); | 129 void HandleRequestExtensionsData(const base::ListValue* args); |
| 126 | 130 |
| 127 // Callback for "toggleDeveloperMode" message. | 131 // Callback for "toggleDeveloperMode" message. |
| 128 void HandleToggleDeveloperMode(const base::ListValue* args); | 132 void HandleToggleDeveloperMode(const base::ListValue* args); |
| 129 | 133 |
| 130 // Callback for "inspect" message. | 134 // Callback for "inspect" message. |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 233 | 237 |
| 234 // This will not be empty when a requirements check is in progress. Doing | 238 // This will not be empty when a requirements check is in progress. Doing |
| 235 // another Check() before the previous one is complete will cause the first | 239 // another Check() before the previous one is complete will cause the first |
| 236 // one to abort. | 240 // one to abort. |
| 237 scoped_ptr<extensions::RequirementsChecker> requirements_checker_; | 241 scoped_ptr<extensions::RequirementsChecker> requirements_checker_; |
| 238 | 242 |
| 239 DISALLOW_COPY_AND_ASSIGN(ExtensionSettingsHandler); | 243 DISALLOW_COPY_AND_ASSIGN(ExtensionSettingsHandler); |
| 240 }; | 244 }; |
| 241 | 245 |
| 242 #endif // CHROME_BROWSER_UI_WEBUI_EXTENSIONS_EXTENSION_SETTINGS_HANDLER_H_ | 246 #endif // CHROME_BROWSER_UI_WEBUI_EXTENSIONS_EXTENSION_SETTINGS_HANDLER_H_ |
| OLD | NEW |