diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-11 23:55:10 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-11 23:55:10 +0000 |
commit | a27a938d8511abfaf89d6e2d0e4d4242c76dffed (patch) | |
tree | 98b133536459106b96a0ee09e0deb94b8d92c4b3 /chrome/common/child_process_info.cc | |
parent | 342c2c40bd1729fe985d5a6ee06f6eb28bbcdc22 (diff) | |
download | chromium_src-a27a938d8511abfaf89d6e2d0e4d4242c76dffed.zip chromium_src-a27a938d8511abfaf89d6e2d0e4d4242c76dffed.tar.gz chromium_src-a27a938d8511abfaf89d6e2d0e4d4242c76dffed.tar.bz2 |
Refactor plugin process code in the browser process so that the browser/about:memory/task manager/metrics code doesn't depend on PluginProcessHost pointers. In a future changelist I'll add one central child process registry in the browser process.
Review URL: http://codereview.chromium.org/20196
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9621 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/child_process_info.cc')
-rw-r--r-- | chrome/common/child_process_info.cc | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/chrome/common/child_process_info.cc b/chrome/common/child_process_info.cc new file mode 100644 index 0000000..ca777bd --- /dev/null +++ b/chrome/common/child_process_info.cc @@ -0,0 +1,51 @@ +// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/common/child_process_info.h" + +#include "base/logging.h" +#include "chrome/common/l10n_util.h" + +#include "generated_resources.h" + +std::wstring ChildProcessInfo::GetTypeNameInEnglish( + ChildProcessInfo::ProcessType type) { + switch (type) { + case BROWSER_PROCESS: + return L"Browser"; + case RENDER_PROCESS: + return L"Tab"; + case PLUGIN_PROCESS: + return L"Plug-in"; + case WORKER_PROCESS: + return L"Web Worker"; + case UNKNOWN_PROCESS: + default: + DCHECK(false) << "Unknown child process type!"; + return L"Unknown"; + } +} + +std::wstring ChildProcessInfo::GetLocalizedTitle() const { + std::wstring title = name_; + if (type_ == ChildProcessInfo::PLUGIN_PROCESS && title.empty()) + title = l10n_util::GetString(IDS_TASK_MANAGER_UNKNOWN_PLUGIN_NAME); + + int message_id; + if (type_ == ChildProcessInfo::PLUGIN_PROCESS) { + message_id = IDS_TASK_MANAGER_PLUGIN_PREFIX; + } else if (type_ == ChildProcessInfo::WORKER_PROCESS) { + message_id = IDS_TASK_MANAGER_WORKER_PREFIX; + } else { + DCHECK(false) << "Need localized name for child process type."; + return title; + } + + // 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". + l10n_util::AdjustStringForLocaleDirection(title, &title); + return l10n_util::GetStringF(message_id, title); +} |