OLD | NEW |
---|---|
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 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
674 if (!GetRenderViewHost()) | 674 if (!GetRenderViewHost()) |
675 return MSG_ROUTING_NONE; | 675 return MSG_ROUTING_NONE; |
676 | 676 |
677 return GetRenderViewHost()->GetRoutingID(); | 677 return GetRenderViewHost()->GetRoutingID(); |
678 } | 678 } |
679 | 679 |
680 int WebContentsImpl::GetFullscreenWidgetRoutingID() const { | 680 int WebContentsImpl::GetFullscreenWidgetRoutingID() const { |
681 return fullscreen_widget_routing_id_; | 681 return fullscreen_widget_routing_id_; |
682 } | 682 } |
683 | 683 |
684 void WebContentsImpl::ClosePage() { | |
685 static_cast<RenderViewHostImpl*>(GetRenderViewHost())->ClosePage(); | |
Charlie Reis
2015/04/21 17:28:08
GetRenderViewHostImpl() would take care of the cas
nasko
2015/04/29 17:09:27
Thank you!
| |
686 } | |
687 | |
684 RenderWidgetHostView* WebContentsImpl::GetRenderWidgetHostView() const { | 688 RenderWidgetHostView* WebContentsImpl::GetRenderWidgetHostView() const { |
685 return GetRenderManager()->GetRenderWidgetHostView(); | 689 return GetRenderManager()->GetRenderWidgetHostView(); |
686 } | 690 } |
687 | 691 |
688 RenderWidgetHostView* WebContentsImpl::GetFullscreenRenderWidgetHostView() | 692 RenderWidgetHostView* WebContentsImpl::GetFullscreenRenderWidgetHostView() |
689 const { | 693 const { |
690 RenderWidgetHost* const widget_host = | 694 RenderWidgetHost* const widget_host = |
691 RenderWidgetHostImpl::FromID(GetRenderProcessHost()->GetID(), | 695 RenderWidgetHostImpl::FromID(GetRenderProcessHost()->GetID(), |
692 GetFullscreenWidgetRoutingID()); | 696 GetFullscreenWidgetRoutingID()); |
693 return widget_host ? widget_host->GetView() : NULL; | 697 return widget_host ? widget_host->GetView() : NULL; |
(...skipping 3302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3996 void WebContentsImpl::UpdateEncoding(RenderFrameHost* render_frame_host, | 4000 void WebContentsImpl::UpdateEncoding(RenderFrameHost* render_frame_host, |
3997 const std::string& encoding) { | 4001 const std::string& encoding) { |
3998 SetEncoding(encoding); | 4002 SetEncoding(encoding); |
3999 } | 4003 } |
4000 | 4004 |
4001 void WebContentsImpl::DocumentAvailableInMainFrame( | 4005 void WebContentsImpl::DocumentAvailableInMainFrame( |
4002 RenderViewHost* render_view_host) { | 4006 RenderViewHost* render_view_host) { |
4003 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 4007 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
4004 DocumentAvailableInMainFrame()); | 4008 DocumentAvailableInMainFrame()); |
4005 } | 4009 } |
4006 void WebContentsImpl::RouteCloseEvent(RenderViewHost* rvh) { | 4010 void WebContentsImpl::RouteCloseEvent(RenderViewHost* rvh) { |
Charlie Reis
2015/04/21 17:28:08
nit: Blank line before, as long as we're changing
nasko
2015/04/29 17:09:27
Done.
| |
4007 // Tell the active RenderViewHost to run unload handlers and close, as long | 4011 // Tell the active RenderViewHost to run unload handlers and close, as long |
4008 // as the request came from a RenderViewHost in the same BrowsingInstance. | 4012 // as the request came from a RenderViewHost in the same BrowsingInstance. |
4009 // In most cases, we receive this from a swapped out RenderViewHost. | 4013 // In most cases, we receive this from a swapped out RenderViewHost. |
4010 // It is possible to receive it from one that has just been swapped in, | 4014 // It is possible to receive it from one that has just been swapped in, |
4011 // in which case we might as well deliver the message anyway. | 4015 // in which case we might as well deliver the message anyway. |
4012 if (rvh->GetSiteInstance()->IsRelatedSiteInstance(GetSiteInstance())) | 4016 if (rvh->GetSiteInstance()->IsRelatedSiteInstance(GetSiteInstance())) |
4013 GetRenderViewHost()->ClosePage(); | 4017 ClosePage(); |
4014 } | 4018 } |
4015 | 4019 |
4016 bool WebContentsImpl::ShouldRouteMessageEvent( | 4020 bool WebContentsImpl::ShouldRouteMessageEvent( |
4017 RenderFrameHost* target_rfh, | 4021 RenderFrameHost* target_rfh, |
4018 SiteInstance* source_site_instance) const { | 4022 SiteInstance* source_site_instance) const { |
4019 // Allow the message if this WebContents is dedicated to a browser plugin | 4023 // Allow the message if this WebContents is dedicated to a browser plugin |
4020 // guest. | 4024 // guest. |
4021 // Note: This check means that an embedder could theoretically receive a | 4025 // Note: This check means that an embedder could theoretically receive a |
4022 // postMessage from anyone (not just its own guests). However, this is | 4026 // postMessage from anyone (not just its own guests). However, this is |
4023 // probably not a risk for apps since other pages won't have references | 4027 // probably not a risk for apps since other pages won't have references |
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4537 node->render_manager()->ResumeResponseDeferredAtStart(); | 4541 node->render_manager()->ResumeResponseDeferredAtStart(); |
4538 } | 4542 } |
4539 | 4543 |
4540 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { | 4544 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { |
4541 force_disable_overscroll_content_ = force_disable; | 4545 force_disable_overscroll_content_ = force_disable; |
4542 if (view_) | 4546 if (view_) |
4543 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); | 4547 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); |
4544 } | 4548 } |
4545 | 4549 |
4546 } // namespace content | 4550 } // namespace content |
OLD | NEW |