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

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

Issue 584713002: Browser Plugin: Remove dependency on NPAPI (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move_content_window
Patch Set: Even more cleanup! Created 6 years, 3 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 992bcccd401da415b71600251997d4ac64e07c55..ea54cf89e37809e3bb10ff6891342c83cad5fa15 100644
--- a/content/browser/browser_plugin/browser_plugin_guest.cc
+++ b/content/browser/browser_plugin/browser_plugin_guest.cc
@@ -183,8 +183,6 @@ bool BrowserPluginGuest::OnMessageReceivedFromEmbedder(
IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_SetEditCommandsForNextKeyEvent,
OnSetEditCommandsForNextKeyEvent)
IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_SetFocus, OnSetFocus)
- IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_SetContentsOpaque,
- OnSetContentsOpaque)
IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_SetVisibility, OnSetVisibility)
IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_UnlockMouse_ACK, OnUnlockMouseAck)
IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_UpdateGeometry, OnUpdateGeometry)
@@ -200,7 +198,6 @@ void BrowserPluginGuest::Initialize(
browser_plugin_instance_id_ = browser_plugin_instance_id;
focused_ = params.focused;
guest_visible_ = params.visible;
- guest_opaque_ = params.opaque;
guest_window_rect_ = gfx::Rect(params.origin,
params.resize_guest_params.view_size);
@@ -371,6 +368,15 @@ void BrowserPluginGuest::SwapCompositorFrame(
browser_plugin_instance_id(), guest_params));
}
+void BrowserPluginGuest::SetContentsOpaque(bool opaque) {
+ if (guest_opaque_ == opaque)
+ return;
+ guest_opaque_ = opaque;
+ SendMessageToEmbedder(
+ new BrowserPluginMsg_SetContentsOpaque(
+ browser_plugin_instance_id(), guest_opaque_));
+}
+
WebContentsImpl* BrowserPluginGuest::GetWebContents() const {
return static_cast<WebContentsImpl*>(web_contents());
}
@@ -441,7 +447,12 @@ void BrowserPluginGuest::RenderViewReady() {
Send(new InputMsg_SetFocus(routing_id(), focused_));
UpdateVisibility();
- OnSetContentsOpaque(browser_plugin_instance_id(), guest_opaque_);
+ // We don't want to accidentally set the opacity of an interstitial page.
+ // WebContents::GetRenderWidgetHostView will return the RWHV of an
+ // interstitial page if one is showing at this time. We only want opacity
+ // to apply to web pages.
+ GetWebContents()->GetRenderViewHost()->GetView()->
+ SetBackgroundOpaque(guest_opaque_);
RenderWidgetHostImpl::From(rvh)->set_hung_renderer_delay_ms(
base::TimeDelta::FromMilliseconds(kHungRendererDelayMs));
@@ -484,7 +495,6 @@ bool BrowserPluginGuest::ShouldForwardToBrowserPluginGuest(
case BrowserPluginHostMsg_ResizeGuest::ID:
case BrowserPluginHostMsg_SetEditCommandsForNextKeyEvent::ID:
case BrowserPluginHostMsg_SetFocus::ID:
- case BrowserPluginHostMsg_SetContentsOpaque::ID:
case BrowserPluginHostMsg_SetVisibility::ID:
case BrowserPluginHostMsg_UnlockMouse_ACK::ID:
case BrowserPluginHostMsg_UpdateGeometry::ID:
@@ -730,12 +740,6 @@ void BrowserPluginGuest::OnSetEditCommandsForNextKeyEvent(
edit_commands));
}
-void BrowserPluginGuest::OnSetContentsOpaque(int browser_plugin_instance_id,
- bool opaque) {
- guest_opaque_ = opaque;
- Send(new ViewMsg_SetBackgroundOpaque(routing_id(), guest_opaque_));
-}
-
void BrowserPluginGuest::OnSetVisibility(int browser_plugin_instance_id,
bool visible) {
guest_visible_ = visible;

Powered by Google App Engine
This is Rietveld 408576698