summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-20 05:42:59 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-20 05:42:59 +0000
commitcb58c8cffe58b6cb0aa357998179b7b03b41a8ec (patch)
treee0c88b269414ab34252c709df7bbc2aad68c3128
parentf48ef0370d336fee1deb1c697c5c4d9b16e0c8d2 (diff)
downloadchromium_src-cb58c8cffe58b6cb0aa357998179b7b03b41a8ec.zip
chromium_src-cb58c8cffe58b6cb0aa357998179b7b03b41a8ec.tar.gz
chromium_src-cb58c8cffe58b6cb0aa357998179b7b03b41a8ec.tar.bz2
Show the extension name in the task manager for extension created worker processes.
BUG=30713 Review URL: http://codereview.chromium.org/2108015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@47776 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/net/chrome_url_request_context.cc10
-rw-r--r--chrome/browser/net/chrome_url_request_context.h9
-rw-r--r--chrome/browser/profile.cc1
-rw-r--r--chrome/browser/worker_host/worker_process_host.cc13
4 files changed, 31 insertions, 2 deletions
diff --git a/chrome/browser/net/chrome_url_request_context.cc b/chrome/browser/net/chrome_url_request_context.cc
index aff7ba3..e75921e 100644
--- a/chrome/browser/net/chrome_url_request_context.cc
+++ b/chrome/browser/net/chrome_url_request_context.cc
@@ -743,6 +743,15 @@ ChromeURLRequestContext::~ChromeURLRequestContext() {
cookie_policy_ = NULL;
}
+std::string ChromeURLRequestContext::GetNameForExtension(
+ const std::string& id) {
+ ExtensionInfoMap::iterator iter = extension_info_.find(id);
+ if (iter != extension_info_.end())
+ return iter->second->name;
+ else
+ return std::string();
+}
+
FilePath ChromeURLRequestContext::GetPathForExtension(const std::string& id) {
ExtensionInfoMap::iterator iter = extension_info_.find(id);
if (iter != extension_info_.end())
@@ -955,6 +964,7 @@ ChromeURLRequestContextFactory::ChromeURLRequestContextFactory(Profile* profile)
extension_info_[(*iter)->id()] =
linked_ptr<ChromeURLRequestContext::ExtensionInfo>(
new ChromeURLRequestContext::ExtensionInfo(
+ (*iter)->name(),
(*iter)->path(),
(*iter)->default_locale(),
(*iter)->web_extent(),
diff --git a/chrome/browser/net/chrome_url_request_context.h b/chrome/browser/net/chrome_url_request_context.h
index d437824..f43f971 100644
--- a/chrome/browser/net/chrome_url_request_context.h
+++ b/chrome/browser/net/chrome_url_request_context.h
@@ -47,12 +47,14 @@ class ChromeURLRequestContext : public URLRequestContext {
// could be immutable and ref-counted so that we could use them directly from
// both threads. There is only a small amount of mutable state in Extension.
struct ExtensionInfo {
- ExtensionInfo(const FilePath& path, const std::string& default_locale,
+ ExtensionInfo(const std::string& name, const FilePath& path,
+ const std::string& default_locale,
const ExtensionExtent& extent,
const std::vector<std::string>& api_permissions)
- : path(path), default_locale(default_locale),
+ : name(name), path(path), default_locale(default_locale),
extent(extent), api_permissions(api_permissions) {
}
+ const std::string name;
FilePath path;
std::string default_locale;
ExtensionExtent extent;
@@ -64,6 +66,9 @@ class ChromeURLRequestContext : public URLRequestContext {
ChromeURLRequestContext();
+ // Gets the name for the specified extension.
+ std::string GetNameForExtension(const std::string& id);
+
// Gets the path to the directory for the specified extension.
FilePath GetPathForExtension(const std::string& id);
diff --git a/chrome/browser/profile.cc b/chrome/browser/profile.cc
index c8a1559..c03553f 100644
--- a/chrome/browser/profile.cc
+++ b/chrome/browser/profile.cc
@@ -148,6 +148,7 @@ void PostExtensionLoadedToContextGetter(ChromeURLRequestContextGetter* getter,
&ChromeURLRequestContextGetter::OnNewExtensions,
extension->id(),
new ChromeURLRequestContext::ExtensionInfo(
+ extension->name(),
extension->path(),
extension->default_locale(),
extension->web_extent(),
diff --git a/chrome/browser/worker_host/worker_process_host.cc b/chrome/browser/worker_host/worker_process_host.cc
index 4c8a961..e7133bc 100644
--- a/chrome/browser/worker_host/worker_process_host.cc
+++ b/chrome/browser/worker_host/worker_process_host.cc
@@ -14,6 +14,8 @@
#include "base/string_util.h"
#include "chrome/browser/chrome_thread.h"
#include "chrome/browser/child_process_security_policy.h"
+#include "chrome/browser/net/chrome_url_request_context.h"
+#include "chrome/browser/profile.h"
#include "chrome/browser/renderer_host/database_dispatcher_host.h"
#include "chrome/browser/renderer_host/render_view_host.h"
#include "chrome/browser/renderer_host/render_view_host_delegate.h"
@@ -417,6 +419,17 @@ void WorkerProcessHost::UpdateTitle() {
// Use the host name if the domain is empty, i.e. localhost or IP address.
if (title.empty())
title = i->url().host();
+
+ // Check if it's an extension-created worker, in which case we want to use
+ // the name of the extension.
+ std::string extension_name = static_cast<ChromeURLRequestContext*>(
+ Profile::GetDefaultRequestContext()->GetURLRequestContext())->
+ GetNameForExtension(title);
+ if (!extension_name.empty()) {
+ titles.insert(extension_name);
+ continue;
+ }
+
// If the host name is empty, i.e. file url, use the path.
if (title.empty())
title = i->url().path();