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

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

Issue 2086423005: Using WebContents::UpdateTitleForEntry() instead of NavigationEntry::SetTitle() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Improving comment and removing the NOTREACHED. Created 4 years, 5 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/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 9b445c8815676eb6171b6d95b893621abf2a7478..8facc1cce53b243076e164dd366112ca66a89ed4 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -3893,7 +3893,7 @@ void WebContentsImpl::UpdateMaxPageIDIfNecessary(RenderViewHost* rvh) {
max_restored_page_id);
}
-bool WebContentsImpl::UpdateTitleForEntry(NavigationEntryImpl* entry,
+void WebContentsImpl::UpdateTitleForEntry(NavigationEntry* entry,
const base::string16& title) {
// For file URLs without a title, use the pathname instead. In the case of a
// synthesized title, we don't want the update to count toward the "one set
@@ -3913,12 +3913,12 @@ bool WebContentsImpl::UpdateTitleForEntry(NavigationEntryImpl* entry,
// |page_title_when_no_navigation_entry_| will be used for page title.
if (entry) {
if (final_title == entry->GetTitle())
- return false; // Nothing changed, don't bother.
+ return; // Nothing changed, don't bother.
entry->SetTitle(final_title);
} else {
if (page_title_when_no_navigation_entry_ == final_title)
- return false; // Nothing changed, don't bother.
+ return; // Nothing changed, don't bother.
page_title_when_no_navigation_entry_ = final_title;
}
@@ -3929,7 +3929,9 @@ bool WebContentsImpl::UpdateTitleForEntry(NavigationEntryImpl* entry,
FOR_EACH_OBSERVER(WebContentsObserver, observers_,
TitleWasSet(entry, explicit_set));
- return true;
+ // Broadcast notifications when the UI should be updated.
+ if (entry == controller_.GetEntryAtOffset(0))
+ NotifyNavigationStateChanged(INVALIDATE_TYPE_TITLE);
}
void WebContentsImpl::SendChangeLoadProgress() {
@@ -4535,12 +4537,7 @@ void WebContentsImpl::UpdateTitle(RenderFrameHost* render_frame_host,
// TODO(evan): make use of title_direction.
// http://code.google.com/p/chromium/issues/detail?id=27094
- if (!UpdateTitleForEntry(entry, title))
- return;
-
- // Broadcast notifications when the UI should be updated.
- if (entry == controller_.GetEntryAtOffset(0))
- NotifyNavigationStateChanged(INVALIDATE_TYPE_TITLE);
+ UpdateTitleForEntry(entry, title);
}
void WebContentsImpl::UpdateEncoding(RenderFrameHost* render_frame_host,

Powered by Google App Engine
This is Rietveld 408576698