summaryrefslogtreecommitdiffstats
path: root/chrome/browser/task_manager
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-09 19:24:14 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-09 19:24:14 +0000
commit6faf7b1cc2d797140afd3df1211685307488cfcf (patch)
tree65eb681434792a9d5ff31714609efce599d1b37d /chrome/browser/task_manager
parentb2e88d83d0596926b6a71d459e6887b70b34e1fd (diff)
downloadchromium_src-6faf7b1cc2d797140afd3df1211685307488cfcf.zip
chromium_src-6faf7b1cc2d797140afd3df1211685307488cfcf.tar.gz
chromium_src-6faf7b1cc2d797140afd3df1211685307488cfcf.tar.bz2
Move ChildProcessHost and ChildProcessInfo to content.
TBR=avi Review URL: http://codereview.chromium.org/6612040 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@77496 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/task_manager')
-rw-r--r--chrome/browser/task_manager/task_manager_resource_providers.cc56
-rw-r--r--chrome/browser/task_manager/task_manager_resource_providers.h6
2 files changed, 60 insertions, 2 deletions
diff --git a/chrome/browser/task_manager/task_manager_resource_providers.cc b/chrome/browser/task_manager/task_manager_resource_providers.cc
index 1917d00..e2e5d14 100644
--- a/chrome/browser/task_manager/task_manager_resource_providers.cc
+++ b/chrome/browser/task_manager/task_manager_resource_providers.cc
@@ -642,7 +642,7 @@ TaskManagerChildProcessResource::~TaskManagerChildProcessResource() {
// TaskManagerResource methods:
string16 TaskManagerChildProcessResource::GetTitle() const {
if (title_.empty())
- title_ = child_process_.GetLocalizedTitle();
+ title_ = GetLocalizedTitle();
return title_;
}
@@ -693,6 +693,60 @@ void TaskManagerChildProcessResource::SetSupportNetworkUsage() {
network_usage_support_ = true;
}
+string16 TaskManagerChildProcessResource::GetLocalizedTitle() const {
+ string16 title = WideToUTF16Hack(child_process_.name());
+ if (child_process_.type() == ChildProcessInfo::PLUGIN_PROCESS &&
+ title.empty()) {
+ title = l10n_util::GetStringUTF16(IDS_TASK_MANAGER_UNKNOWN_PLUGIN_NAME);
+ }
+
+ // Explicitly mark name as LTR if there is no strong RTL character,
+ // to avoid the wrong concatenation result similar to "!Yahoo! Mail: the
+ // best web-based Email: NIGULP", in which "NIGULP" stands for the Hebrew
+ // or Arabic word for "plugin".
+ base::i18n::AdjustStringForLocaleDirection(&title);
+
+ switch (child_process_.type()) {
+ case ChildProcessInfo::UTILITY_PROCESS:
+ return l10n_util::GetStringUTF16(IDS_TASK_MANAGER_UTILITY_PREFIX);
+
+ case ChildProcessInfo::PROFILE_IMPORT_PROCESS:
+ return l10n_util::GetStringUTF16(IDS_TASK_MANAGER_UTILITY_PREFIX);
+
+ case ChildProcessInfo::GPU_PROCESS:
+ return l10n_util::GetStringUTF16(IDS_TASK_MANAGER_GPU_PREFIX);
+
+ case ChildProcessInfo::NACL_BROKER_PROCESS:
+ return l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NACL_BROKER_PREFIX);
+
+ case ChildProcessInfo::PLUGIN_PROCESS:
+ case ChildProcessInfo::PPAPI_PLUGIN_PROCESS: {
+ return l10n_util::GetStringFUTF16(
+ IDS_TASK_MANAGER_PLUGIN_PREFIX, title,
+ WideToUTF16Hack(child_process_.version()));
+ }
+
+ case ChildProcessInfo::NACL_LOADER_PROCESS:
+ return l10n_util::GetStringFUTF16(IDS_TASK_MANAGER_NACL_PREFIX, title);
+
+ case ChildProcessInfo::WORKER_PROCESS:
+ return l10n_util::GetStringFUTF16(IDS_TASK_MANAGER_WORKER_PREFIX, title);
+
+ // These types don't need display names or get them from elsewhere.
+ case ChildProcessInfo::BROWSER_PROCESS:
+ case ChildProcessInfo::RENDER_PROCESS:
+ case ChildProcessInfo::ZYGOTE_PROCESS:
+ case ChildProcessInfo::SANDBOX_HELPER_PROCESS:
+ NOTREACHED();
+ break;
+
+ case ChildProcessInfo::UNKNOWN_PROCESS:
+ NOTREACHED() << "Need localized name for child process type.";
+ }
+
+ return title;
+}
+
////////////////////////////////////////////////////////////////////////////////
// TaskManagerChildProcessResourceProvider class
////////////////////////////////////////////////////////////////////////////////
diff --git a/chrome/browser/task_manager/task_manager_resource_providers.h b/chrome/browser/task_manager/task_manager_resource_providers.h
index c1ce1eb..2f2972e 100644
--- a/chrome/browser/task_manager/task_manager_resource_providers.h
+++ b/chrome/browser/task_manager/task_manager_resource_providers.h
@@ -13,9 +13,9 @@
#include "base/compiler_specific.h"
#include "base/process_util.h"
#include "chrome/browser/task_manager/task_manager.h"
-#include "chrome/common/child_process_info.h"
#include "chrome/common/notification_observer.h"
#include "chrome/common/notification_registrar.h"
+#include "content/common/child_process_info.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebCache.h"
class BackgroundContents;
@@ -224,6 +224,10 @@ class TaskManagerChildProcessResource : public TaskManager::Resource {
int process_id() const { return pid_; }
private:
+ // Returns a localized title for the child process. For example, a plugin
+ // process would be "Plug-in: Flash" when name is "Flash".
+ string16 GetLocalizedTitle() const;
+
ChildProcessInfo child_process_;
int pid_;
mutable string16 title_;