Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3146)

Unified Diff: chrome/browser/ui/webui/extensions/extension_settings_handler.h

Issue 10641017: make "reload" on chrome://extensions automatically relaunch running apps (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: hack Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/webui/extensions/extension_settings_handler.h
diff --git a/chrome/browser/ui/webui/extensions/extension_settings_handler.h b/chrome/browser/ui/webui/extensions/extension_settings_handler.h
index bbe504d95f9195107903d95611652f11794bf31b..7785e601956439dcc44f9d4b51445ca63613d030 100644
--- a/chrome/browser/ui/webui/extensions/extension_settings_handler.h
+++ b/chrome/browser/ui/webui/extensions/extension_settings_handler.h
@@ -10,6 +10,7 @@
#include <vector>
#include "base/memory/scoped_ptr.h"
+#include "base/memory/weak_ptr.h"
#include "chrome/browser/extensions/extension_install_ui.h"
#include "chrome/browser/extensions/extension_uninstall_dialog.h"
#include "chrome/browser/extensions/extension_warning_set.h"
@@ -104,6 +105,9 @@ class ExtensionSettingsHandler : public content::WebUIMessageHandler,
const content::NotificationSource& source,
const content::NotificationDetails& details) OVERRIDE;
+ // Launches the application described by |extension_id|.
+ void LaunchApplication(extensions::ExtensionHost* extension_host);
+
// ExtensionUninstallDialog::Delegate implementation, used for receiving
// notification about uninstall confirmation dialog selections.
virtual void ExtensionUninstallAccepted() OVERRIDE;
@@ -112,6 +116,9 @@ class ExtensionSettingsHandler : public content::WebUIMessageHandler,
// Helper method that reloads all unpacked extensions.
void ReloadUnpackedExtensions();
+ // Reloads the given extension.
+ void ReloadExtension(const extensions::Extension* extension);
+
// Callback for "requestExtensionsData" message.
void HandleRequestExtensionsData(const base::ListValue* args);
@@ -212,11 +219,21 @@ class ExtensionSettingsHandler : public content::WebUIMessageHandler,
// we do so only once.
bool registered_for_notifications_;
+ // The set of apps for which we have triggered reload. They will be
+ // re-launched when loaded again. The boolean tracks whether they have been
+ // enabled (whether NOTIFICATION_EXTENSION_ENABLED has been dispatched). This
+ // hack is necessary because reloading an extension causes multiple LOADED
+ // notifications, but we only care about the one that comes after ENABLED.
+ typedef std::map<std::string, bool> RelaunchApps;
+ RelaunchApps relaunch_app_ids_;
+
content::NotificationRegistrar registrar_;
PrefChangeRegistrar pref_registrar_;
PrefChangeRegistrar local_state_pref_registrar_;
+ base::WeakPtrFactory<ExtensionSettingsHandler> weak_factory_;
+
DISALLOW_COPY_AND_ASSIGN(ExtensionSettingsHandler);
};

Powered by Google App Engine
This is Rietveld 408576698