| 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 950490043140f1c9594b2cb3aabc20394d415c81..a48dfd7a6e6cd1300350d18ae55695100ef6a496 100644
|
| --- a/content/browser/web_contents/web_contents_impl.cc
|
| +++ b/content/browser/web_contents/web_contents_impl.cc
|
| @@ -756,11 +756,22 @@ const string16& WebContentsImpl::GetTitle() const {
|
| // 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();
|
| + // We make an exception for initial navigations.
|
| + if (controller_.IsInitialNavigation()) {
|
| + // We only want to use the title from the visible entry in one of two cases:
|
| + // 1. There's already a committed entry for an initial navigation, in which
|
| + // case we are doing a history navigation in a new tab (e.g., Ctrl+Back).
|
| + // 2. The pending entry has been explicitly assigned a title to display.
|
| + //
|
| + // If there's no last committed entry and no assigned title, we should fall
|
| + // back to |page_title_when_no_navigation_entry_| rather than showing the
|
| + // URL.
|
| + if (entry ||
|
| + (controller_.GetVisibleEntry() &&
|
| + !controller_.GetVisibleEntry()->GetTitle().empty())) {
|
| + entry = controller_.GetVisibleEntry();
|
| + }
|
| + }
|
|
|
| if (entry) {
|
| return entry->GetTitleForDisplay(accept_languages);
|
|
|