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

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

Issue 1412923009: Route touch-events for WebViewGuest directly to guest renderer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix null pointer deref when guest is terminated. Created 5 years 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 <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 790 matching lines...) Expand 10 before | Expand all | Expand 10 after
801 } 801 }
802 } 802 }
803 803
804 InitInternal(params, embedder_web_contents); 804 InitInternal(params, embedder_web_contents);
805 805
806 attached_ = true; 806 attached_ = true;
807 has_attached_since_surface_set_ = true; 807 has_attached_since_surface_set_ = true;
808 SendQueuedMessages(); 808 SendQueuedMessages();
809 809
810 delegate_->DidAttach(GetGuestProxyRoutingID()); 810 delegate_->DidAttach(GetGuestProxyRoutingID());
811 RenderWidgetHostViewGuest* rwhv = static_cast<RenderWidgetHostViewGuest*>(
812 web_contents()->GetRenderWidgetHostView());
kenrb 2015/11/25 19:33:06 I don't exactly know how much this is a concern, b
wjmaclean 2015/11/26 13:01:03 I don't think so, but at least the touch events st
kenrb 2015/11/26 16:19:14 OOPIFs don't support touch events yet, but I don't
813 rwhv->RegisterSurfaceNamespaceId();
811 814
812 if (!use_cross_process_frames) 815 if (!use_cross_process_frames)
813 has_render_view_ = true; 816 has_render_view_ = true;
814 817
815 RecordAction(base::UserMetricsAction("BrowserPlugin.Guest.Attached")); 818 RecordAction(base::UserMetricsAction("BrowserPlugin.Guest.Attached"));
816 } 819 }
817 820
818 void BrowserPluginGuest::OnCompositorFrameSwappedACK( 821 void BrowserPluginGuest::OnCompositorFrameSwappedACK(
819 int browser_plugin_instance_id, 822 int browser_plugin_instance_id,
820 const FrameHostMsg_CompositorFrameSwappedACK_Params& params) { 823 const FrameHostMsg_CompositorFrameSwappedACK_Params& params) {
821 RenderWidgetHostImpl::SendSwapCompositorFrameAck(params.producing_route_id, 824 RenderWidgetHostImpl::SendSwapCompositorFrameAck(params.producing_route_id,
822 params.output_surface_id, 825 params.output_surface_id,
823 params.producing_host_id, 826 params.producing_host_id,
824 params.ack); 827 params.ack);
825 last_pending_frame_.reset(); 828 last_pending_frame_.reset();
826 } 829 }
827 830
828 void BrowserPluginGuest::OnDetach(int browser_plugin_instance_id) { 831 void BrowserPluginGuest::OnDetach(int browser_plugin_instance_id) {
829 if (!attached()) 832 if (!attached())
830 return; 833 return;
831 834
832 // This tells BrowserPluginGuest to queue up all IPCs to BrowserPlugin until 835 // This tells BrowserPluginGuest to queue up all IPCs to BrowserPlugin until
833 // it's attached again. 836 // it's attached again.
834 attached_ = false; 837 attached_ = false;
835 838
839 RenderWidgetHostViewGuest* rwhv = static_cast<RenderWidgetHostViewGuest*>(
840 web_contents()->GetRenderWidgetHostView());
841 // If the guest is terminated, our host may already be gone.
842 if (rwhv)
843 rwhv->UnregisterSurfaceNamespaceId();
844
836 delegate_->DidDetach(); 845 delegate_->DidDetach();
837 } 846 }
838 847
839 void BrowserPluginGuest::OnDragStatusUpdate(int browser_plugin_instance_id, 848 void BrowserPluginGuest::OnDragStatusUpdate(int browser_plugin_instance_id,
840 blink::WebDragStatus drag_status, 849 blink::WebDragStatus drag_status,
841 const DropData& drop_data, 850 const DropData& drop_data,
842 blink::WebDragOperationsMask mask, 851 blink::WebDragOperationsMask mask,
843 const gfx::Point& location) { 852 const gfx::Point& location) {
844 RenderViewHost* host = GetWebContents()->GetRenderViewHost(); 853 RenderViewHost* host = GetWebContents()->GetRenderViewHost();
845 auto embedder = owner_web_contents_->GetBrowserPluginEmbedder(); 854 auto embedder = owner_web_contents_->GetBrowserPluginEmbedder();
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
1056 range, character_bounds); 1065 range, character_bounds);
1057 } 1066 }
1058 #endif 1067 #endif
1059 1068
1060 void BrowserPluginGuest::SetContextMenuPosition(const gfx::Point& position) { 1069 void BrowserPluginGuest::SetContextMenuPosition(const gfx::Point& position) {
1061 if (delegate_) 1070 if (delegate_)
1062 delegate_->SetContextMenuPosition(position); 1071 delegate_->SetContextMenuPosition(position);
1063 } 1072 }
1064 1073
1065 } // namespace content 1074 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698