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

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

Issue 1879453002: Reset Text Input State for RenderWidgetHostView before RenderWidgetHost Detaches from Delegate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added a Test Created 4 years, 8 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
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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 18 matching lines...) Expand all
29 #include "content/browser/renderer_host/render_widget_host_view_base.h" 29 #include "content/browser/renderer_host/render_widget_host_view_base.h"
30 #include "content/browser/web_contents/web_contents_impl.h" 30 #include "content/browser/web_contents/web_contents_impl.h"
31 #include "content/browser/web_contents/web_contents_view_guest.h" 31 #include "content/browser/web_contents/web_contents_view_guest.h"
32 #include "content/common/browser_plugin/browser_plugin_constants.h" 32 #include "content/common/browser_plugin/browser_plugin_constants.h"
33 #include "content/common/browser_plugin/browser_plugin_messages.h" 33 #include "content/common/browser_plugin/browser_plugin_messages.h"
34 #include "content/common/content_constants_internal.h" 34 #include "content/common/content_constants_internal.h"
35 #include "content/common/drag_messages.h" 35 #include "content/common/drag_messages.h"
36 #include "content/common/host_shared_bitmap_manager.h" 36 #include "content/common/host_shared_bitmap_manager.h"
37 #include "content/common/input_messages.h" 37 #include "content/common/input_messages.h"
38 #include "content/common/site_isolation_policy.h" 38 #include "content/common/site_isolation_policy.h"
39 #include "content/common/text_input_state.h"
39 #include "content/common/view_messages.h" 40 #include "content/common/view_messages.h"
40 #include "content/public/browser/browser_context.h" 41 #include "content/public/browser/browser_context.h"
41 #include "content/public/browser/browser_plugin_guest_manager.h" 42 #include "content/public/browser/browser_plugin_guest_manager.h"
42 #include "content/public/browser/content_browser_client.h" 43 #include "content/public/browser/content_browser_client.h"
43 #include "content/public/browser/guest_host.h" 44 #include "content/public/browser/guest_host.h"
44 #include "content/public/browser/render_widget_host_view.h" 45 #include "content/public/browser/render_widget_host_view.h"
45 #include "content/public/browser/user_metrics.h" 46 #include "content/public/browser/user_metrics.h"
46 #include "content/public/browser/web_contents_observer.h" 47 #include "content/public/browser/web_contents_observer.h"
47 #include "content/public/common/browser_plugin_guest_mode.h" 48 #include "content/public/common/browser_plugin_guest_mode.h"
48 #include "content/public/common/drop_data.h" 49 #include "content/public/common/drop_data.h"
(...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after
769 rwhv->RegisterSurfaceNamespaceId(); 770 rwhv->RegisterSurfaceNamespaceId();
770 has_render_view_ = true; 771 has_render_view_ = true;
771 772
772 RecordAction(base::UserMetricsAction("BrowserPlugin.Guest.Attached")); 773 RecordAction(base::UserMetricsAction("BrowserPlugin.Guest.Attached"));
773 } 774 }
774 775
775 void BrowserPluginGuest::OnDetach(int browser_plugin_instance_id) { 776 void BrowserPluginGuest::OnDetach(int browser_plugin_instance_id) {
776 if (!attached()) 777 if (!attached())
777 return; 778 return;
778 779
780 // The BrowserPluginGuest loses the link to |owner_web_contents_|. Therefore,
781 // the RenderWidgetHostViewGuest will not get a chance to update its text
782 // input state which is tracked by |owner_web_contents_| (crbug.com/602144).
EhsanK 2016/04/11 21:59:18 Beyond this point, |attached_ = false| and hence,
Charlie Reis 2016/04/11 22:18:16 Ok, I'll defer to lazyboy@ here.
783 OnTextInputStateChanged(TextInputState());
Charlie Reis 2016/04/11 20:24:52 This wasn't in patch set 1. Is it also needed to
EhsanK 2016/04/11 21:59:17 Yes. I have added some comments to crbug.com/60214
Charlie Reis 2016/04/11 22:18:16 Acknowledged.
784
779 // This tells BrowserPluginGuest to queue up all IPCs to BrowserPlugin until 785 // This tells BrowserPluginGuest to queue up all IPCs to BrowserPlugin until
780 // it's attached again. 786 // it's attached again.
781 attached_ = false; 787 attached_ = false;
782 788
783 RenderWidgetHostViewChildFrame* rwhv = 789 RenderWidgetHostViewChildFrame* rwhv =
784 static_cast<RenderWidgetHostViewChildFrame*>( 790 static_cast<RenderWidgetHostViewChildFrame*>(
785 web_contents()->GetRenderWidgetHostView()); 791 web_contents()->GetRenderWidgetHostView());
786 // If the guest is terminated, our host may already be gone. 792 // If the guest is terminated, our host may already be gone.
787 if (rwhv) 793 if (rwhv)
788 rwhv->UnregisterSurfaceNamespaceId(); 794 rwhv->UnregisterSurfaceNamespaceId();
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
1002 range, character_bounds); 1008 range, character_bounds);
1003 } 1009 }
1004 #endif 1010 #endif
1005 1011
1006 void BrowserPluginGuest::SetContextMenuPosition(const gfx::Point& position) { 1012 void BrowserPluginGuest::SetContextMenuPosition(const gfx::Point& position) {
1007 if (delegate_) 1013 if (delegate_)
1008 delegate_->SetContextMenuPosition(position); 1014 delegate_->SetContextMenuPosition(position);
1009 } 1015 }
1010 1016
1011 } // namespace content 1017 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698