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

Side by Side Diff: content/browser/frame_host/render_widget_host_view_guest.h

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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #ifndef CONTENT_BROWSER_FRAME_HOST_RENDER_WIDGET_HOST_VIEW_GUEST_H_ 5 #ifndef CONTENT_BROWSER_FRAME_HOST_RENDER_WIDGET_HOST_VIEW_GUEST_H_
6 #define CONTENT_BROWSER_FRAME_HOST_RENDER_WIDGET_HOST_VIEW_GUEST_H_ 6 #define CONTENT_BROWSER_FRAME_HOST_RENDER_WIDGET_HOST_VIEW_GUEST_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 21 matching lines...) Expand all
32 // functionality in a diffent place and isn't platform specific. 32 // functionality in a diffent place and isn't platform specific.
33 // The BrowserPlugin is currently a special case for out-of-process rendered 33 // The BrowserPlugin is currently a special case for out-of-process rendered
34 // content and therefore inherits from RenderWidgetHostViewChildFrame. 34 // content and therefore inherits from RenderWidgetHostViewChildFrame.
35 // Eventually all RenderWidgetHostViewGuest code will be subsumed by 35 // Eventually all RenderWidgetHostViewGuest code will be subsumed by
36 // RenderWidgetHostViewChildFrame and this class will be removed. 36 // RenderWidgetHostViewChildFrame and this class will be removed.
37 // 37 //
38 // Some elements that are platform specific will be deal with by delegating 38 // Some elements that are platform specific will be deal with by delegating
39 // the relevant calls to the platform view. 39 // the relevant calls to the platform view.
40 class CONTENT_EXPORT RenderWidgetHostViewGuest 40 class CONTENT_EXPORT RenderWidgetHostViewGuest
41 : public RenderWidgetHostViewChildFrame, 41 : public RenderWidgetHostViewChildFrame,
42 public ui::GestureConsumer, 42 public ui::GestureConsumer {
43 public ui::GestureEventHelper {
44 public: 43 public:
45 RenderWidgetHostViewGuest( 44 RenderWidgetHostViewGuest(
46 RenderWidgetHost* widget, 45 RenderWidgetHost* widget,
47 BrowserPluginGuest* guest, 46 BrowserPluginGuest* guest,
48 base::WeakPtr<RenderWidgetHostViewBase> platform_view); 47 base::WeakPtr<RenderWidgetHostViewBase> platform_view);
49 ~RenderWidgetHostViewGuest() override; 48 ~RenderWidgetHostViewGuest() override;
50 49
51 bool OnMessageReceivedFromEmbedder(const IPC::Message& message, 50 bool OnMessageReceivedFromEmbedder(const IPC::Message& message,
52 RenderWidgetHostImpl* embedder); 51 RenderWidgetHostImpl* embedder);
53 52
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 size_t offset, 90 size_t offset,
92 const gfx::Range& range) override; 91 const gfx::Range& range) override;
93 void SelectionBoundsChanged( 92 void SelectionBoundsChanged(
94 const ViewHostMsg_SelectionBounds_Params& params) override; 93 const ViewHostMsg_SelectionBounds_Params& params) override;
95 void OnSwapCompositorFrame(uint32 output_surface_id, 94 void OnSwapCompositorFrame(uint32 output_surface_id,
96 scoped_ptr<cc::CompositorFrame> frame) override; 95 scoped_ptr<cc::CompositorFrame> frame) override;
97 #if defined(USE_AURA) 96 #if defined(USE_AURA)
98 void ProcessAckedTouchEvent(const TouchEventWithLatencyInfo& touch, 97 void ProcessAckedTouchEvent(const TouchEventWithLatencyInfo& touch,
99 InputEventAckState ack_result) override; 98 InputEventAckState ack_result) override;
100 #endif 99 #endif
100 void ProcessTouchEvent(const blink::WebTouchEvent& event,
101 const ui::LatencyInfo& latency) override;
102 void RegisterSurfaceNamespaceId();
103 void UnregisterSurfaceNamespaceId();
104
101 bool LockMouse() override; 105 bool LockMouse() override;
102 void UnlockMouse() override; 106 void UnlockMouse() override;
103 void GetScreenInfo(blink::WebScreenInfo* results) override; 107 void GetScreenInfo(blink::WebScreenInfo* results) override;
104 bool GetScreenColorProfile(std::vector<char>* color_profile) override; 108 bool GetScreenColorProfile(std::vector<char>* color_profile) override;
105 109
106 #if defined(OS_MACOSX) 110 #if defined(OS_MACOSX)
107 // RenderWidgetHostView implementation. 111 // RenderWidgetHostView implementation.
108 void SetActive(bool active) override; 112 void SetActive(bool active) override;
109 void SetWindowVisibility(bool visible) override; 113 void SetWindowVisibility(bool visible) override;
110 void WindowFrameChanged() override; 114 void WindowFrameChanged() override;
(...skipping 22 matching lines...) Expand all
133 gfx::NativeViewAccessible accessible_parent) override; 137 gfx::NativeViewAccessible accessible_parent) override;
134 gfx::NativeViewId GetParentForWindowlessPlugin() const override; 138 gfx::NativeViewId GetParentForWindowlessPlugin() const override;
135 #endif 139 #endif
136 140
137 void WheelEventAck(const blink::WebMouseWheelEvent& event, 141 void WheelEventAck(const blink::WebMouseWheelEvent& event,
138 InputEventAckState ack_result) override; 142 InputEventAckState ack_result) override;
139 143
140 void GestureEventAck(const blink::WebGestureEvent& event, 144 void GestureEventAck(const blink::WebGestureEvent& event,
141 InputEventAckState ack_result) override; 145 InputEventAckState ack_result) override;
142 146
143 // Overridden from ui::GestureEventHelper.
144 bool CanDispatchToConsumer(ui::GestureConsumer* consumer) override;
145 void DispatchGestureEvent(ui::GestureEvent* event) override;
146 void DispatchCancelTouchEvent(ui::TouchEvent* event) override;
147
148 protected: 147 protected:
149 friend class RenderWidgetHostView; 148 friend class RenderWidgetHostView;
150 149
151 private: 150 private:
152 // Destroys this view without calling |Destroy| on |platform_view_|. 151 // Destroys this view without calling |Destroy| on |platform_view_|.
153 void DestroyGuestView(); 152 void DestroyGuestView();
154 153
155 // Builds and forwards a WebKitGestureEvent to the renderer. 154 // Builds and forwards a WebKitGestureEvent to the renderer.
156 bool ForwardGestureEventToRenderer(ui::GestureEvent* gesture); 155 bool ForwardGestureEventToRenderer(ui::GestureEvent* gesture);
157 156
158 // Process all of the given gestures (passes them on to renderer) 157 // Process all of the given gestures (passes them on to renderer)
159 void ProcessGestures(ui::GestureRecognizer::Gestures* gestures); 158 void ProcessGestures(ui::GestureRecognizer::Gestures* gestures);
160 159
161 RenderWidgetHostViewBase* GetOwnerRenderWidgetHostView() const; 160 RenderWidgetHostViewBase* GetOwnerRenderWidgetHostView() const;
162 161
163 void OnHandleInputEvent(RenderWidgetHostImpl* embedder, 162 void OnHandleInputEvent(RenderWidgetHostImpl* embedder,
164 int browser_plugin_instance_id, 163 int browser_plugin_instance_id,
165 const gfx::Rect& guest_window_rect, 164 const gfx::Rect& guest_window_rect,
166 const blink::WebInputEvent* event); 165 const blink::WebInputEvent* event);
167 166
168 // BrowserPluginGuest and RenderWidgetHostViewGuest's lifetimes are not tied 167 // BrowserPluginGuest and RenderWidgetHostViewGuest's lifetimes are not tied
169 // to one another, therefore we access |guest_| through WeakPtr. 168 // to one another, therefore we access |guest_| through WeakPtr.
170 base::WeakPtr<BrowserPluginGuest> guest_; 169 base::WeakPtr<BrowserPluginGuest> guest_;
171 gfx::Size size_; 170 gfx::Size size_;
172 // The platform view for this RenderWidgetHostView. 171 // The platform view for this RenderWidgetHostView.
173 // RenderWidgetHostViewGuest mostly only cares about stuff related to 172 // RenderWidgetHostViewGuest mostly only cares about stuff related to
174 // compositing, the rest are directly forwared to this |platform_view_|. 173 // compositing, the rest are directly forwared to this |platform_view_|.
175 base::WeakPtr<RenderWidgetHostViewBase> platform_view_; 174 base::WeakPtr<RenderWidgetHostViewBase> platform_view_;
176 #if defined(USE_AURA)
177 scoped_ptr<ui::GestureRecognizer> gesture_recognizer_;
178 #endif
179 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewGuest); 175 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewGuest);
180 }; 176 };
181 177
182 } // namespace content 178 } // namespace content
183 179
184 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_WIDGET_HOST_VIEW_GUEST_H_ 180 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_WIDGET_HOST_VIEW_GUEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698