diff options
author | fsamuel <fsamuel@chromium.org> | 2014-09-10 17:59:30 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-09-11 01:06:20 +0000 |
commit | 9e3d9ad06062b656f0366f7828ad870b5430f999 (patch) | |
tree | f7638f2d3d1f9a2d6e9a54b32aa4876e56c208c4 /content/browser/browser_plugin/browser_plugin_guest.cc | |
parent | cdcb5f741f8163b771d66f6017a67cff06193b50 (diff) | |
download | chromium_src-9e3d9ad06062b656f0366f7828ad870b5430f999.zip chromium_src-9e3d9ad06062b656f0366f7828ad870b5430f999.tar.gz chromium_src-9e3d9ad06062b656f0366f7828ad870b5430f999.tar.bz2 |
BrowserPlugin: Interstitial Pages work
This CL fixes resize, focus and cursor issues for interstitial pages inside
Browser Plugin.
Interstitial page RenderViewHosts are not a part of the main page's WebContents. Thus, BrowserPluginGuest's (a WebContentsObserver) OnMessageReceived method will not catch IPCs coming from interstitials. However, guest interstitials have RenderWidgetHostViewGuests.
By hanlding focus, resize, cursors and the like through RenderWidgetHostViewGuest, we ensure that interstitial pages get the same treatment inside a BrowserPlugin as RenderViewHosts that belong to the guest WebContents.
BUG=273089
Review URL: https://codereview.chromium.org/549323002
Cr-Commit-Position: refs/heads/master@{#294281}
Diffstat (limited to 'content/browser/browser_plugin/browser_plugin_guest.cc')
-rw-r--r-- | content/browser/browser_plugin/browser_plugin_guest.cc | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/content/browser/browser_plugin/browser_plugin_guest.cc b/content/browser/browser_plugin/browser_plugin_guest.cc index f582394..569c9de 100644 --- a/content/browser/browser_plugin/browser_plugin_guest.cc +++ b/content/browser/browser_plugin/browser_plugin_guest.cc @@ -35,7 +35,6 @@ #include "content/public/browser/user_metrics.h" #include "content/public/browser/web_contents_observer.h" #include "content/public/common/drop_data.h" -#include "third_party/WebKit/public/platform/WebCursorInfo.h" #include "ui/gfx/geometry/size_conversions.h" #if defined(OS_MACOSX) @@ -108,6 +107,24 @@ base::WeakPtr<BrowserPluginGuest> BrowserPluginGuest::AsWeakPtr() { return weak_ptr_factory_.GetWeakPtr(); } +void BrowserPluginGuest::SetFocus(RenderWidgetHost* rwh, bool focused) { + focused_ = focused; + rwh->Send(new InputMsg_SetFocus(rwh->GetRoutingID(), focused)); + if (!focused && mouse_locked_) + OnUnlockMouse(); + + // Restore the last seen state of text input to the view. + RenderWidgetHostViewBase* rwhv = static_cast<RenderWidgetHostViewBase*>( + web_contents()->GetRenderWidgetHostView()); + if (rwhv) { + ViewHostMsg_TextInputState_Params params; + params.type = last_text_input_type_; + params.mode = last_input_mode_; + params.can_compose_inline = last_can_compose_inline_; + rwhv->TextInputStateChanged(params); + } +} + bool BrowserPluginGuest::LockMouse(bool allowed) { if (!attached() || (mouse_locked_ == allowed)) return false; @@ -495,7 +512,6 @@ bool BrowserPluginGuest::OnMessageReceived(const IPC::Message& message) { IPC_MESSAGE_HANDLER(ViewHostMsg_HasTouchEventHandlers, OnHasTouchEventHandlers) IPC_MESSAGE_HANDLER(ViewHostMsg_LockMouse, OnLockMouse) - IPC_MESSAGE_HANDLER(ViewHostMsg_SetCursor, OnSetCursor) IPC_MESSAGE_HANDLER(ViewHostMsg_ShowWidget, OnShowWidget) IPC_MESSAGE_HANDLER(ViewHostMsg_TakeFocus, OnTakeFocus) IPC_MESSAGE_HANDLER(ViewHostMsg_TextInputStateChanged, @@ -702,21 +718,10 @@ void BrowserPluginGuest::OnResizeGuest( void BrowserPluginGuest::OnSetFocus(int browser_plugin_instance_id, bool focused) { - focused_ = focused; - Send(new InputMsg_SetFocus(routing_id(), focused)); - if (!focused && mouse_locked_) - OnUnlockMouse(); - // Restore the last seen state of text input to the view. - RenderWidgetHostViewBase* rwhv = static_cast<RenderWidgetHostViewBase*>( - web_contents()->GetRenderWidgetHostView()); - if (rwhv) { - ViewHostMsg_TextInputState_Params params; - params.type = last_text_input_type_; - params.mode = last_input_mode_; - params.can_compose_inline = last_can_compose_inline_; - rwhv->TextInputStateChanged(params); - } + RenderWidgetHost* rwh = web_contents()->GetRenderWidgetHostView()-> + GetRenderWidgetHost(); + SetFocus(rwh, focused); } void BrowserPluginGuest::OnSetEditCommandsForNextKeyEvent( @@ -784,11 +789,6 @@ void BrowserPluginGuest::OnHasTouchEventHandlers(bool accept) { browser_plugin_instance_id(), accept)); } -void BrowserPluginGuest::OnSetCursor(const WebCursor& cursor) { - SendMessageToEmbedder( - new BrowserPluginMsg_SetCursor(browser_plugin_instance_id(), cursor)); -} - #if defined(OS_MACOSX) void BrowserPluginGuest::OnShowPopup( RenderFrameHost* render_frame_host, |