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

Unified Diff: content/browser/frame_host/interstitial_page_impl.cc

Issue 2086423005: Using WebContents::UpdateTitleForEntry() instead of NavigationEntry::SetTitle() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: DidFinishNavigation is received when RenderFrameHostImpl is destroyed!! Created 4 years, 6 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/frame_host/interstitial_page_impl.cc
diff --git a/content/browser/frame_host/interstitial_page_impl.cc b/content/browser/frame_host/interstitial_page_impl.cc
index 036f3ea83dfeef00e0cfb1b00977b31ffbb91307..583428933f0d7c358402fc9a4afdb82f935959f7 100644
--- a/content/browser/frame_host/interstitial_page_impl.cc
+++ b/content/browser/frame_host/interstitial_page_impl.cc
@@ -296,9 +296,10 @@ void InterstitialPageImpl::Hide() {
frame_tree_.root()->ResetForNewProcess();
controller_->delegate()->DetachInterstitialPage();
// Let's revert to the original title if necessary.
- NavigationEntry* entry = controller_->GetVisibleEntry();
+ NavigationEntryImpl* entry = controller_->GetVisibleEntry();
if (entry && !new_navigation_ && should_revert_web_contents_title_) {
- entry->SetTitle(original_web_contents_title_);
+ static_cast<WebContentsImpl*>(web_contents_)->UpdateTitleForEntry(
+ entry, original_web_contents_title_);
controller_->delegate()->NotifyNavigationStateChanged(
INVALIDATE_TYPE_TITLE);
Charlie Reis 2016/06/24 22:21:17 One way to make this cleaner would be to move Noti
afakhry 2016/06/27 14:29:18 I made it public, moved the call to NotifyNavigati
Charlie Reis 2016/06/28 21:13:31 If no one is listening to the return value, we sho
}
@@ -391,7 +392,7 @@ void InterstitialPageImpl::UpdateTitle(
RenderViewHost* render_view_host = render_frame_host->GetRenderViewHost();
DCHECK(render_view_host == render_view_host_);
- NavigationEntry* entry = controller_->GetVisibleEntry();
+ NavigationEntryImpl* entry = controller_->GetVisibleEntry();
if (!entry) {
// There may be no visible entry if no URL has committed (e.g., after
// window.open("")). InterstitialPages with the new_navigation flag create
@@ -410,7 +411,8 @@ void InterstitialPageImpl::UpdateTitle(
}
// TODO(evan): make use of title_direction.
// http://code.google.com/p/chromium/issues/detail?id=27094
- entry->SetTitle(title);
+ static_cast<WebContentsImpl*>(web_contents_)->UpdateTitleForEntry(entry,
+ title);
controller_->delegate()->NotifyNavigationStateChanged(INVALIDATE_TYPE_TITLE);
Charlie Reis 2016/06/24 22:21:17 Same here.
afakhry 2016/06/27 14:29:18 Done.
}
@@ -667,8 +669,18 @@ void InterstitialPageImpl::DontProceed() {
TakeActionOnResourceDispatcher(CANCEL);
if (should_discard_pending_nav_entry_) {
+ // Revert back to the last committed title (if any) before we discard the
+ // non-committed entries.
+ NavigationEntryImpl* last_committed_entry =
+ controller_->GetLastCommittedEntry();
+ if (last_committed_entry) {
+ NavigationEntryImpl* visible_entry = controller_->GetVisibleEntry();
Charlie Reis 2016/06/24 22:21:17 I think this might be wrong. In general, we shoul
afakhry 2016/06/27 14:29:18 We need this if we want TitleWasSet() to be emitte
Charlie Reis 2016/06/28 00:47:09 I feel like we're going about this the wrong way.
afakhry 2016/06/28 14:34:17 Yes, it happens as a result of calling: delegate_
Charlie Reis 2016/06/28 21:13:31 I see. This seems to boil down to WebContentsObse
+ static_cast<WebContentsImpl*>(web_contents_)->UpdateTitleForEntry(
+ visible_entry, last_committed_entry->GetTitle());
+ }
+
// Since no navigation happens we have to discard the transient entry
- // explicitely. Note that by calling DiscardNonCommittedEntries() we also
+ // explicitly. Note that by calling DiscardNonCommittedEntries() we also
// discard the pending entry, which is what we want, since the navigation is
// cancelled.
controller_->DiscardNonCommittedEntries();

Powered by Google App Engine
This is Rietveld 408576698