| 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> |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 class PrefService; | 30 class PrefService; |
| 31 | 31 |
| 32 namespace base { | 32 namespace base { |
| 33 class DictionaryValue; | 33 class DictionaryValue; |
| 34 class ListValue; | 34 class ListValue; |
| 35 } | 35 } |
| 36 | 36 |
| 37 namespace extensions { | 37 namespace extensions { |
| 38 class Extension; | 38 class Extension; |
| 39 class ExtensionHost; | 39 class ExtensionHost; |
| 40 class ExtensionWarningSet; |
| 40 class ManagementPolicy; | 41 class ManagementPolicy; |
| 41 } | 42 } |
| 42 | 43 |
| 43 // Information about a page running in an extension, for example a popup bubble, | 44 // Information about a page running in an extension, for example a popup bubble, |
| 44 // a background page, or a tab contents. | 45 // a background page, or a tab contents. |
| 45 struct ExtensionPage { | 46 struct ExtensionPage { |
| 46 ExtensionPage(const GURL& url, int render_process_id, int render_view_id, | 47 ExtensionPage(const GURL& url, int render_process_id, int render_view_id, |
| 47 bool incognito) | 48 bool incognito) |
| 48 : url(url), | 49 : url(url), |
| 49 render_process_id(render_process_id), | 50 render_process_id(render_process_id), |
| 50 render_view_id(render_view_id), | 51 render_view_id(render_view_id), |
| 51 incognito(incognito) {} | 52 incognito(incognito) {} |
| 52 GURL url; | 53 GURL url; |
| 53 int render_process_id; | 54 int render_process_id; |
| 54 int render_view_id; | 55 int render_view_id; |
| 55 bool incognito; | 56 bool incognito; |
| 56 }; | 57 }; |
| 57 | 58 |
| 58 // Extension Settings UI handler. | 59 // Extension Settings UI handler. |
| 59 class ExtensionSettingsHandler | 60 class ExtensionSettingsHandler |
| 60 : public content::WebUIMessageHandler, | 61 : public content::WebUIMessageHandler, |
| 61 public content::NotificationObserver, | 62 public content::NotificationObserver, |
| 62 public content::WebContentsObserver, | 63 public content::WebContentsObserver, |
| 63 public ui::SelectFileDialog::Listener, | 64 public ui::SelectFileDialog::Listener, |
| 64 public ExtensionUninstallDialog::Delegate, | 65 public ExtensionUninstallDialog::Delegate, |
| 65 public base::SupportsWeakPtr<ExtensionSettingsHandler>{ | 66 public extensions::ExtensionWarningSet::Observer, |
| 67 public base::SupportsWeakPtr<ExtensionSettingsHandler> { |
| 66 public: | 68 public: |
| 67 ExtensionSettingsHandler(); | 69 ExtensionSettingsHandler(); |
| 68 virtual ~ExtensionSettingsHandler(); | 70 virtual ~ExtensionSettingsHandler(); |
| 69 | 71 |
| 70 static void RegisterUserPrefs(PrefService* prefs); | 72 static void RegisterUserPrefs(PrefService* prefs); |
| 71 | 73 |
| 72 // Extension Detail JSON Struct for page. |pages| is injected for unit | 74 // Extension Detail JSON Struct for page. |pages| is injected for unit |
| 73 // testing. | 75 // testing. |
| 74 // Note: |warning_set| can be NULL in unit tests. | 76 // Note: |warning_set| can be NULL in unit tests. |
| 75 base::DictionaryValue* CreateExtensionDetailValue( | 77 base::DictionaryValue* CreateExtensionDetailValue( |
| 76 const extensions::Extension* extension, | 78 const extensions::Extension* extension, |
| 77 const std::vector<ExtensionPage>& pages, | 79 const std::vector<ExtensionPage>& pages, |
| 78 const ExtensionWarningSet* warning_set); | 80 const extensions::ExtensionWarningSet* warning_set); |
| 79 | 81 |
| 80 void GetLocalizedValues(base::DictionaryValue* localized_strings); | 82 void GetLocalizedValues(base::DictionaryValue* localized_strings); |
| 81 | 83 |
| 82 // content::WebContentsObserver implementation, which reloads all unpacked | 84 // content::WebContentsObserver implementation, which reloads all unpacked |
| 83 // extensions whenever chrome://extensions is reloaded. | 85 // extensions whenever chrome://extensions is reloaded. |
| 84 virtual void NavigateToPendingEntry( | 86 virtual void NavigateToPendingEntry( |
| 85 const GURL& url, | 87 const GURL& url, |
| 86 content::NavigationController::ReloadType reload_type) OVERRIDE; | 88 content::NavigationController::ReloadType reload_type) OVERRIDE; |
| 87 | 89 |
| 88 private: | 90 private: |
| (...skipping 16 matching lines...) Expand all Loading... |
| 105 // content::NotificationObserver implementation. | 107 // content::NotificationObserver implementation. |
| 106 virtual void Observe(int type, | 108 virtual void Observe(int type, |
| 107 const content::NotificationSource& source, | 109 const content::NotificationSource& source, |
| 108 const content::NotificationDetails& details) OVERRIDE; | 110 const content::NotificationDetails& details) OVERRIDE; |
| 109 | 111 |
| 110 // ExtensionUninstallDialog::Delegate implementation, used for receiving | 112 // ExtensionUninstallDialog::Delegate implementation, used for receiving |
| 111 // notification about uninstall confirmation dialog selections. | 113 // notification about uninstall confirmation dialog selections. |
| 112 virtual void ExtensionUninstallAccepted() OVERRIDE; | 114 virtual void ExtensionUninstallAccepted() OVERRIDE; |
| 113 virtual void ExtensionUninstallCanceled() OVERRIDE; | 115 virtual void ExtensionUninstallCanceled() OVERRIDE; |
| 114 | 116 |
| 117 // extensions::ExtensionWarningSet::Observer implementation. |
| 118 virtual void ExtensionWarningsChanged() OVERRIDE; |
| 119 |
| 115 // Helper method that reloads all unpacked extensions. | 120 // Helper method that reloads all unpacked extensions. |
| 116 void ReloadUnpackedExtensions(); | 121 void ReloadUnpackedExtensions(); |
| 117 | 122 |
| 118 // Callback for "requestExtensionsData" message. | 123 // Callback for "requestExtensionsData" message. |
| 119 void HandleRequestExtensionsData(const base::ListValue* args); | 124 void HandleRequestExtensionsData(const base::ListValue* args); |
| 120 | 125 |
| 121 // Callback for "toggleDeveloperMode" message. | 126 // Callback for "toggleDeveloperMode" message. |
| 122 void HandleToggleDeveloperMode(const base::ListValue* args); | 127 void HandleToggleDeveloperMode(const base::ListValue* args); |
| 123 | 128 |
| 124 // Callback for "inspect" message. | 129 // Callback for "inspect" message. |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 | 232 |
| 228 // This will not be empty when a requirements check is in progress. Doing | 233 // 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 | 234 // another Check() before the previous one is complete will cause the first |
| 230 // one to abort. | 235 // one to abort. |
| 231 scoped_ptr<extensions::RequirementsChecker> requirements_checker_; | 236 scoped_ptr<extensions::RequirementsChecker> requirements_checker_; |
| 232 | 237 |
| 233 DISALLOW_COPY_AND_ASSIGN(ExtensionSettingsHandler); | 238 DISALLOW_COPY_AND_ASSIGN(ExtensionSettingsHandler); |
| 234 }; | 239 }; |
| 235 | 240 |
| 236 #endif // CHROME_BROWSER_UI_WEBUI_EXTENSIONS_EXTENSION_SETTINGS_HANDLER_H_ | 241 #endif // CHROME_BROWSER_UI_WEBUI_EXTENSIONS_EXTENSION_SETTINGS_HANDLER_H_ |
| OLD | NEW |