| 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 1520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1531 ui::Window* mus_window = aura::GetMusWindow(params.context); | 1531 ui::Window* mus_window = aura::GetMusWindow(params.context); |
| 1532 if (mus_window) { | 1532 if (mus_window) { |
| 1533 view_.reset(new WebContentsViewMus(mus_window, this, delegate, | 1533 view_.reset(new WebContentsViewMus(mus_window, this, delegate, |
| 1534 &render_view_host_delegate_view_)); | 1534 &render_view_host_delegate_view_)); |
| 1535 } | 1535 } |
| 1536 } | 1536 } |
| 1537 #endif | 1537 #endif |
| 1538 | 1538 |
| 1539 if (!view_) { | 1539 if (!view_) { |
| 1540 if (browser_plugin_guest_ && | 1540 if (browser_plugin_guest_ && |
| 1541 !browser_plugin_guest_->IsMimeHandlerViewGuest() && |
| 1541 BrowserPluginGuestMode::UseCrossProcessFramesForGuests()) { | 1542 BrowserPluginGuestMode::UseCrossProcessFramesForGuests()) { |
| 1542 view_.reset(new WebContentsViewChildFrame( | 1543 view_.reset(new WebContentsViewChildFrame( |
| 1543 this, delegate, &render_view_host_delegate_view_)); | 1544 this, delegate, &render_view_host_delegate_view_)); |
| 1544 } else { | 1545 } else { |
| 1545 view_.reset(CreateWebContentsView(this, delegate, | 1546 view_.reset(CreateWebContentsView(this, delegate, |
| 1546 &render_view_host_delegate_view_)); | 1547 &render_view_host_delegate_view_)); |
| 1547 } | 1548 } |
| 1548 } | 1549 } |
| 1549 | 1550 |
| 1550 if (browser_plugin_guest_ && | 1551 if (browser_plugin_guest_ && |
| 1551 !BrowserPluginGuestMode::UseCrossProcessFramesForGuests()) { | 1552 (!BrowserPluginGuestMode::UseCrossProcessFramesForGuests() || |
| 1553 browser_plugin_guest_->IsMimeHandlerViewGuest())) { |
| 1552 view_.reset(new WebContentsViewGuest(this, browser_plugin_guest_.get(), | 1554 view_.reset(new WebContentsViewGuest(this, browser_plugin_guest_.get(), |
| 1553 std::move(view_), | 1555 std::move(view_), |
| 1554 &render_view_host_delegate_view_)); | 1556 &render_view_host_delegate_view_)); |
| 1555 } | 1557 } |
| 1556 CHECK(render_view_host_delegate_view_); | 1558 CHECK(render_view_host_delegate_view_); |
| 1557 CHECK(view_.get()); | 1559 CHECK(view_.get()); |
| 1558 | 1560 |
| 1559 gfx::Size initial_size = params.initial_size; | 1561 gfx::Size initial_size = params.initial_size; |
| 1560 view_->CreateView(initial_size, params.context); | 1562 view_->CreateView(initial_size, params.context); |
| 1561 | 1563 |
| (...skipping 3007 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4569 | 4571 |
| 4570 void WebContentsImpl::EnsureOpenerProxiesExist(RenderFrameHost* source_rfh) { | 4572 void WebContentsImpl::EnsureOpenerProxiesExist(RenderFrameHost* source_rfh) { |
| 4571 WebContentsImpl* source_web_contents = static_cast<WebContentsImpl*>( | 4573 WebContentsImpl* source_web_contents = static_cast<WebContentsImpl*>( |
| 4572 WebContents::FromRenderFrameHost(source_rfh)); | 4574 WebContents::FromRenderFrameHost(source_rfh)); |
| 4573 | 4575 |
| 4574 if (source_web_contents) { | 4576 if (source_web_contents) { |
| 4575 // If this message is going to outer WebContents from inner WebContents, | 4577 // If this message is going to outer WebContents from inner WebContents, |
| 4576 // then we should not create a RenderView. AttachToOuterWebContentsFrame() | 4578 // then we should not create a RenderView. AttachToOuterWebContentsFrame() |
| 4577 // already created a RenderFrameProxyHost for that purpose. | 4579 // already created a RenderFrameProxyHost for that purpose. |
| 4578 if (GetBrowserPluginEmbedder() && | 4580 if (GetBrowserPluginEmbedder() && |
| 4579 BrowserPluginGuestMode::UseCrossProcessFramesForGuests()) { | 4581 BrowserPluginGuestMode::UseCrossProcessFramesForGuests() && |
| 4582 !source_web_contents->GetBrowserPluginGuest() |
| 4583 ->IsMimeHandlerViewGuest()) { |
| 4580 return; | 4584 return; |
| 4581 } | 4585 } |
| 4582 | 4586 |
| 4583 if (this != source_web_contents && GetBrowserPluginGuest()) { | 4587 if (this != source_web_contents && GetBrowserPluginGuest()) { |
| 4584 // We create a RenderFrameProxyHost for the embedder in the guest's render | 4588 // We create a RenderFrameProxyHost for the embedder in the guest's render |
| 4585 // process but we intentionally do not expose the embedder's opener chain | 4589 // process but we intentionally do not expose the embedder's opener chain |
| 4586 // to it. | 4590 // to it. |
| 4587 source_web_contents->GetRenderManager()->CreateRenderFrameProxy( | 4591 source_web_contents->GetRenderManager()->CreateRenderFrameProxy( |
| 4588 GetSiteInstance()); | 4592 GetSiteInstance()); |
| 4589 } else { | 4593 } else { |
| (...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4972 return node_->outer_contents_frame_tree_node_id(); | 4976 return node_->outer_contents_frame_tree_node_id(); |
| 4973 | 4977 |
| 4974 return FrameTreeNode::kFrameTreeNodeInvalidId; | 4978 return FrameTreeNode::kFrameTreeNodeInvalidId; |
| 4975 } | 4979 } |
| 4976 | 4980 |
| 4977 RenderFrameHostManager* WebContentsImpl::GetRenderManager() const { | 4981 RenderFrameHostManager* WebContentsImpl::GetRenderManager() const { |
| 4978 return frame_tree_.root()->render_manager(); | 4982 return frame_tree_.root()->render_manager(); |
| 4979 } | 4983 } |
| 4980 | 4984 |
| 4981 WebContentsImpl* WebContentsImpl::GetOuterWebContents() { | 4985 WebContentsImpl* WebContentsImpl::GetOuterWebContents() { |
| 4982 if (BrowserPluginGuestMode::UseCrossProcessFramesForGuests()) { | 4986 if (BrowserPluginGuestMode::UseCrossProcessFramesForGuests() && |
| 4987 (!browser_plugin_guest_ || |
| 4988 !browser_plugin_guest_->IsMimeHandlerViewGuest())) { |
| 4983 if (node_) | 4989 if (node_) |
| 4984 return node_->outer_web_contents(); | 4990 return node_->outer_web_contents(); |
| 4985 } else { | 4991 } else { |
| 4986 if (GetBrowserPluginGuest()) | 4992 if (browser_plugin_guest_) |
| 4987 return GetBrowserPluginGuest()->embedder_web_contents(); | 4993 return browser_plugin_guest_->embedder_web_contents(); |
| 4988 } | 4994 } |
| 4989 return nullptr; | 4995 return nullptr; |
| 4990 } | 4996 } |
| 4991 | 4997 |
| 4992 BrowserPluginGuest* WebContentsImpl::GetBrowserPluginGuest() const { | 4998 BrowserPluginGuest* WebContentsImpl::GetBrowserPluginGuest() const { |
| 4993 return browser_plugin_guest_.get(); | 4999 return browser_plugin_guest_.get(); |
| 4994 } | 5000 } |
| 4995 | 5001 |
| 4996 void WebContentsImpl::SetBrowserPluginGuest(BrowserPluginGuest* guest) { | 5002 void WebContentsImpl::SetBrowserPluginGuest(BrowserPluginGuest* guest) { |
| 4997 CHECK(!browser_plugin_guest_); | 5003 CHECK(!browser_plugin_guest_); |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5171 for (RenderViewHost* render_view_host : render_view_host_set) | 5177 for (RenderViewHost* render_view_host : render_view_host_set) |
| 5172 render_view_host->OnWebkitPreferencesChanged(); | 5178 render_view_host->OnWebkitPreferencesChanged(); |
| 5173 } | 5179 } |
| 5174 | 5180 |
| 5175 void WebContentsImpl::SetJavaScriptDialogManagerForTesting( | 5181 void WebContentsImpl::SetJavaScriptDialogManagerForTesting( |
| 5176 JavaScriptDialogManager* dialog_manager) { | 5182 JavaScriptDialogManager* dialog_manager) { |
| 5177 dialog_manager_ = dialog_manager; | 5183 dialog_manager_ = dialog_manager; |
| 5178 } | 5184 } |
| 5179 | 5185 |
| 5180 } // namespace content | 5186 } // namespace content |
| OLD | NEW |