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

Side by Side Diff: content/browser/web_contents/web_contents_impl.cc

Issue 1094153002: Move ClosePage() from RenderViewHost to WebContents. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix chromecast android compile failure. Created 5 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/web_contents/web_contents_impl.h" 5 #include "content/browser/web_contents/web_contents_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after
668 if (!GetRenderViewHost()) 668 if (!GetRenderViewHost())
669 return MSG_ROUTING_NONE; 669 return MSG_ROUTING_NONE;
670 670
671 return GetRenderViewHost()->GetRoutingID(); 671 return GetRenderViewHost()->GetRoutingID();
672 } 672 }
673 673
674 int WebContentsImpl::GetFullscreenWidgetRoutingID() const { 674 int WebContentsImpl::GetFullscreenWidgetRoutingID() const {
675 return fullscreen_widget_routing_id_; 675 return fullscreen_widget_routing_id_;
676 } 676 }
677 677
678 void WebContentsImpl::ClosePage() {
679 GetRenderViewHost()->ClosePage();
680 }
681
678 RenderWidgetHostView* WebContentsImpl::GetRenderWidgetHostView() const { 682 RenderWidgetHostView* WebContentsImpl::GetRenderWidgetHostView() const {
679 return GetRenderManager()->GetRenderWidgetHostView(); 683 return GetRenderManager()->GetRenderWidgetHostView();
680 } 684 }
681 685
682 RenderWidgetHostView* WebContentsImpl::GetFullscreenRenderWidgetHostView() 686 RenderWidgetHostView* WebContentsImpl::GetFullscreenRenderWidgetHostView()
683 const { 687 const {
684 RenderWidgetHost* const widget_host = 688 RenderWidgetHost* const widget_host =
685 RenderWidgetHostImpl::FromID(GetRenderProcessHost()->GetID(), 689 RenderWidgetHostImpl::FromID(GetRenderProcessHost()->GetID(),
686 GetFullscreenWidgetRoutingID()); 690 GetFullscreenWidgetRoutingID());
687 return widget_host ? widget_host->GetView() : NULL; 691 return widget_host ? widget_host->GetView() : NULL;
(...skipping 3195 matching lines...) Expand 10 before | Expand all | Expand 10 after
3883 void WebContentsImpl::UpdateEncoding(RenderFrameHost* render_frame_host, 3887 void WebContentsImpl::UpdateEncoding(RenderFrameHost* render_frame_host,
3884 const std::string& encoding) { 3888 const std::string& encoding) {
3885 SetEncoding(encoding); 3889 SetEncoding(encoding);
3886 } 3890 }
3887 3891
3888 void WebContentsImpl::DocumentAvailableInMainFrame( 3892 void WebContentsImpl::DocumentAvailableInMainFrame(
3889 RenderViewHost* render_view_host) { 3893 RenderViewHost* render_view_host) {
3890 FOR_EACH_OBSERVER(WebContentsObserver, observers_, 3894 FOR_EACH_OBSERVER(WebContentsObserver, observers_,
3891 DocumentAvailableInMainFrame()); 3895 DocumentAvailableInMainFrame());
3892 } 3896 }
3897
3893 void WebContentsImpl::RouteCloseEvent(RenderViewHost* rvh) { 3898 void WebContentsImpl::RouteCloseEvent(RenderViewHost* rvh) {
3894 // Tell the active RenderViewHost to run unload handlers and close, as long 3899 // Tell the active RenderViewHost to run unload handlers and close, as long
3895 // as the request came from a RenderViewHost in the same BrowsingInstance. 3900 // as the request came from a RenderViewHost in the same BrowsingInstance.
3896 // In most cases, we receive this from a swapped out RenderViewHost. 3901 // In most cases, we receive this from a swapped out RenderViewHost.
3897 // It is possible to receive it from one that has just been swapped in, 3902 // It is possible to receive it from one that has just been swapped in,
3898 // in which case we might as well deliver the message anyway. 3903 // in which case we might as well deliver the message anyway.
3899 if (rvh->GetSiteInstance()->IsRelatedSiteInstance(GetSiteInstance())) 3904 if (rvh->GetSiteInstance()->IsRelatedSiteInstance(GetSiteInstance()))
3900 GetRenderViewHost()->ClosePage(); 3905 ClosePage();
3901 } 3906 }
3902 3907
3903 bool WebContentsImpl::ShouldRouteMessageEvent( 3908 bool WebContentsImpl::ShouldRouteMessageEvent(
3904 RenderFrameHost* target_rfh, 3909 RenderFrameHost* target_rfh,
3905 SiteInstance* source_site_instance) const { 3910 SiteInstance* source_site_instance) const {
3906 // Allow the message if this WebContents is dedicated to a browser plugin 3911 // Allow the message if this WebContents is dedicated to a browser plugin
3907 // guest. 3912 // guest.
3908 // Note: This check means that an embedder could theoretically receive a 3913 // Note: This check means that an embedder could theoretically receive a
3909 // postMessage from anyone (not just its own guests). However, this is 3914 // postMessage from anyone (not just its own guests). However, this is
3910 // probably not a risk for apps since other pages won't have references 3915 // probably not a risk for apps since other pages won't have references
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
4422 node->render_manager()->ResumeResponseDeferredAtStart(); 4427 node->render_manager()->ResumeResponseDeferredAtStart();
4423 } 4428 }
4424 4429
4425 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { 4430 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) {
4426 force_disable_overscroll_content_ = force_disable; 4431 force_disable_overscroll_content_ = force_disable;
4427 if (view_) 4432 if (view_)
4428 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); 4433 view_->SetOverscrollControllerEnabled(CanOverscrollContent());
4429 } 4434 }
4430 4435
4431 } // namespace content 4436 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_contents_impl.h ('k') | content/public/browser/render_view_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698