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

Side by Side Diff: chrome/browser/task_manager_resource_providers.cc

Issue 1073005: Move RTL related functions from app/l10n_util to base/i18n/rtl... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/task_manager.cc ('k') | chrome/browser/views/about_chrome_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/task_manager_resource_providers.h" 5 #include "chrome/browser/task_manager_resource_providers.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 8
9 #include "app/l10n_util.h" 9 #include "app/l10n_util.h"
10 #include "app/resource_bundle.h" 10 #include "app/resource_bundle.h"
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/file_version_info.h" 12 #include "base/file_version_info.h"
13 #include "base/i18n/rtl.h"
13 #include "base/process_util.h" 14 #include "base/process_util.h"
14 #include "base/stl_util-inl.h" 15 #include "base/stl_util-inl.h"
15 #include "base/string_util.h" 16 #include "base/string_util.h"
16 #include "base/thread.h" 17 #include "base/thread.h"
17 #include "chrome/app/chrome_dll_resource.h" 18 #include "chrome/app/chrome_dll_resource.h"
18 #include "chrome/browser/browser_process.h" 19 #include "chrome/browser/browser_process.h"
19 #include "chrome/browser/browser_list.h" 20 #include "chrome/browser/browser_list.h"
20 #include "chrome/browser/child_process_host.h" 21 #include "chrome/browser/child_process_host.h"
21 #include "chrome/browser/chrome_thread.h" 22 #include "chrome/browser/chrome_thread.h"
22 #include "chrome/browser/extensions/extension_host.h" 23 #include "chrome/browser/extensions/extension_host.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 67
67 TaskManagerTabContentsResource::~TaskManagerTabContentsResource() { 68 TaskManagerTabContentsResource::~TaskManagerTabContentsResource() {
68 } 69 }
69 70
70 std::wstring TaskManagerTabContentsResource::GetTitle() const { 71 std::wstring TaskManagerTabContentsResource::GetTitle() const {
71 // Fall back on the URL if there's no title. 72 // Fall back on the URL if there's no title.
72 std::wstring tab_title(UTF16ToWideHack(tab_contents_->GetTitle())); 73 std::wstring tab_title(UTF16ToWideHack(tab_contents_->GetTitle()));
73 if (tab_title.empty()) { 74 if (tab_title.empty()) {
74 tab_title = UTF8ToWide(tab_contents_->GetURL().spec()); 75 tab_title = UTF8ToWide(tab_contents_->GetURL().spec());
75 // Force URL to be LTR. 76 // Force URL to be LTR.
76 if (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) 77 if (base::i18n::IsRTL())
77 l10n_util::WrapStringWithLTRFormatting(&tab_title); 78 base::i18n::WrapStringWithLTRFormatting(&tab_title);
78 } else { 79 } else {
79 // Since the tab_title will be concatenated with 80 // Since the tab_title will be concatenated with
80 // IDS_TASK_MANAGER_TAB_PREFIX, we need to explicitly set the tab_title to 81 // IDS_TASK_MANAGER_TAB_PREFIX, we need to explicitly set the tab_title to
81 // be LTR format if there is no strong RTL charater in it. Otherwise, if 82 // be LTR format if there is no strong RTL charater in it. Otherwise, if
82 // IDS_TASK_MANAGER_TAB_PREFIX is an RTL word, the concatenated result 83 // IDS_TASK_MANAGER_TAB_PREFIX is an RTL word, the concatenated result
83 // might be wrong. For example, http://mail.yahoo.com, whose title is 84 // might be wrong. For example, http://mail.yahoo.com, whose title is
84 // "Yahoo! Mail: The best web-based Email!", without setting it explicitly 85 // "Yahoo! Mail: The best web-based Email!", without setting it explicitly
85 // as LTR format, the concatenated result will be "!Yahoo! Mail: The best 86 // as LTR format, the concatenated result will be "!Yahoo! Mail: The best
86 // web-based Email :BAT", in which the capital letters "BAT" stands for 87 // web-based Email :BAT", in which the capital letters "BAT" stands for
87 // the Hebrew word for "tab". 88 // the Hebrew word for "tab".
88 l10n_util::AdjustStringForLocaleDirection(tab_title, &tab_title); 89 base::i18n::AdjustStringForLocaleDirection(tab_title, &tab_title);
89 } 90 }
90 91
91 return l10n_util::GetStringF(IDS_TASK_MANAGER_TAB_PREFIX, tab_title); 92 return l10n_util::GetStringF(IDS_TASK_MANAGER_TAB_PREFIX, tab_title);
92 } 93 }
93 94
94 void TaskManagerTabContentsResource::Refresh() { 95 void TaskManagerTabContentsResource::Refresh() {
95 if (!pending_stats_update_) { 96 if (!pending_stats_update_) {
96 tab_contents_->render_view_host()->Send(new ViewMsg_GetCacheResourceStats); 97 tab_contents_->render_view_host()->Send(new ViewMsg_GetCacheResourceStats);
97 pending_stats_update_ = true; 98 pending_stats_update_ = true;
98 } 99 }
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 pid_ = base::GetProcId(process_handle_); 526 pid_ = base::GetProcId(process_handle_);
526 std::wstring extension_name(UTF8ToWide(GetExtension()->name())); 527 std::wstring extension_name(UTF8ToWide(GetExtension()->name()));
527 DCHECK(!extension_name.empty()); 528 DCHECK(!extension_name.empty());
528 // Since the extension_name will be concatenated with a prefix, we need 529 // Since the extension_name will be concatenated with a prefix, we need
529 // to explicitly set the extension_name to be LTR format if there is no 530 // to explicitly set the extension_name to be LTR format if there is no
530 // strong RTL charater in it. Otherwise, if the prefix is an RTL word, 531 // strong RTL charater in it. Otherwise, if the prefix is an RTL word,
531 // the concatenated result might be wrong. For extension named 532 // the concatenated result might be wrong. For extension named
532 // "Great Extension!" the concatenated result would be something like 533 // "Great Extension!" the concatenated result would be something like
533 // "!Great Extension :NOISNETXE", in which capital letters "NOISNETXE" 534 // "!Great Extension :NOISNETXE", in which capital letters "NOISNETXE"
534 // stand for the Hebrew word for "extension". 535 // stand for the Hebrew word for "extension".
535 l10n_util::AdjustStringForLocaleDirection(extension_name, &extension_name); 536 base::i18n::AdjustStringForLocaleDirection(extension_name, &extension_name);
536 title_ = l10n_util::GetStringF(IDS_TASK_MANAGER_EXTENSION_PREFIX, 537 title_ = l10n_util::GetStringF(IDS_TASK_MANAGER_EXTENSION_PREFIX,
537 extension_name); 538 extension_name);
538 } 539 }
539 540
540 TaskManagerExtensionProcessResource::~TaskManagerExtensionProcessResource() { 541 TaskManagerExtensionProcessResource::~TaskManagerExtensionProcessResource() {
541 } 542 }
542 543
543 std::wstring TaskManagerExtensionProcessResource::GetTitle() const { 544 std::wstring TaskManagerExtensionProcessResource::GetTitle() const {
544 return title_; 545 return title_;
545 } 546 }
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
775 776
776 return &resource_; 777 return &resource_;
777 } 778 }
778 779
779 void TaskManagerBrowserProcessResourceProvider::StartUpdating() { 780 void TaskManagerBrowserProcessResourceProvider::StartUpdating() {
780 task_manager_->AddResource(&resource_); 781 task_manager_->AddResource(&resource_);
781 } 782 }
782 783
783 void TaskManagerBrowserProcessResourceProvider::StopUpdating() { 784 void TaskManagerBrowserProcessResourceProvider::StopUpdating() {
784 } 785 }
OLDNEW
« no previous file with comments | « chrome/browser/task_manager.cc ('k') | chrome/browser/views/about_chrome_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698