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 569c9deb00e379b37ee29622aeca7049ee56eb7e..847eff8c2c661d9d5ad3f9d988a4f9d664f08cdb 100644 |
--- a/content/browser/browser_plugin/browser_plugin_guest.cc |
+++ b/content/browser/browser_plugin/browser_plugin_guest.cc |
@@ -109,13 +109,16 @@ base::WeakPtr<BrowserPluginGuest> BrowserPluginGuest::AsWeakPtr() { |
void BrowserPluginGuest::SetFocus(RenderWidgetHost* rwh, bool focused) { |
focused_ = focused; |
+ if (!rwh) |
+ return; |
+ |
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()); |
+ rwh->GetView()); |
if (rwhv) { |
ViewHostMsg_TextInputState_Params params; |
params.type = last_text_input_type_; |
@@ -718,9 +721,8 @@ void BrowserPluginGuest::OnResizeGuest( |
void BrowserPluginGuest::OnSetFocus(int browser_plugin_instance_id, |
bool focused) { |
- |
- RenderWidgetHost* rwh = web_contents()->GetRenderWidgetHostView()-> |
- GetRenderWidgetHost(); |
+ RenderWidgetHostView* rwhv = web_contents()->GetRenderWidgetHostView(); |
+ RenderWidgetHost* rwh = rwhv ? rwhv->GetRenderWidgetHost() : NULL; |
lazyboy
2014/09/12 20:56:36
Could this be causing Shim_TestEventName failures?
Fady Samuel
2014/09/12 20:59:52
Possibly but I'm not sure.
|
SetFocus(rwh, focused); |
} |