Chromium Code Reviews| 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 3619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3630 view_->Focus(); | 3630 view_->Focus(); |
| 3631 } | 3631 } |
| 3632 | 3632 |
| 3633 FOR_EACH_OBSERVER(WebContentsObserver, observers_, RenderViewReady()); | 3633 FOR_EACH_OBSERVER(WebContentsObserver, observers_, RenderViewReady()); |
| 3634 } | 3634 } |
| 3635 | 3635 |
| 3636 void WebContentsImpl::RenderViewTerminated(RenderViewHost* rvh, | 3636 void WebContentsImpl::RenderViewTerminated(RenderViewHost* rvh, |
| 3637 base::TerminationStatus status, | 3637 base::TerminationStatus status, |
| 3638 int error_code) { | 3638 int error_code) { |
| 3639 if (rvh != GetRenderViewHost()) { | 3639 if (rvh != GetRenderViewHost()) { |
| 3640 LOG(ERROR) << "WC[" << this << "]::RenderViewTerminated:" | |
| 3641 << " not a match."; | |
| 3640 // The pending page's RenderViewHost is gone. | 3642 // The pending page's RenderViewHost is gone. |
| 3641 return; | 3643 return; |
| 3642 } | 3644 } |
| 3643 | 3645 |
| 3644 // Ensure fullscreen mode is exited in the |delegate_| since a crashed | 3646 // Ensure fullscreen mode is exited in the |delegate_| since a crashed |
| 3645 // renderer may not have made a clean exit. | 3647 // renderer may not have made a clean exit. |
| 3646 if (IsFullscreenForCurrentTab()) | 3648 if (IsFullscreenForCurrentTab()) |
| 3647 ExitFullscreenMode(); | 3649 ExitFullscreenMode(); |
| 3648 | 3650 |
| 3649 // Cancel any visible dialogs so they are not left dangling over the sad tab. | 3651 // Cancel any visible dialogs so they are not left dangling over the sad tab. |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3916 // to App windows. | 3918 // to App windows. |
| 3917 return GetBrowserPluginGuest() || GetBrowserPluginEmbedder(); | 3919 return GetBrowserPluginGuest() || GetBrowserPluginEmbedder(); |
| 3918 } | 3920 } |
| 3919 | 3921 |
| 3920 void WebContentsImpl::EnsureOpenerProxiesExist(RenderFrameHost* source_rfh) { | 3922 void WebContentsImpl::EnsureOpenerProxiesExist(RenderFrameHost* source_rfh) { |
| 3921 WebContentsImpl* source_web_contents = static_cast<WebContentsImpl*>( | 3923 WebContentsImpl* source_web_contents = static_cast<WebContentsImpl*>( |
| 3922 WebContents::FromRenderFrameHost(source_rfh)); | 3924 WebContents::FromRenderFrameHost(source_rfh)); |
| 3923 | 3925 |
| 3924 if (source_web_contents) { | 3926 if (source_web_contents) { |
| 3925 if (GetBrowserPluginGuest()) { | 3927 if (GetBrowserPluginGuest()) { |
| 3926 // We create a swapped out RenderView for the embedder in the guest's | 3928 // We create a RenderFrameProxyHost for the embedder in the guest's |
| 3927 // render process but we intentionally do not expose the embedder's | 3929 // render process but we intentionally do not expose the embedder's |
| 3928 // opener chain to it. | 3930 // opener chain to it. |
| 3929 source_web_contents->CreateSwappedOutRenderView(GetSiteInstance()); | 3931 source_web_contents->GetRenderManager()->CreateRenderFrameProxy(GetSiteIns tance()); |
| 3930 } else { | 3932 } else { |
| 3931 RenderFrameHostImpl* source_rfhi = | 3933 RenderFrameHostImpl* source_rfhi = |
| 3932 static_cast<RenderFrameHostImpl*>(source_rfh); | 3934 static_cast<RenderFrameHostImpl*>(source_rfh); |
| 3933 source_rfhi->frame_tree_node()->render_manager()->CreateOpenerProxies( | 3935 source_rfhi->frame_tree_node()->render_manager()->CreateOpenerProxies( |
| 3934 GetSiteInstance()); | 3936 GetSiteInstance()); |
| 3935 } | 3937 } |
| 3936 } | 3938 } |
| 3937 } | 3939 } |
| 3938 | 3940 |
| 3939 bool WebContentsImpl::AddMessageToConsole(int32 level, | 3941 bool WebContentsImpl::AddMessageToConsole(int32 level, |
| 3940 const base::string16& message, | 3942 const base::string16& message, |
| 3941 int32 line_no, | 3943 int32 line_no, |
| 3942 const base::string16& source_id) { | 3944 const base::string16& source_id) { |
| 3943 if (!delegate_) | 3945 if (!delegate_) |
| 3944 return false; | 3946 return false; |
| 3945 return delegate_->AddMessageToConsole(this, level, message, line_no, | 3947 return delegate_->AddMessageToConsole(this, level, message, line_no, |
| 3946 source_id); | 3948 source_id); |
| 3947 } | 3949 } |
| 3948 | 3950 |
| 3949 int WebContentsImpl::CreateSwappedOutRenderView( | 3951 int WebContentsImpl::CreateSwappedOutRenderView( |
|
Avi (use Gerrit)
2015/06/24 14:59:43
You remove all callers of this function; you shoul
| |
| 3950 SiteInstance* instance) { | 3952 SiteInstance* instance) { |
| 3951 int render_view_routing_id = MSG_ROUTING_NONE; | 3953 int render_view_routing_id = MSG_ROUTING_NONE; |
| 3952 if (RenderFrameHostManager::IsSwappedOutStateForbidden()) { | 3954 if (RenderFrameHostManager::IsSwappedOutStateForbidden()) { |
| 3953 GetRenderManager()->CreateRenderFrameProxy(instance); | 3955 GetRenderManager()->CreateRenderFrameProxy(instance); |
| 3954 } else { | 3956 } else { |
| 3955 GetRenderManager()->CreateRenderFrame( | 3957 GetRenderManager()->CreateRenderFrame( |
| 3956 instance, nullptr, MSG_ROUTING_NONE, | 3958 instance, nullptr, MSG_ROUTING_NONE, |
| 3957 CREATE_RF_SWAPPED_OUT | CREATE_RF_FOR_MAIN_FRAME_NAVIGATION | | 3959 CREATE_RF_SWAPPED_OUT | CREATE_RF_FOR_MAIN_FRAME_NAVIGATION | |
| 3958 CREATE_RF_HIDDEN, | 3960 CREATE_RF_HIDDEN, |
| 3959 &render_view_routing_id); | 3961 &render_view_routing_id); |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4128 } | 4130 } |
| 4129 | 4131 |
| 4130 bool WebContentsImpl::CreateRenderViewForRenderManager( | 4132 bool WebContentsImpl::CreateRenderViewForRenderManager( |
| 4131 RenderViewHost* render_view_host, | 4133 RenderViewHost* render_view_host, |
| 4132 int opener_route_id, | 4134 int opener_route_id, |
| 4133 int proxy_routing_id, | 4135 int proxy_routing_id, |
| 4134 const FrameReplicationState& replicated_frame_state, | 4136 const FrameReplicationState& replicated_frame_state, |
| 4135 bool for_main_frame_navigation) { | 4137 bool for_main_frame_navigation) { |
| 4136 TRACE_EVENT0("browser,navigation", | 4138 TRACE_EVENT0("browser,navigation", |
| 4137 "WebContentsImpl::CreateRenderViewForRenderManager"); | 4139 "WebContentsImpl::CreateRenderViewForRenderManager"); |
| 4140 | |
| 4141 LOG(ERROR) << "WC[" << this << "]::CreateRenderFrameForRenderManager: " | |
| 4142 << " rvh:" << render_view_host; | |
| 4143 | |
| 4138 // Can be NULL during tests. | 4144 // Can be NULL during tests. |
| 4139 RenderWidgetHostViewBase* rwh_view; | 4145 RenderWidgetHostViewBase* rwh_view; |
| 4140 // TODO(kenrb): RenderWidgetHostViewChildFrame special casing is temporary | 4146 // TODO(kenrb): RenderWidgetHostViewChildFrame special casing is temporary |
| 4141 // until RenderWidgetHost is attached to RenderFrameHost. We need to special | 4147 // until RenderWidgetHost is attached to RenderFrameHost. We need to special |
| 4142 // case this because RWH is still a base class of RenderViewHost, and child | 4148 // case this because RWH is still a base class of RenderViewHost, and child |
| 4143 // frame RWHVs are unique in that they do not have their own WebContents. | 4149 // frame RWHVs are unique in that they do not have their own WebContents. |
| 4144 if (!for_main_frame_navigation) { | 4150 if (!for_main_frame_navigation) { |
| 4145 RenderWidgetHostViewChildFrame* rwh_view_child = | 4151 RenderWidgetHostViewChildFrame* rwh_view_child = |
| 4146 new RenderWidgetHostViewChildFrame(render_view_host); | 4152 new RenderWidgetHostViewChildFrame(render_view_host); |
| 4147 rwh_view = rwh_view_child; | 4153 rwh_view = rwh_view_child; |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4389 player_map->erase(it); | 4395 player_map->erase(it); |
| 4390 } | 4396 } |
| 4391 | 4397 |
| 4392 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { | 4398 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { |
| 4393 force_disable_overscroll_content_ = force_disable; | 4399 force_disable_overscroll_content_ = force_disable; |
| 4394 if (view_) | 4400 if (view_) |
| 4395 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); | 4401 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); |
| 4396 } | 4402 } |
| 4397 | 4403 |
| 4398 } // namespace content | 4404 } // namespace content |
| OLD | NEW |