Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Unified Diff: content/browser/web_contents/web_contents_impl.cc

Issue 2165523004: Force MimeHandlerView to always use BrowserPlugin (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added BrowserPluginGuestDelegateMode::DelegateMode(FromWebContents)? Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/web_contents/web_contents_impl.cc
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 1fb9201c58d29fbde43c47ce8305b46c99893df0..11138819f127558ed1664f91f3d97a3174e00e8d 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -86,6 +86,7 @@
#include "content/common/view_messages.h"
#include "content/public/browser/ax_event_notification_details.h"
#include "content/public/browser/browser_context.h"
+#include "content/public/browser/browser_plugin_guest_delegate_mode.h"
#include "content/public/browser/browser_plugin_guest_manager.h"
#include "content/public/browser/content_browser_client.h"
#include "content/public/browser/devtools_agent_host.h"
@@ -107,7 +108,6 @@
#include "content/public/browser/user_metrics.h"
#include "content/public/browser/web_contents_delegate.h"
#include "content/public/common/bindings_policy.h"
-#include "content/public/common/browser_plugin_guest_mode.h"
#include "content/public/common/browser_side_navigation_policy.h"
#include "content/public/common/child_process_host.h"
#include "content/public/common/content_constants.h"
@@ -1381,7 +1381,8 @@ void WebContentsImpl::DispatchBeforeUnload() {
void WebContentsImpl::AttachToOuterWebContentsFrame(
WebContents* outer_web_contents,
RenderFrameHost* outer_contents_frame) {
- CHECK(BrowserPluginGuestMode::UseCrossProcessFramesForGuests());
+ CHECK_EQ(BrowserPluginGuestDelegateMode::USING_CROSS_PROCESS_FRAMES,
+ BrowserPluginGuestDelegateMode::DelegateModeFromWebContents(this));
RenderFrameHostManager* render_manager = GetRenderManager();
// When the WebContents being initialized has an opener, the browser side
@@ -1537,8 +1538,8 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) {
#endif
if (!view_) {
- if (browser_plugin_guest_ &&
- BrowserPluginGuestMode::UseCrossProcessFramesForGuests()) {
+ if (BrowserPluginGuestDelegateMode::DelegateModeFromWebContents(this) ==
+ BrowserPluginGuestDelegateMode::USING_CROSS_PROCESS_FRAMES) {
view_.reset(new WebContentsViewChildFrame(
this, delegate, &render_view_host_delegate_view_));
} else {
@@ -1547,8 +1548,8 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) {
}
}
- if (browser_plugin_guest_ &&
- !BrowserPluginGuestMode::UseCrossProcessFramesForGuests()) {
+ if (BrowserPluginGuestDelegateMode::DelegateModeFromWebContents(this) ==
+ BrowserPluginGuestDelegateMode::NOT_USING_CROSS_PROCESS_FRAMES) {
view_.reset(new WebContentsViewGuest(this, browser_plugin_guest_.get(),
std::move(view_),
&render_view_host_delegate_view_));
@@ -4558,7 +4559,8 @@ void WebContentsImpl::EnsureOpenerProxiesExist(RenderFrameHost* source_rfh) {
// then we should not create a RenderView. AttachToOuterWebContentsFrame()
// already created a RenderFrameProxyHost for that purpose.
if (GetBrowserPluginEmbedder() &&
- BrowserPluginGuestMode::UseCrossProcessFramesForGuests()) {
+ BrowserPluginGuestDelegateMode::DelegateModeFromWebContents(this) !=
+ BrowserPluginGuestDelegateMode::NOT_USING_CROSS_PROCESS_FRAMES) {
return;
}
@@ -4961,14 +4963,15 @@ RenderFrameHostManager* WebContentsImpl::GetRenderManager() const {
}
WebContentsImpl* WebContentsImpl::GetOuterWebContents() {
- if (BrowserPluginGuestMode::UseCrossProcessFramesForGuests()) {
- if (node_)
- return node_->outer_web_contents();
- } else {
- if (GetBrowserPluginGuest())
- return GetBrowserPluginGuest()->embedder_web_contents();
- }
- return nullptr;
+ BrowserPluginGuestDelegateMode::DelegateMode mode =
+ BrowserPluginGuestDelegateMode::DelegateModeFromWebContents(this);
+ if (BrowserPluginGuestDelegateMode::NONE == mode)
+ return nullptr;
+
+ if (BrowserPluginGuestDelegateMode::USING_CROSS_PROCESS_FRAMES == mode)
+ return !!node_ ? node_->outer_web_contents() : nullptr;
+
+ return browser_plugin_guest_->embedder_web_contents();
}
BrowserPluginGuest* WebContentsImpl::GetBrowserPluginGuest() const {

Powered by Google App Engine
This is Rietveld 408576698