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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <cmath> | 9 #include <cmath> |
10 #include <utility> | 10 #include <utility> |
(...skipping 4328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4339 if (source_web_contents) { | 4339 if (source_web_contents) { |
4340 // If this message is going to outer WebContents from inner WebContents, | 4340 // If this message is going to outer WebContents from inner WebContents, |
4341 // then we should not create a RenderView. AttachToOuterWebContentsFrame() | 4341 // then we should not create a RenderView. AttachToOuterWebContentsFrame() |
4342 // already created a RenderFrameProxyHost for that purpose. | 4342 // already created a RenderFrameProxyHost for that purpose. |
4343 if (GetBrowserPluginEmbedder() && | 4343 if (GetBrowserPluginEmbedder() && |
4344 BrowserPluginGuestMode::UseCrossProcessFramesForGuests()) { | 4344 BrowserPluginGuestMode::UseCrossProcessFramesForGuests()) { |
4345 return; | 4345 return; |
4346 } | 4346 } |
4347 | 4347 |
4348 if (this != source_web_contents && GetBrowserPluginGuest()) { | 4348 if (this != source_web_contents && GetBrowserPluginGuest()) { |
4349 // We create a swapped out RenderView or RenderFrameProxyHost for the | 4349 // We create a RenderFrameProxyHost for the embedder in the guest's render |
4350 // embedder in the guest's render process but we intentionally do not | 4350 // process but we intentionally do not expose the embedder's opener chain |
4351 // expose the embedder's opener chain to it. | 4351 // to it. |
4352 if (SiteIsolationPolicy::IsSwappedOutStateForbidden()) { | 4352 source_web_contents->GetRenderManager()->CreateRenderFrameProxy( |
4353 source_web_contents->GetRenderManager()->CreateRenderFrameProxy( | 4353 GetSiteInstance()); |
4354 GetSiteInstance()); | |
4355 } else { | |
4356 source_web_contents->CreateSwappedOutRenderView(GetSiteInstance()); | |
4357 } | |
4358 } else { | 4354 } else { |
4359 RenderFrameHostImpl* source_rfhi = | 4355 RenderFrameHostImpl* source_rfhi = |
4360 static_cast<RenderFrameHostImpl*>(source_rfh); | 4356 static_cast<RenderFrameHostImpl*>(source_rfh); |
4361 source_rfhi->frame_tree_node()->render_manager()->CreateOpenerProxies( | 4357 source_rfhi->frame_tree_node()->render_manager()->CreateOpenerProxies( |
4362 GetSiteInstance(), nullptr); | 4358 GetSiteInstance(), nullptr); |
4363 } | 4359 } |
4364 } | 4360 } |
4365 } | 4361 } |
4366 | 4362 |
4367 bool WebContentsImpl::AddMessageToConsole(int32_t level, | 4363 bool WebContentsImpl::AddMessageToConsole(int32_t level, |
4368 const base::string16& message, | 4364 const base::string16& message, |
4369 int32_t line_no, | 4365 int32_t line_no, |
4370 const base::string16& source_id) { | 4366 const base::string16& source_id) { |
4371 if (!delegate_) | 4367 if (!delegate_) |
4372 return false; | 4368 return false; |
4373 return delegate_->AddMessageToConsole(this, level, message, line_no, | 4369 return delegate_->AddMessageToConsole(this, level, message, line_no, |
4374 source_id); | 4370 source_id); |
4375 } | 4371 } |
4376 | 4372 |
4377 int WebContentsImpl::CreateSwappedOutRenderView( | 4373 int WebContentsImpl::CreateSwappedOutRenderView( |
4378 SiteInstance* instance) { | 4374 SiteInstance* instance) { |
4379 int render_view_routing_id = MSG_ROUTING_NONE; | 4375 int render_view_routing_id = MSG_ROUTING_NONE; |
4380 if (SiteIsolationPolicy::IsSwappedOutStateForbidden()) { | 4376 GetRenderManager()->CreateRenderFrameProxy(instance); |
4381 GetRenderManager()->CreateRenderFrameProxy(instance); | |
4382 } else { | |
4383 GetRenderManager()->CreateRenderFrame( | |
4384 instance, CREATE_RF_SWAPPED_OUT | CREATE_RF_HIDDEN, | |
4385 &render_view_routing_id); | |
4386 } | |
4387 return render_view_routing_id; | 4377 return render_view_routing_id; |
4388 } | 4378 } |
4389 | 4379 |
4390 void WebContentsImpl::OnUserInteraction( | 4380 void WebContentsImpl::OnUserInteraction( |
4391 RenderWidgetHostImpl* render_widget_host, | 4381 RenderWidgetHostImpl* render_widget_host, |
4392 const blink::WebInputEvent::Type type) { | 4382 const blink::WebInputEvent::Type type) { |
4393 // Ignore when the renderer is swapped out. | 4383 // Ignore when the renderer is swapped out. |
4394 // TODO(dominickn,creis): support widgets for out-of-process iframes. | 4384 // TODO(dominickn,creis): support widgets for out-of-process iframes. |
4395 if (render_widget_host != GetRenderViewHost()->GetWidget()) | 4385 if (render_widget_host != GetRenderViewHost()->GetWidget()) |
4396 return; | 4386 return; |
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4860 else | 4850 else |
4861 WasHidden(); | 4851 WasHidden(); |
4862 } | 4852 } |
4863 | 4853 |
4864 void WebContentsImpl::SetJavaScriptDialogManagerForTesting( | 4854 void WebContentsImpl::SetJavaScriptDialogManagerForTesting( |
4865 JavaScriptDialogManager* dialog_manager) { | 4855 JavaScriptDialogManager* dialog_manager) { |
4866 dialog_manager_ = dialog_manager; | 4856 dialog_manager_ = dialog_manager; |
4867 } | 4857 } |
4868 | 4858 |
4869 } // namespace content | 4859 } // namespace content |
OLD | NEW |