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

Unified Diff: content/browser/tab_contents/navigation_entry.cc

Issue 6894009: Change NavigationEntry's title fields to carry the text direction. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/tab_contents/navigation_entry.cc
diff --git a/content/browser/tab_contents/navigation_entry.cc b/content/browser/tab_contents/navigation_entry.cc
index 01a8c77e6909b432cf4891fcba6b827b9f82ab52..cc5bdf763dd5449c1d907c463d19d5fa8009d379 100644
--- a/content/browser/tab_contents/navigation_entry.cc
+++ b/content/browser/tab_contents/navigation_entry.cc
@@ -54,7 +54,7 @@ NavigationEntry::NavigationEntry(SiteInstance* instance,
int page_id,
const GURL& url,
const GURL& referrer,
- const string16& title,
+ const base::i18n::String16WithDirection& title,
PageTransition::Type transition_type)
: unique_id_(GetUniqueID()),
site_instance_(instance),
@@ -76,16 +76,16 @@ void NavigationEntry::set_site_instance(SiteInstance* site_instance) {
site_instance_ = site_instance;
}
-const string16& NavigationEntry::GetTitleForDisplay(
+const base::i18n::String16WithDirection& NavigationEntry::GetTitleForDisplay(
const std::string& languages) {
// Most pages have real titles. Don't even bother caching anything if this is
// the case.
- if (!title_.empty())
+ if (!title_.is_empty())
return title_;
// More complicated cases will use the URLs as the title. This result we will
// cache since it's more complicated to compute.
- if (!cached_display_title_.empty())
+ if (!cached_display_title_.is_empty())
return cached_display_title_;
// Use the virtual URL first if any, and fall back on using the real URL.
@@ -103,7 +103,13 @@ const string16& NavigationEntry::GetTitleForDisplay(
title = title.substr(slashpos + 1);
}
- ui::ElideString(title, content::kMaxTitleChars, &cached_display_title_);
+ string16 elided_title;
+ ui::ElideString(title, content::kMaxTitleChars, &elided_title);
+
+ // The computed title is a URL or a filename; assume it's LTR.
+ cached_display_title_ =
+ base::i18n::String16WithDirection(elided_title,
+ base::i18n::LEFT_TO_RIGHT);
return cached_display_title_;
}
« no previous file with comments | « content/browser/tab_contents/navigation_entry.h ('k') | content/browser/tab_contents/navigation_entry_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698