| 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/memory/weak_ptr.h" |
| 13 #include "chrome/browser/extensions/extension_install_ui.h" | 14 #include "chrome/browser/extensions/extension_install_ui.h" |
| 14 #include "chrome/browser/extensions/extension_uninstall_dialog.h" | 15 #include "chrome/browser/extensions/extension_uninstall_dialog.h" |
| 15 #include "chrome/browser/extensions/extension_warning_set.h" | 16 #include "chrome/browser/extensions/extension_warning_set.h" |
| 16 #include "chrome/browser/prefs/pref_change_registrar.h" | 17 #include "chrome/browser/prefs/pref_change_registrar.h" |
| 17 #include "chrome/common/extensions/extension_resource.h" | 18 #include "chrome/common/extensions/extension_resource.h" |
| 18 #include "content/public/browser/navigation_controller.h" | 19 #include "content/public/browser/navigation_controller.h" |
| 19 #include "content/public/browser/notification_observer.h" | 20 #include "content/public/browser/notification_observer.h" |
| 20 #include "content/public/browser/notification_registrar.h" | 21 #include "content/public/browser/notification_registrar.h" |
| 21 #include "content/public/browser/render_view_host.h" | 22 #include "content/public/browser/render_view_host.h" |
| 22 #include "content/public/browser/web_contents_observer.h" | 23 #include "content/public/browser/web_contents_observer.h" |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 int index, void* params) OVERRIDE; | 98 int index, void* params) OVERRIDE; |
| 98 virtual void MultiFilesSelected( | 99 virtual void MultiFilesSelected( |
| 99 const std::vector<FilePath>& files, void* params) OVERRIDE; | 100 const std::vector<FilePath>& files, void* params) OVERRIDE; |
| 100 virtual void FileSelectionCanceled(void* params) OVERRIDE {} | 101 virtual void FileSelectionCanceled(void* params) OVERRIDE {} |
| 101 | 102 |
| 102 // content::NotificationObserver implementation. | 103 // content::NotificationObserver implementation. |
| 103 virtual void Observe(int type, | 104 virtual void Observe(int type, |
| 104 const content::NotificationSource& source, | 105 const content::NotificationSource& source, |
| 105 const content::NotificationDetails& details) OVERRIDE; | 106 const content::NotificationDetails& details) OVERRIDE; |
| 106 | 107 |
| 108 // Launches the application described by |extension_id|. |
| 109 void LaunchApplication(extensions::ExtensionHost* extension_host); |
| 110 |
| 107 // ExtensionUninstallDialog::Delegate implementation, used for receiving | 111 // ExtensionUninstallDialog::Delegate implementation, used for receiving |
| 108 // notification about uninstall confirmation dialog selections. | 112 // notification about uninstall confirmation dialog selections. |
| 109 virtual void ExtensionUninstallAccepted() OVERRIDE; | 113 virtual void ExtensionUninstallAccepted() OVERRIDE; |
| 110 virtual void ExtensionUninstallCanceled() OVERRIDE; | 114 virtual void ExtensionUninstallCanceled() OVERRIDE; |
| 111 | 115 |
| 112 // Helper method that reloads all unpacked extensions. | 116 // Helper method that reloads all unpacked extensions. |
| 113 void ReloadUnpackedExtensions(); | 117 void ReloadUnpackedExtensions(); |
| 114 | 118 |
| 119 // Reloads the given extension. |
| 120 void ReloadExtension(const extensions::Extension* extension); |
| 121 |
| 115 // Callback for "requestExtensionsData" message. | 122 // Callback for "requestExtensionsData" message. |
| 116 void HandleRequestExtensionsData(const base::ListValue* args); | 123 void HandleRequestExtensionsData(const base::ListValue* args); |
| 117 | 124 |
| 118 // Callback for "toggleDeveloperMode" message. | 125 // Callback for "toggleDeveloperMode" message. |
| 119 void HandleToggleDeveloperMode(const base::ListValue* args); | 126 void HandleToggleDeveloperMode(const base::ListValue* args); |
| 120 | 127 |
| 121 // Callback for "inspect" message. | 128 // Callback for "inspect" message. |
| 122 void HandleInspectMessage(const base::ListValue* args); | 129 void HandleInspectMessage(const base::ListValue* args); |
| 123 | 130 |
| 124 // Callback for "reload" message. | 131 // Callback for "reload" message. |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 // it is removed from the process). Keep a pointer to it so we can exclude | 212 // it is removed from the process). Keep a pointer to it so we can exclude |
| 206 // it from the active views. | 213 // it from the active views. |
| 207 content::RenderViewHost* deleting_rvh_; | 214 content::RenderViewHost* deleting_rvh_; |
| 208 | 215 |
| 209 // We want to register for notifications only after we've responded at least | 216 // We want to register for notifications only after we've responded at least |
| 210 // once to the page, otherwise we'd be calling JavaScript functions on objects | 217 // once to the page, otherwise we'd be calling JavaScript functions on objects |
| 211 // that don't exist yet when notifications come in. This variable makes sure | 218 // that don't exist yet when notifications come in. This variable makes sure |
| 212 // we do so only once. | 219 // we do so only once. |
| 213 bool registered_for_notifications_; | 220 bool registered_for_notifications_; |
| 214 | 221 |
| 222 // The set of apps for which we have triggered reload. They will be |
| 223 // re-launched when loaded again. The boolean tracks whether they have been |
| 224 // enabled (whether NOTIFICATION_EXTENSION_ENABLED has been dispatched). This |
| 225 // hack is necessary because reloading an extension causes multiple LOADED |
| 226 // notifications, but we only care about the one that comes after ENABLED. |
| 227 typedef std::map<std::string, bool> RelaunchApps; |
| 228 RelaunchApps relaunch_app_ids_; |
| 229 |
| 215 content::NotificationRegistrar registrar_; | 230 content::NotificationRegistrar registrar_; |
| 216 | 231 |
| 217 PrefChangeRegistrar pref_registrar_; | 232 PrefChangeRegistrar pref_registrar_; |
| 218 PrefChangeRegistrar local_state_pref_registrar_; | 233 PrefChangeRegistrar local_state_pref_registrar_; |
| 219 | 234 |
| 235 base::WeakPtrFactory<ExtensionSettingsHandler> weak_factory_; |
| 236 |
| 220 DISALLOW_COPY_AND_ASSIGN(ExtensionSettingsHandler); | 237 DISALLOW_COPY_AND_ASSIGN(ExtensionSettingsHandler); |
| 221 }; | 238 }; |
| 222 | 239 |
| 223 #endif // CHROME_BROWSER_UI_WEBUI_EXTENSIONS_EXTENSION_SETTINGS_HANDLER_H_ | 240 #endif // CHROME_BROWSER_UI_WEBUI_EXTENSIONS_EXTENSION_SETTINGS_HANDLER_H_ |
| OLD | NEW |