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

Unified Diff: chrome/browser/task_manager/task_manager_resource_providers.cc

Issue 5526002: Show extension tabs in task manager and correctly label apps. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Adding NoticeAppTabs test. Created 10 years 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_manager/task_manager_resource_providers.cc
diff --git a/chrome/browser/task_manager/task_manager_resource_providers.cc b/chrome/browser/task_manager/task_manager_resource_providers.cc
index 2b339fa7a44673dce4b14ecfe503efcf5f3e168c..3317261efc9df258f82546ce9edb6e4071a0678e 100644
--- a/chrome/browser/task_manager/task_manager_resource_providers.cc
+++ b/chrome/browser/task_manager/task_manager_resource_providers.cc
@@ -50,6 +50,24 @@
#include "gfx/icon_util.h"
#endif // defined(OS_WIN)
+namespace {
+
+// Returns the appropriate message prefix ID for tabs and extensions,
+// reflecting whether they are apps or in incognito mode.
+int GetMessagePrefixID(bool is_app, bool is_extension,
+ bool is_off_the_record) {
+ return is_app ?
+ (is_off_the_record ?
+ IDS_TASK_MANAGER_APP_INCOGNITO_PREFIX :
+ IDS_TASK_MANAGER_APP_PREFIX) :
+ (is_extension ?
+ (is_off_the_record ?
+ IDS_TASK_MANAGER_EXTENSION_INCOGNITO_PREFIX :
+ IDS_TASK_MANAGER_EXTENSION_PREFIX) :
+ IDS_TASK_MANAGER_TAB_PREFIX);
+}
+
+} // namespace
////////////////////////////////////////////////////////////////////////////////
// TaskManagerRendererResource class
@@ -152,10 +170,12 @@ std::wstring TaskManagerTabContentsResource::GetTitle() const {
base::i18n::AdjustStringForLocaleDirection(&tab_title);
}
- return l10n_util::GetStringF(IDS_TASK_MANAGER_TAB_PREFIX, tab_title);
+ int message_id = GetMessagePrefixID(tab_contents_->IsInstalledApp(),
+ tab_contents_->HostsExtension(),
+ tab_contents_->profile()->IsOffTheRecord());
+ return l10n_util::GetStringF(message_id, tab_title);
}
-
SkBitmap TaskManagerTabContentsResource::GetIcon() const {
return tab_contents_->GetFavIcon();
}
@@ -267,11 +287,8 @@ void TaskManagerTabContentsResourceProvider::Add(TabContents* tab_contents) {
return;
// Don't add dead tabs or tabs that haven't yet connected.
- // Also ignore tabs which display extension content. We collapse
- // all of these into one extension row.
if (!tab_contents->GetRenderProcessHost()->GetHandle() ||
- !tab_contents->notify_disconnection() ||
- tab_contents->HostsExtension()) {
+ !tab_contents->notify_disconnection()) {
return;
}
@@ -826,14 +843,8 @@ TaskManagerExtensionProcessResource::TaskManagerExtensionProcessResource(
std::wstring extension_name(UTF8ToWide(GetExtension()->name()));
DCHECK(!extension_name.empty());
- int message_id =
- GetExtension()->is_app() ?
- (extension_host_->profile()->IsOffTheRecord() ?
- IDS_TASK_MANAGER_APP_INCOGNITO_PREFIX :
- IDS_TASK_MANAGER_APP_PREFIX) :
- (extension_host_->profile()->IsOffTheRecord() ?
- IDS_TASK_MANAGER_EXTENSION_INCOGNITO_PREFIX :
- IDS_TASK_MANAGER_EXTENSION_PREFIX);
+ int message_id = GetMessagePrefixID(GetExtension()->is_app(), true,
+ extension_host_->profile()->IsOffTheRecord());
title_ = l10n_util::GetStringF(message_id, extension_name);
}

Powered by Google App Engine
This is Rietveld 408576698