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

Side by Side Diff: chrome/browser/task_manager/task_manager_util.cc

Issue 120983002: Update some uses of UTF conversions in chrome/browser to use the base:: namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 12 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/task_manager_util.h" 5 #include "chrome/browser/task_manager/task_manager_util.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/i18n/rtl.h" 8 #include "base/i18n/rtl.h"
9 #include "base/strings/string16.h" 9 #include "base/strings/string16.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 else 59 else
60 return cache.GetNameOfProfileAtIndex(index); 60 return cache.GetNameOfProfileAtIndex(index);
61 } 61 }
62 62
63 base::string16 GetTitleFromWebContents(content::WebContents* web_contents) { 63 base::string16 GetTitleFromWebContents(content::WebContents* web_contents) {
64 DCHECK(web_contents); 64 DCHECK(web_contents);
65 65
66 base::string16 title = web_contents->GetTitle(); 66 base::string16 title = web_contents->GetTitle();
67 if (title.empty()) { 67 if (title.empty()) {
68 GURL url = web_contents->GetURL(); 68 GURL url = web_contents->GetURL();
69 title = UTF8ToUTF16(url.spec()); 69 title = base::UTF8ToUTF16(url.spec());
70 // Force URL to be LTR. 70 // Force URL to be LTR.
71 title = base::i18n::GetDisplayStringInLTRDirectionality(title); 71 title = base::i18n::GetDisplayStringInLTRDirectionality(title);
72 } else { 72 } else {
73 // Since the tab_title will be concatenated with 73 // Since the tab_title will be concatenated with
74 // IDS_TASK_MANAGER_TAB_PREFIX, we need to explicitly set the tab_title to 74 // IDS_TASK_MANAGER_TAB_PREFIX, we need to explicitly set the tab_title to
75 // be LTR format if there is no strong RTL charater in it. Otherwise, if 75 // be LTR format if there is no strong RTL charater in it. Otherwise, if
76 // IDS_TASK_MANAGER_TAB_PREFIX is an RTL word, the concatenated result 76 // IDS_TASK_MANAGER_TAB_PREFIX is an RTL word, the concatenated result
77 // might be wrong. For example, http://mail.yahoo.com, whose title is 77 // might be wrong. For example, http://mail.yahoo.com, whose title is
78 // "Yahoo! Mail: The best web-based Email!", without setting it explicitly 78 // "Yahoo! Mail: The best web-based Email!", without setting it explicitly
79 // as LTR format, the concatenated result will be "!Yahoo! Mail: The best 79 // as LTR format, the concatenated result will be "!Yahoo! Mail: The best
80 // web-based Email :BAT", in which the capital letters "BAT" stands for 80 // web-based Email :BAT", in which the capital letters "BAT" stands for
81 // the Hebrew word for "tab". 81 // the Hebrew word for "tab".
82 base::i18n::AdjustStringForLocaleDirection(&title); 82 base::i18n::AdjustStringForLocaleDirection(&title);
83 } 83 }
84 return title; 84 return title;
85 } 85 }
86 86
87 } // namespace util 87 } // namespace util
88 88
89 } // namespace task_manager 89 } // namespace task_manager
OLDNEW
« no previous file with comments | « chrome/browser/task_manager/task_manager_unittest.cc ('k') | chrome/browser/task_manager/worker_resource_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698