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

Unified Diff: chrome/browser/task_management/providers/web_contents/extension_task.cc

Issue 2006423002: Task Manager: Make double-clicking on an extension do something useful. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@tm_selection
Patch Set: Lazily look up the extension. Created 4 years, 7 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/task_management/providers/web_contents/extension_task.cc
diff --git a/chrome/browser/task_management/providers/web_contents/extension_task.cc b/chrome/browser/task_management/providers/web_contents/extension_task.cc
index 9e6da132398dc92de57dfc0a6d46ab3a8f4b768e..f523a6182e3c7bf4691d34abad0eea7304e5fef0 100644
--- a/chrome/browser/task_management/providers/web_contents/extension_task.cc
+++ b/chrome/browser/task_management/providers/web_contents/extension_task.cc
@@ -5,8 +5,13 @@
#include "chrome/browser/task_management/providers/web_contents/extension_task.h"
#include "base/strings/utf_string_conversions.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_finder.h"
+#include "chrome/browser/ui/chrome_pages.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/web_contents.h"
+#include "extensions/browser/process_manager.h"
#include "extensions/browser/view_type_utils.h"
#include "extensions/common/constants.h"
#include "extensions/common/extension.h"
@@ -58,6 +63,32 @@ void ExtensionTask::UpdateFavicon() {
// extension.
}
+void ExtensionTask::Activate() {
+ // This task represents the extension view of (for example) a background page
+ // or browser action button, so there is no top-level window to bring to the
+ // front. Instead, when this task is double-clicked, we bring up the
+ // chrome://extensions page in a tab, and highlight the details for this
+ // extension.
+ //
+ // TODO(nick): For extensions::VIEW_TYPE_APP_WINDOW, and maybe others, there
+ // may actually be a window we could focus. Special case those here as needed.
+ const extensions::Extension* extension =
+ extensions::ProcessManager::Get(web_contents()->GetBrowserContext())
+ ->GetExtensionForWebContents(web_contents());
+
+ if (!extension)
+ return;
+
+ Browser* browser = chrome::FindTabbedBrowser(
+ Profile::FromBrowserContext(web_contents()->GetBrowserContext()), true);
+
+ // If an existing browser isn't found, don't create a new one.
+ if (!browser)
+ return;
+
+ chrome::ShowExtensions(browser, extension->id());
+}
+
Task::Type ExtensionTask::GetType() const {
return Task::EXTENSION;
}

Powered by Google App Engine
This is Rietveld 408576698