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

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

Issue 274883002: Move didReceiveTitle and related stuff to RenderFrame. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 7 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 e8f73a4b3be9a2f928e28934b329b37425f0db4f..8420209c934fd90e3b180ddfeaa7586f818e3aad 100644
--- a/content/browser/frame_host/interstitial_page_impl.cc
+++ b/content/browser/frame_host/interstitial_page_impl.cc
@@ -402,6 +402,42 @@ void InterstitialPageImpl::RenderFrameCreated(
render_frame_host);
}
+void InterstitialPageImpl::UpdateTitle(
+ RenderFrameHost* render_frame_host,
+ int32 page_id,
+ const base::string16& title,
+ base::i18n::TextDirection title_direction) {
+ if (!enabled())
+ return;
+
+ RenderViewHost* render_view_host = render_frame_host->GetRenderViewHost();
+ DCHECK(render_view_host == render_view_host_);
+ NavigationEntry* entry = controller_->GetVisibleEntry();
+ if (!entry) {
+ // Crash reports from the field indicate this can be NULL.
+ // This is unexpected as InterstitialPages constructed with the
+ // new_navigation flag set to true create a transient navigation entry
+ // (that is returned as the active entry). And the only case so far of
+ // interstitial created with that flag set to false is with the
+ // SafeBrowsingBlockingPage, when the resource triggering the interstitial
+ // is a sub-resource, meaning the main page has already been loaded and a
+ // navigation entry should have been created.
+ NOTREACHED();
+ return;
+ }
+
+ // If this interstitial is shown on an existing navigation entry, we'll need
+ // to remember its title so we can revert to it when hidden.
+ if (!new_navigation_ && !should_revert_web_contents_title_) {
+ original_web_contents_title_ = entry->GetTitle();
+ should_revert_web_contents_title_ = true;
+ }
+ // TODO(evan): make use of title_direction.
+ // http://code.google.com/p/chromium/issues/detail?id=27094
+ entry->SetTitle(title);
+ controller_->delegate()->NotifyNavigationStateChanged(INVALIDATE_TYPE_TITLE);
+}
+
RenderViewHostDelegateView* InterstitialPageImpl::GetDelegateView() {
return rvh_delegate_view_.get();
}
@@ -466,41 +502,6 @@ void InterstitialPageImpl::DidNavigate(
controller_->delegate()->GetRenderViewHost(), false, true, NULL);
}
-void InterstitialPageImpl::UpdateTitle(
- RenderViewHost* render_view_host,
- int32 page_id,
- const base::string16& title,
- base::i18n::TextDirection title_direction) {
- if (!enabled())
- return;
-
- DCHECK(render_view_host == render_view_host_);
- NavigationEntry* entry = controller_->GetVisibleEntry();
- if (!entry) {
- // Crash reports from the field indicate this can be NULL.
- // This is unexpected as InterstitialPages constructed with the
- // new_navigation flag set to true create a transient navigation entry
- // (that is returned as the active entry). And the only case so far of
- // interstitial created with that flag set to false is with the
- // SafeBrowsingBlockingPage, when the resource triggering the interstitial
- // is a sub-resource, meaning the main page has already been loaded and a
- // navigation entry should have been created.
- NOTREACHED();
- return;
- }
-
- // If this interstitial is shown on an existing navigation entry, we'll need
- // to remember its title so we can revert to it when hidden.
- if (!new_navigation_ && !should_revert_web_contents_title_) {
- original_web_contents_title_ = entry->GetTitle();
- should_revert_web_contents_title_ = true;
- }
- // TODO(evan): make use of title_direction.
- // http://code.google.com/p/chromium/issues/detail?id=27094
- entry->SetTitle(title);
- controller_->delegate()->NotifyNavigationStateChanged(INVALIDATE_TYPE_TITLE);
-}
-
RendererPreferences InterstitialPageImpl::GetRendererPrefs(
BrowserContext* browser_context) const {
delegate_->OverrideRendererPrefs(&renderer_preferences_);
« no previous file with comments | « content/browser/frame_host/interstitial_page_impl.h ('k') | content/browser/frame_host/render_frame_host_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698