| 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 2989 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4551 | 4553 |
| 4552 void WebContentsImpl::EnsureOpenerProxiesExist(RenderFrameHost* source_rfh) { | 4554 void WebContentsImpl::EnsureOpenerProxiesExist(RenderFrameHost* source_rfh) { |
| 4553 WebContentsImpl* source_web_contents = static_cast<WebContentsImpl*>( | 4555 WebContentsImpl* source_web_contents = static_cast<WebContentsImpl*>( |
| 4554 WebContents::FromRenderFrameHost(source_rfh)); | 4556 WebContents::FromRenderFrameHost(source_rfh)); |
| 4555 | 4557 |
| 4556 if (source_web_contents) { | 4558 if (source_web_contents) { |
| 4557 // If this message is going to outer WebContents from inner WebContents, | 4559 // If this message is going to outer WebContents from inner WebContents, |
| 4558 // then we should not create a RenderView. AttachToOuterWebContentsFrame() | 4560 // then we should not create a RenderView. AttachToOuterWebContentsFrame() |
| 4559 // already created a RenderFrameProxyHost for that purpose. | 4561 // already created a RenderFrameProxyHost for that purpose. |
| 4560 if (GetBrowserPluginEmbedder() && | 4562 if (GetBrowserPluginEmbedder() && |
| 4561 BrowserPluginGuestMode::UseCrossProcessFramesForGuests()) { | 4563 BrowserPluginGuestMode::UseCrossProcessFramesForGuests() && |
| 4564 !(source_web_contents->browser_plugin_guest_ && |
| 4565 source_web_contents->browser_plugin_guest_ |
| 4566 ->IsMimeHandlerViewGuest())) { |
| 4562 return; | 4567 return; |
| 4563 } | 4568 } |
| 4564 | 4569 |
| 4565 if (this != source_web_contents && GetBrowserPluginGuest()) { | 4570 if (this != source_web_contents && GetBrowserPluginGuest()) { |
| 4566 // We create a RenderFrameProxyHost for the embedder in the guest's render | 4571 // We create a RenderFrameProxyHost for the embedder in the guest's render |
| 4567 // process but we intentionally do not expose the embedder's opener chain | 4572 // process but we intentionally do not expose the embedder's opener chain |
| 4568 // to it. | 4573 // to it. |
| 4569 source_web_contents->GetRenderManager()->CreateRenderFrameProxy( | 4574 source_web_contents->GetRenderManager()->CreateRenderFrameProxy( |
| 4570 GetSiteInstance()); | 4575 GetSiteInstance()); |
| 4571 } else { | 4576 } else { |
| (...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4954 return node_->outer_contents_frame_tree_node_id(); | 4959 return node_->outer_contents_frame_tree_node_id(); |
| 4955 | 4960 |
| 4956 return FrameTreeNode::kFrameTreeNodeInvalidId; | 4961 return FrameTreeNode::kFrameTreeNodeInvalidId; |
| 4957 } | 4962 } |
| 4958 | 4963 |
| 4959 RenderFrameHostManager* WebContentsImpl::GetRenderManager() const { | 4964 RenderFrameHostManager* WebContentsImpl::GetRenderManager() const { |
| 4960 return frame_tree_.root()->render_manager(); | 4965 return frame_tree_.root()->render_manager(); |
| 4961 } | 4966 } |
| 4962 | 4967 |
| 4963 WebContentsImpl* WebContentsImpl::GetOuterWebContents() { | 4968 WebContentsImpl* WebContentsImpl::GetOuterWebContents() { |
| 4964 if (BrowserPluginGuestMode::UseCrossProcessFramesForGuests()) { | 4969 if (BrowserPluginGuestMode::UseCrossProcessFramesForGuests() && |
| 4970 (!browser_plugin_guest_ || |
| 4971 !browser_plugin_guest_->IsMimeHandlerViewGuest())) { |
| 4965 if (node_) | 4972 if (node_) |
| 4966 return node_->outer_web_contents(); | 4973 return node_->outer_web_contents(); |
| 4967 } else { | 4974 } else { |
| 4968 if (GetBrowserPluginGuest()) | 4975 if (browser_plugin_guest_) |
| 4969 return GetBrowserPluginGuest()->embedder_web_contents(); | 4976 return browser_plugin_guest_->embedder_web_contents(); |
| 4970 } | 4977 } |
| 4971 return nullptr; | 4978 return nullptr; |
| 4972 } | 4979 } |
| 4973 | 4980 |
| 4974 BrowserPluginGuest* WebContentsImpl::GetBrowserPluginGuest() const { | 4981 BrowserPluginGuest* WebContentsImpl::GetBrowserPluginGuest() const { |
| 4975 return browser_plugin_guest_.get(); | 4982 return browser_plugin_guest_.get(); |
| 4976 } | 4983 } |
| 4977 | 4984 |
| 4978 void WebContentsImpl::SetBrowserPluginGuest(BrowserPluginGuest* guest) { | 4985 void WebContentsImpl::SetBrowserPluginGuest(BrowserPluginGuest* guest) { |
| 4979 CHECK(!browser_plugin_guest_); | 4986 CHECK(!browser_plugin_guest_); |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5153 for (RenderViewHost* render_view_host : render_view_host_set) | 5160 for (RenderViewHost* render_view_host : render_view_host_set) |
| 5154 render_view_host->OnWebkitPreferencesChanged(); | 5161 render_view_host->OnWebkitPreferencesChanged(); |
| 5155 } | 5162 } |
| 5156 | 5163 |
| 5157 void WebContentsImpl::SetJavaScriptDialogManagerForTesting( | 5164 void WebContentsImpl::SetJavaScriptDialogManagerForTesting( |
| 5158 JavaScriptDialogManager* dialog_manager) { | 5165 JavaScriptDialogManager* dialog_manager) { |
| 5159 dialog_manager_ = dialog_manager; | 5166 dialog_manager_ = dialog_manager; |
| 5160 } | 5167 } |
| 5161 | 5168 |
| 5162 } // namespace content | 5169 } // namespace content |
| OLD | NEW |