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

Unified Diff: content/browser/web_contents/web_contents_impl.cc

Issue 78443005: New Tab: fix tab title flickering. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Clean up change. Created 7 years, 1 month 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/web_contents/web_contents_impl.cc
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 05c685391a67e294fe153da8b23a69902b0ded00..2f96d77fe3d7ae875ffb38efd3b11d479becef09 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -750,18 +750,22 @@ const string16& WebContentsImpl::GetTitle() const {
}
}
+ // For initial navigations, use the title from the initial pending entry if it
+ // has a title set. This can happen, for example, when doing a history
+ // navigation in a new tab, such as Ctrl+Back.
+ entry = controller_.GetVisibleEntry();
+ if (entry && controller_.IsInitialNavigation()) {
+ const string16& title = entry->GetTitleForDisplay(accept_languages);
Charlie Reis 2013/11/22 23:19:12 This isn't quite right. GetTitleForDisplay will r
samarth 2013/11/25 15:32:13 Done, thanks.
+ if (!title.empty())
+ return title;
+ }
+
// We use the title for the last committed entry rather than a pending
// navigation entry. For example, when the user types in a URL, we want to
// keep the old page's title until the new load has committed and we get a new
// title.
entry = controller_.GetLastCommittedEntry();
- // We make an exception for initial navigations, because we can have a
- // committed entry for an initial navigation when doing a history navigation
- // in a new tab, such as Ctrl+Back.
- if (entry && controller_.IsInitialNavigation())
- entry = controller_.GetVisibleEntry();
-
if (entry) {
return entry->GetTitleForDisplay(accept_languages);
}

Powered by Google App Engine
This is Rietveld 408576698