Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_OPTIONS_EXTENSION_SETTINGS_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_EXTENSION_SETTINGS_HANDLER_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_EXTENSION_SETTINGS_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_EXTENSION_SETTINGS_HANDLER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "chrome/browser/extensions/extension_install_ui.h" | 12 #include "chrome/browser/extensions/extension_install_ui.h" |
| 13 #include "chrome/browser/extensions/extension_uninstall_dialog.h" | 13 #include "chrome/browser/extensions/extension_uninstall_dialog.h" |
| 14 #include "chrome/browser/extensions/extension_warning_set.h" | |
| 14 #include "chrome/browser/ui/shell_dialogs.h" | 15 #include "chrome/browser/ui/shell_dialogs.h" |
| 15 #include "chrome/browser/ui/webui/options/options_ui.h" | 16 #include "chrome/browser/ui/webui/options/options_ui.h" |
| 16 #include "chrome/browser/ui/webui/chrome_web_ui.h" | 17 #include "chrome/browser/ui/webui/chrome_web_ui.h" |
| 17 #include "chrome/common/extensions/extension_resource.h" | 18 #include "chrome/common/extensions/extension_resource.h" |
| 18 #include "content/common/notification_observer.h" | 19 #include "content/common/notification_observer.h" |
| 19 #include "content/common/notification_registrar.h" | 20 #include "content/common/notification_registrar.h" |
| 20 #include "googleurl/src/gurl.h" | 21 #include "googleurl/src/gurl.h" |
| 21 | 22 |
| 22 class Extension; | 23 class Extension; |
| 23 class ExtensionService; | 24 class ExtensionService; |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 50 class ExtensionSettingsHandler : public OptionsPageUIHandler, | 51 class ExtensionSettingsHandler : public OptionsPageUIHandler, |
| 51 public SelectFileDialog::Listener, | 52 public SelectFileDialog::Listener, |
| 52 public ExtensionUninstallDialog::Delegate { | 53 public ExtensionUninstallDialog::Delegate { |
| 53 public: | 54 public: |
| 54 ExtensionSettingsHandler(); | 55 ExtensionSettingsHandler(); |
| 55 virtual ~ExtensionSettingsHandler(); | 56 virtual ~ExtensionSettingsHandler(); |
| 56 | 57 |
| 57 static void RegisterUserPrefs(PrefService* prefs); | 58 static void RegisterUserPrefs(PrefService* prefs); |
| 58 | 59 |
| 59 // Extension Detail JSON Struct for page. (static for ease of testing). | 60 // Extension Detail JSON Struct for page. (static for ease of testing). |
| 60 // Note: service can be NULL in unit tests. | 61 // Note: |service| and |warnings| can be NULL in unit tests. |
| 61 static base::DictionaryValue* CreateExtensionDetailValue( | 62 static base::DictionaryValue* CreateExtensionDetailValue( |
| 62 ExtensionService* service, | 63 ExtensionService* service, |
| 63 const Extension* extension, | 64 const Extension* extension, |
| 64 const std::vector<ExtensionPage>& pages, | 65 const std::vector<ExtensionPage>& pages, |
| 66 const ExtensionWarningSet* warnings, | |
| 65 bool enabled, | 67 bool enabled, |
| 66 bool terminated); | 68 bool terminated); |
| 67 | 69 |
| 68 // ContentScript JSON Struct for page. (static for ease of testing). | 70 // ContentScript JSON Struct for page. (static for ease of testing). |
| 69 static base::DictionaryValue* CreateContentScriptDetailValue( | 71 static base::DictionaryValue* CreateContentScriptDetailValue( |
| 70 const UserScript& script, | 72 const UserScript& script, |
| 71 const FilePath& extension_path); | 73 const FilePath& extension_path); |
| 72 | 74 |
| 73 // Callback for "requestExtensionsData" message. | 75 // Callback for "requestExtensionsData" message. |
| 74 void HandleRequestExtensionsData(const base::ListValue* args); | 76 void HandleRequestExtensionsData(const base::ListValue* args); |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 156 const Extension* extension); | 158 const Extension* extension); |
| 157 void GetActivePagesForExtensionProcess( | 159 void GetActivePagesForExtensionProcess( |
| 158 RenderProcessHost* process, | 160 RenderProcessHost* process, |
| 159 const Extension* extension, | 161 const Extension* extension, |
| 160 std::vector<ExtensionPage> *result); | 162 std::vector<ExtensionPage> *result); |
| 161 | 163 |
| 162 // Returns the ExtensionUninstallDialog object for this class, creating it if | 164 // Returns the ExtensionUninstallDialog object for this class, creating it if |
| 163 // needed. | 165 // needed. |
| 164 ExtensionUninstallDialog* GetExtensionUninstallDialog(); | 166 ExtensionUninstallDialog* GetExtensionUninstallDialog(); |
| 165 | 167 |
| 168 // Returns a localized string for |warning_type|. | |
| 169 static string16 GetLocalizedWarning( | |
| 170 ExtensionWarning::WarningType warning_type); | |
|
Finnur
2011/10/10 09:59:24
nit: static function should be at the top of the p
battre
2011/10/10 13:16:36
I have moved the function up. I did not move it in
Finnur
2011/10/10 15:06:56
I don't feel strongly about it but if someone adds
battre
2011/10/10 15:55:57
Convinced. Done.
| |
| 171 | |
| 166 // Our model. Outlives us since it's owned by our containing profile. | 172 // Our model. Outlives us since it's owned by our containing profile. |
| 167 ExtensionService* extension_service_; | 173 ExtensionService* extension_service_; |
| 168 | 174 |
| 169 // Used to pick the directory when loading an extension. | 175 // Used to pick the directory when loading an extension. |
| 170 scoped_refptr<SelectFileDialog> load_extension_dialog_; | 176 scoped_refptr<SelectFileDialog> load_extension_dialog_; |
| 171 | 177 |
| 172 // Used to show confirmation UI for uninstalling extensions in incognito mode. | 178 // Used to show confirmation UI for uninstalling extensions in incognito mode. |
| 173 scoped_ptr<ExtensionUninstallDialog> extension_uninstall_dialog_; | 179 scoped_ptr<ExtensionUninstallDialog> extension_uninstall_dialog_; |
| 174 | 180 |
| 175 // The id of the extension we are prompting the user about. | 181 // The id of the extension we are prompting the user about. |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 190 // We want to register for notifications only after we've responded at least | 196 // We want to register for notifications only after we've responded at least |
| 191 // once to the page, otherwise we'd be calling javacsript functions on objects | 197 // once to the page, otherwise we'd be calling javacsript functions on objects |
| 192 // that don't exist yet when notifications come in. This variable makes sure | 198 // that don't exist yet when notifications come in. This variable makes sure |
| 193 // we do so only once. | 199 // we do so only once. |
| 194 bool registered_for_notifications_; | 200 bool registered_for_notifications_; |
| 195 | 201 |
| 196 DISALLOW_COPY_AND_ASSIGN(ExtensionSettingsHandler); | 202 DISALLOW_COPY_AND_ASSIGN(ExtensionSettingsHandler); |
| 197 }; | 203 }; |
| 198 | 204 |
| 199 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_EXTENSION_SETTINGS_HANDLER_H_ | 205 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_EXTENSION_SETTINGS_HANDLER_H_ |
| OLD | NEW |