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

Unified Diff: content/browser/browser_plugin/browser_plugin_guest.cc

Issue 2165523004: Force MimeHandlerView to always use BrowserPlugin (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing lazyboy@'s and lfg@'s comments 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/browser_plugin/browser_plugin_guest.cc
diff --git a/content/browser/browser_plugin/browser_plugin_guest.cc b/content/browser/browser_plugin/browser_plugin_guest.cc
index d0a39e22c2d7afa3dcd1fddb5d72c12c4b03d299..c7e77e9bc5f6fa7f11c65152cb53d03070a131aa 100644
--- a/content/browser/browser_plugin/browser_plugin_guest.cc
+++ b/content/browser/browser_plugin/browser_plugin_guest.cc
@@ -105,16 +105,19 @@ BrowserPluginGuest::BrowserPluginGuest(bool has_render_view,
seen_embedder_drag_source_ended_at_(false),
ignore_dragged_url_(true),
delegate_(delegate),
+ is_mime_handler_view_guest_(false),
weak_ptr_factory_(this) {
DCHECK(web_contents);
DCHECK(delegate);
RecordAction(base::UserMetricsAction("BrowserPlugin.Guest.Create"));
web_contents->SetBrowserPluginGuest(this);
delegate->SetGuestHost(this);
+ is_mime_handler_view_guest_ = delegate->IsMimeHandlerViewGuest();
}
int BrowserPluginGuest::GetGuestProxyRoutingID() {
- if (BrowserPluginGuestMode::UseCrossProcessFramesForGuests()) {
+ if (BrowserPluginGuestMode::UseCrossProcessFramesForGuests() &&
+ !IsMimeHandlerViewGuest()) {
// We don't use the proxy to send postMessage in --site-per-process, since
// we use the contentWindow directly from the frame element instead.
return MSG_ROUTING_NONE;
@@ -290,7 +293,8 @@ void BrowserPluginGuest::InitInternal(
if (owner_web_contents_ != owner_web_contents) {
WebContentsViewGuest* new_view = nullptr;
- if (!BrowserPluginGuestMode::UseCrossProcessFramesForGuests()) {
+ if (!BrowserPluginGuestMode::UseCrossProcessFramesForGuests() ||
+ IsMimeHandlerViewGuest()) {
new_view =
static_cast<WebContentsViewGuest*>(GetWebContents()->GetView());
}
@@ -373,6 +377,12 @@ RenderWidgetHostView* BrowserPluginGuest::GetOwnerRenderWidgetHostView() {
return owner_web_contents_->GetRenderWidgetHostView();
}
+RenderWidgetHostView* BrowserPluginGuest::GetTopLevelRenderWidgetHostView() {
+ if (!owner_web_contents_)
+ return nullptr;
+ return owner_web_contents_->GetTopLevelRenderWidgetHostView();
+}
+
void BrowserPluginGuest::UpdateVisibility() {
OnSetVisibility(browser_plugin_instance_id(), visible());
}
@@ -470,6 +480,10 @@ void BrowserPluginGuest::ResendEventToEmbedder(
}
}
+bool BrowserPluginGuest::IsMimeHandlerViewGuest() const {
+ return is_mime_handler_view_guest_;
+}
+
WebContentsImpl* BrowserPluginGuest::GetWebContents() const {
return static_cast<WebContentsImpl*>(web_contents());
}
@@ -677,7 +691,8 @@ bool BrowserPluginGuest::OnMessageReceived(const IPC::Message& message) {
// TODO(lazyboy): Fix this as part of http://crbug.com/330264. The required
// parts of code from this class should be extracted to a separate class for
// --site-per-process.
- if (BrowserPluginGuestMode::UseCrossProcessFramesForGuests()) {
+ if (BrowserPluginGuestMode::UseCrossProcessFramesForGuests() &&
+ !IsMimeHandlerViewGuest()) {
return false;
}
@@ -927,7 +942,8 @@ void BrowserPluginGuest::OnSetEditCommandsForNextKeyEvent(
void BrowserPluginGuest::OnSetVisibility(int browser_plugin_instance_id,
bool visible) {
// For OOPIF-<webivew>, the remote frame will handle visibility state.
- if (BrowserPluginGuestMode::UseCrossProcessFramesForGuests())
+ if (BrowserPluginGuestMode::UseCrossProcessFramesForGuests() &&
+ !IsMimeHandlerViewGuest())
return;
guest_visible_ = visible;

Powered by Google App Engine
This is Rietveld 408576698