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

Side by Side Diff: content/browser/browser_plugin/browser_plugin_guest.cc

Issue 564153003: Browser Plugin: Don't crash browser when reloading crashed webview (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update BrowserPluginGuest state even if NULL 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 unified diff | Download patch
« no previous file with comments | « chrome/test/data/extensions/platform_apps/web_view/shim/main.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/browser_plugin/browser_plugin_guest.h" 5 #include "content/browser/browser_plugin/browser_plugin_guest.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/pickle.h" 10 #include "base/pickle.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 is_in_destruction_ = true; 102 is_in_destruction_ = true;
103 embedder_web_contents_ = NULL; 103 embedder_web_contents_ = NULL;
104 } 104 }
105 105
106 base::WeakPtr<BrowserPluginGuest> BrowserPluginGuest::AsWeakPtr() { 106 base::WeakPtr<BrowserPluginGuest> BrowserPluginGuest::AsWeakPtr() {
107 return weak_ptr_factory_.GetWeakPtr(); 107 return weak_ptr_factory_.GetWeakPtr();
108 } 108 }
109 109
110 void BrowserPluginGuest::SetFocus(RenderWidgetHost* rwh, bool focused) { 110 void BrowserPluginGuest::SetFocus(RenderWidgetHost* rwh, bool focused) {
111 focused_ = focused; 111 focused_ = focused;
112 if (!rwh)
113 return;
114
112 rwh->Send(new InputMsg_SetFocus(rwh->GetRoutingID(), focused)); 115 rwh->Send(new InputMsg_SetFocus(rwh->GetRoutingID(), focused));
113 if (!focused && mouse_locked_) 116 if (!focused && mouse_locked_)
114 OnUnlockMouse(); 117 OnUnlockMouse();
115 118
116 // Restore the last seen state of text input to the view. 119 // Restore the last seen state of text input to the view.
117 RenderWidgetHostViewBase* rwhv = static_cast<RenderWidgetHostViewBase*>( 120 RenderWidgetHostViewBase* rwhv = static_cast<RenderWidgetHostViewBase*>(
118 web_contents()->GetRenderWidgetHostView()); 121 rwh->GetView());
119 if (rwhv) { 122 if (rwhv) {
120 ViewHostMsg_TextInputState_Params params; 123 ViewHostMsg_TextInputState_Params params;
121 params.type = last_text_input_type_; 124 params.type = last_text_input_type_;
122 params.mode = last_input_mode_; 125 params.mode = last_input_mode_;
123 params.can_compose_inline = last_can_compose_inline_; 126 params.can_compose_inline = last_can_compose_inline_;
124 rwhv->TextInputStateChanged(params); 127 rwhv->TextInputStateChanged(params);
125 } 128 }
126 } 129 }
127 130
128 bool BrowserPluginGuest::LockMouse(bool allowed) { 131 bool BrowserPluginGuest::LockMouse(bool allowed) {
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after
711 714
712 // Just resize the WebContents and repaint if needed. 715 // Just resize the WebContents and repaint if needed.
713 if (!params.view_size.IsEmpty()) 716 if (!params.view_size.IsEmpty())
714 GetWebContents()->GetView()->SizeContents(params.view_size); 717 GetWebContents()->GetView()->SizeContents(params.view_size);
715 if (params.repaint) 718 if (params.repaint)
716 Send(new ViewMsg_Repaint(routing_id(), params.view_size)); 719 Send(new ViewMsg_Repaint(routing_id(), params.view_size));
717 } 720 }
718 721
719 void BrowserPluginGuest::OnSetFocus(int browser_plugin_instance_id, 722 void BrowserPluginGuest::OnSetFocus(int browser_plugin_instance_id,
720 bool focused) { 723 bool focused) {
721 724 RenderWidgetHostView* rwhv = web_contents()->GetRenderWidgetHostView();
722 RenderWidgetHost* rwh = web_contents()->GetRenderWidgetHostView()-> 725 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.
723 GetRenderWidgetHost();
724 SetFocus(rwh, focused); 726 SetFocus(rwh, focused);
725 } 727 }
726 728
727 void BrowserPluginGuest::OnSetEditCommandsForNextKeyEvent( 729 void BrowserPluginGuest::OnSetEditCommandsForNextKeyEvent(
728 int browser_plugin_instance_id, 730 int browser_plugin_instance_id,
729 const std::vector<EditCommand>& edit_commands) { 731 const std::vector<EditCommand>& edit_commands) {
730 Send(new InputMsg_SetEditCommandsForNextKeyEvent(routing_id(), 732 Send(new InputMsg_SetEditCommandsForNextKeyEvent(routing_id(),
731 edit_commands)); 733 edit_commands));
732 } 734 }
733 735
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
837 void BrowserPluginGuest::OnImeCompositionRangeChanged( 839 void BrowserPluginGuest::OnImeCompositionRangeChanged(
838 const gfx::Range& range, 840 const gfx::Range& range,
839 const std::vector<gfx::Rect>& character_bounds) { 841 const std::vector<gfx::Rect>& character_bounds) {
840 static_cast<RenderWidgetHostViewBase*>( 842 static_cast<RenderWidgetHostViewBase*>(
841 web_contents()->GetRenderWidgetHostView())->ImeCompositionRangeChanged( 843 web_contents()->GetRenderWidgetHostView())->ImeCompositionRangeChanged(
842 range, character_bounds); 844 range, character_bounds);
843 } 845 }
844 #endif 846 #endif
845 847
846 } // namespace content 848 } // namespace content
OLDNEW
« no previous file with comments | « chrome/test/data/extensions/platform_apps/web_view/shim/main.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698