Chromium Code Reviews| 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); |
| } |