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 16a4473dfa1a0a6156dbc1600cb54ad0a8a1bb52..5309523f6b07bd0ab3e00897d3e00914e864a21e 100644 |
--- a/content/browser/browser_plugin/browser_plugin_guest.cc |
+++ b/content/browser/browser_plugin/browser_plugin_guest.cc |
@@ -132,11 +132,18 @@ base::WeakPtr<BrowserPluginGuest> BrowserPluginGuest::AsWeakPtr() { |
return weak_ptr_factory_.GetWeakPtr(); |
} |
-void BrowserPluginGuest::SetFocus(RenderWidgetHost* rwh, bool focused) { |
+void BrowserPluginGuest::SetFocus(RenderWidgetHost* rwh, |
+ bool focused, |
+ blink::WebFocusType focus_type) { |
focused_ = focused; |
if (!rwh) |
return; |
+ if ((focus_type == blink::WebFocusTypeForward) || |
+ (focus_type == blink::WebFocusTypeBackward)) { |
+ static_cast<RenderViewHostImpl*>(RenderViewHost::From(rwh))-> |
+ SetInitialFocus(focus_type == blink::WebFocusTypeBackward); |
+ } |
rwh->Send(new InputMsg_SetFocus(rwh->GetRoutingID(), focused)); |
if (!focused && mouse_locked_) |
OnUnlockMouse(); |
@@ -220,7 +227,9 @@ void BrowserPluginGuest::InitInternal( |
const BrowserPluginHostMsg_Attach_Params& params, |
WebContentsImpl* owner_web_contents) { |
focused_ = params.focused; |
- OnSetFocus(browser_plugin::kInstanceIDNone, focused_); |
+ OnSetFocus(browser_plugin::kInstanceIDNone, |
+ focused_, |
+ blink::WebFocusTypeNone); |
guest_visible_ = params.visible; |
UpdateVisibility(); |
@@ -748,10 +757,11 @@ void BrowserPluginGuest::OnResizeGuest( |
} |
void BrowserPluginGuest::OnSetFocus(int browser_plugin_instance_id, |
- bool focused) { |
+ bool focused, |
+ blink::WebFocusType focus_type) { |
RenderWidgetHostView* rwhv = web_contents()->GetRenderWidgetHostView(); |
RenderWidgetHost* rwh = rwhv ? rwhv->GetRenderWidgetHost() : NULL; |
- SetFocus(rwh, focused); |
+ SetFocus(rwh, focused, focus_type); |
} |
void BrowserPluginGuest::OnSetEditCommandsForNextKeyEvent( |