OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 | 70 |
71 TaskManagerTabContentsResource::~TaskManagerTabContentsResource() { | 71 TaskManagerTabContentsResource::~TaskManagerTabContentsResource() { |
72 } | 72 } |
73 | 73 |
74 std::wstring TaskManagerTabContentsResource::GetTitle() const { | 74 std::wstring TaskManagerTabContentsResource::GetTitle() const { |
75 // Fall back on the URL if there's no title. | 75 // Fall back on the URL if there's no title. |
76 std::wstring tab_title(UTF16ToWideHack(tab_contents_->GetTitle())); | 76 std::wstring tab_title(UTF16ToWideHack(tab_contents_->GetTitle())); |
77 if (tab_title.empty()) { | 77 if (tab_title.empty()) { |
78 tab_title = UTF8ToWide(tab_contents_->GetURL().spec()); | 78 tab_title = UTF8ToWide(tab_contents_->GetURL().spec()); |
79 // Force URL to be LTR. | 79 // Force URL to be LTR. |
80 base::i18n::GetDisplayStringInLTRDirectionality(&tab_title); | 80 tab_title = UTF16ToWide(base::i18n::GetDisplayStringInLTRDirectionality( |
| 81 WideToUTF16(tab_title))); |
81 } else { | 82 } else { |
82 // Since the tab_title will be concatenated with | 83 // Since the tab_title will be concatenated with |
83 // IDS_TASK_MANAGER_TAB_PREFIX, we need to explicitly set the tab_title to | 84 // IDS_TASK_MANAGER_TAB_PREFIX, we need to explicitly set the tab_title to |
84 // be LTR format if there is no strong RTL charater in it. Otherwise, if | 85 // be LTR format if there is no strong RTL charater in it. Otherwise, if |
85 // IDS_TASK_MANAGER_TAB_PREFIX is an RTL word, the concatenated result | 86 // IDS_TASK_MANAGER_TAB_PREFIX is an RTL word, the concatenated result |
86 // might be wrong. For example, http://mail.yahoo.com, whose title is | 87 // might be wrong. For example, http://mail.yahoo.com, whose title is |
87 // "Yahoo! Mail: The best web-based Email!", without setting it explicitly | 88 // "Yahoo! Mail: The best web-based Email!", without setting it explicitly |
88 // as LTR format, the concatenated result will be "!Yahoo! Mail: The best | 89 // as LTR format, the concatenated result will be "!Yahoo! Mail: The best |
89 // web-based Email :BAT", in which the capital letters "BAT" stands for | 90 // web-based Email :BAT", in which the capital letters "BAT" stands for |
90 // the Hebrew word for "tab". | 91 // the Hebrew word for "tab". |
(...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
905 | 906 |
906 return &resource_; | 907 return &resource_; |
907 } | 908 } |
908 | 909 |
909 void TaskManagerBrowserProcessResourceProvider::StartUpdating() { | 910 void TaskManagerBrowserProcessResourceProvider::StartUpdating() { |
910 task_manager_->AddResource(&resource_); | 911 task_manager_->AddResource(&resource_); |
911 } | 912 } |
912 | 913 |
913 void TaskManagerBrowserProcessResourceProvider::StopUpdating() { | 914 void TaskManagerBrowserProcessResourceProvider::StopUpdating() { |
914 } | 915 } |
OLD | NEW |