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