| 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_service.h" |
| 13 #include "chrome/browser/extensions/extension_uninstall_dialog.h" | 14 #include "chrome/browser/extensions/extension_uninstall_dialog.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 FilePath; | 24 class FilePath; |
| 25 class PrefService; | 25 class PrefService; |
| 26 class RenderProcessHost; | 26 class RenderProcessHost; |
| 27 class UserScript; | 27 class UserScript; |
| 28 | 28 |
| 29 namespace base { | 29 namespace base { |
| 30 class DictionaryValue; | 30 class DictionaryValue; |
| 31 class ListValue; | 31 class ListValue; |
| 32 } | 32 } |
| 33 | 33 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 55 virtual ~ExtensionSettingsHandler(); | 55 virtual ~ExtensionSettingsHandler(); |
| 56 | 56 |
| 57 static void RegisterUserPrefs(PrefService* prefs); | 57 static void RegisterUserPrefs(PrefService* prefs); |
| 58 | 58 |
| 59 // Extension Detail JSON Struct for page. (static for ease of testing). | 59 // Extension Detail JSON Struct for page. (static for ease of testing). |
| 60 // Note: service can be NULL in unit tests. | 60 // Note: service can be NULL in unit tests. |
| 61 static base::DictionaryValue* CreateExtensionDetailValue( | 61 static base::DictionaryValue* CreateExtensionDetailValue( |
| 62 ExtensionService* service, | 62 ExtensionService* service, |
| 63 const Extension* extension, | 63 const Extension* extension, |
| 64 const std::vector<ExtensionPage>& pages, | 64 const std::vector<ExtensionPage>& pages, |
| 65 const ExtensionService::ExtensionWarningsType& warnings, |
| 65 bool enabled, | 66 bool enabled, |
| 66 bool terminated); | 67 bool terminated); |
| 67 | 68 |
| 68 // ContentScript JSON Struct for page. (static for ease of testing). | 69 // ContentScript JSON Struct for page. (static for ease of testing). |
| 69 static base::DictionaryValue* CreateContentScriptDetailValue( | 70 static base::DictionaryValue* CreateContentScriptDetailValue( |
| 70 const UserScript& script, | 71 const UserScript& script, |
| 71 const FilePath& extension_path); | 72 const FilePath& extension_path); |
| 72 | 73 |
| 73 // Callback for "requestExtensionsData" message. | 74 // Callback for "requestExtensionsData" message. |
| 74 void HandleRequestExtensionsData(const base::ListValue* args); | 75 void HandleRequestExtensionsData(const base::ListValue* args); |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 const Extension* extension); | 157 const Extension* extension); |
| 157 void GetActivePagesForExtensionProcess( | 158 void GetActivePagesForExtensionProcess( |
| 158 RenderProcessHost* process, | 159 RenderProcessHost* process, |
| 159 const Extension* extension, | 160 const Extension* extension, |
| 160 std::vector<ExtensionPage> *result); | 161 std::vector<ExtensionPage> *result); |
| 161 | 162 |
| 162 // Returns the ExtensionUninstallDialog object for this class, creating it if | 163 // Returns the ExtensionUninstallDialog object for this class, creating it if |
| 163 // needed. | 164 // needed. |
| 164 ExtensionUninstallDialog* GetExtensionUninstallDialog(); | 165 ExtensionUninstallDialog* GetExtensionUninstallDialog(); |
| 165 | 166 |
| 167 // Returns a localized string for |warning|. |
| 168 static string16 GetLocalizedWarning(const ExtensionServiceWarning& warning); |
| 169 |
| 166 // Our model. Outlives us since it's owned by our containing profile. | 170 // Our model. Outlives us since it's owned by our containing profile. |
| 167 ExtensionService* extension_service_; | 171 ExtensionService* extension_service_; |
| 168 | 172 |
| 169 // Used to pick the directory when loading an extension. | 173 // Used to pick the directory when loading an extension. |
| 170 scoped_refptr<SelectFileDialog> load_extension_dialog_; | 174 scoped_refptr<SelectFileDialog> load_extension_dialog_; |
| 171 | 175 |
| 172 // Used to show confirmation UI for uninstalling extensions in incognito mode. | 176 // Used to show confirmation UI for uninstalling extensions in incognito mode. |
| 173 scoped_ptr<ExtensionUninstallDialog> extension_uninstall_dialog_; | 177 scoped_ptr<ExtensionUninstallDialog> extension_uninstall_dialog_; |
| 174 | 178 |
| 175 // The id of the extension we are prompting the user about. | 179 // 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 | 194 // 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 | 195 // 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 | 196 // that don't exist yet when notifications come in. This variable makes sure |
| 193 // we do so only once. | 197 // we do so only once. |
| 194 bool registered_for_notifications_; | 198 bool registered_for_notifications_; |
| 195 | 199 |
| 196 DISALLOW_COPY_AND_ASSIGN(ExtensionSettingsHandler); | 200 DISALLOW_COPY_AND_ASSIGN(ExtensionSettingsHandler); |
| 197 }; | 201 }; |
| 198 | 202 |
| 199 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_EXTENSION_SETTINGS_HANDLER_H_ | 203 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_EXTENSION_SETTINGS_HANDLER_H_ |
| OLD | NEW |