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

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

Issue 100473010: Adding RenderWidgetHostViewChildFrame for OOPIF view. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: WIP snapshot with major comment rewrite. Created 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_GUEST_H_ 5 #ifndef CONTENT_BROWSER_FRAME_HOST_RENDER_WIDGET_HOST_VIEW_CHILD_FRAME_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_GUEST_H_ 6 #define CONTENT_BROWSER_FRAME_HOST_RENDER_WIDGET_HOST_VIEW_CHILD_FRAME_H_
7
8 #include <vector>
9 7
10 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
11 #include "content/browser/renderer_host/render_widget_host_view_base.h" 9 #include "content/browser/renderer_host/render_widget_host_view_base.h"
12 #include "content/common/content_export.h" 10 #include "content/common/content_export.h"
13 #include "ui/events/event.h"
14 #include "ui/events/gestures/gesture_recognizer.h"
15 #include "ui/events/gestures/gesture_types.h"
16 #include "ui/gfx/native_widget_types.h" 11 #include "ui/gfx/native_widget_types.h"
17 #include "ui/gfx/rect.h" 12 #include "ui/gfx/rect.h"
18 #include "ui/gfx/vector2d_f.h"
19 #include "webkit/common/cursors/webcursor.h"
20
21 #if defined(TOOLKIT_GTK)
22 #include "content/browser/renderer_host/gtk_plugin_container_manager.h"
23 #endif // defined(TOOLKIT_GTK)
24 13
25 namespace content { 14 namespace content {
15 class CrossProcessFrameConnector;
26 class RenderWidgetHost; 16 class RenderWidgetHost;
27 class RenderWidgetHostImpl; 17 class RenderWidgetHostImpl;
28 class BrowserPluginGuest;
29 struct NativeWebKeyboardEvent;
30 18
31 // ----------------------------------------------------------------------------- 19 // -----------------------------------------------------------------------------
32 // See comments in render_widget_host_view.h about this class and its members. 20 // See comments in render_widget_host_view.h about this class and its members.
33 // This version is for the webview plugin which handles a lot of the 21 // RenderWidgetHostViewChildFrame implements the view for a RenderWidgetHost
34 // functionality in a diffent place and isn't platform specific. 22 // associated with content being rendered in a separate process from
35 // 23 // content that is embedding it. This is not a platform-specific class; rather,
36 // Some elements that are platform specific will be deal with by delegating 24 // the embedding renderer process implements the platform containing the
37 // the relevant calls to the platform view. 25 // widget, and the top-level frame's RenderWidgetHostView will ultimately
26 // manage all native widget interaction.
38 // ----------------------------------------------------------------------------- 27 // -----------------------------------------------------------------------------
39 class CONTENT_EXPORT RenderWidgetHostViewGuest 28 class CONTENT_EXPORT RenderWidgetHostViewChildFrame
40 : public RenderWidgetHostViewBase, 29 : public RenderWidgetHostViewBase {
41 public ui::GestureConsumer,
42 public ui::GestureEventHelper {
43 public: 30 public:
44 RenderWidgetHostViewGuest(RenderWidgetHost* widget, 31 RenderWidgetHostViewChildFrame(RenderWidgetHost* widget);
45 BrowserPluginGuest* guest, 32 virtual ~RenderWidgetHostViewChildFrame();
46 RenderWidgetHostView* platform_view); 33
47 virtual ~RenderWidgetHostViewGuest(); 34 void SetCrossProcessFrameConnector(CrossProcessFrameConnector*);
Charlie Reis 2013/12/17 01:09:31 Needs a parameter name.
awong 2013/12/17 02:45:27 Done.
48 35
49 // RenderWidgetHostView implementation. 36 // RenderWidgetHostView implementation.
50 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;
51 virtual void InitAsChild(gfx::NativeView parent_view) OVERRIDE; 37 virtual void InitAsChild(gfx::NativeView parent_view) OVERRIDE;
52 virtual RenderWidgetHost* GetRenderWidgetHost() const OVERRIDE; 38 virtual RenderWidgetHost* GetRenderWidgetHost() const OVERRIDE;
53 virtual void SetSize(const gfx::Size& size) OVERRIDE; 39 virtual void SetSize(const gfx::Size& size) OVERRIDE;
54 virtual void SetBounds(const gfx::Rect& rect) OVERRIDE; 40 virtual void SetBounds(const gfx::Rect& rect) OVERRIDE;
55 virtual gfx::NativeView GetNativeView() const OVERRIDE; 41 virtual void Focus() OVERRIDE;
56 virtual gfx::NativeViewId GetNativeViewId() const OVERRIDE;
57 virtual gfx::NativeViewAccessible GetNativeViewAccessible() OVERRIDE;
58 virtual bool HasFocus() const OVERRIDE; 42 virtual bool HasFocus() const OVERRIDE;
59 virtual bool IsSurfaceAvailableForCopy() const OVERRIDE; 43 virtual bool IsSurfaceAvailableForCopy() const OVERRIDE;
60 virtual void Show() OVERRIDE; 44 virtual void Show() OVERRIDE;
61 virtual void Hide() OVERRIDE; 45 virtual void Hide() OVERRIDE;
62 virtual bool IsShowing() OVERRIDE; 46 virtual bool IsShowing() OVERRIDE;
63 virtual gfx::Rect GetViewBounds() const OVERRIDE; 47 virtual gfx::Rect GetViewBounds() const OVERRIDE;
64 virtual void SetBackground(const SkBitmap& background) OVERRIDE; 48 virtual gfx::NativeView GetNativeView() const OVERRIDE;
49 virtual gfx::NativeViewId GetNativeViewId() const OVERRIDE;
50 virtual gfx::NativeViewAccessible GetNativeViewAccessible() OVERRIDE;
51 virtual void SetBackground(const SkBitmap& background) OVERRIDE {}
52 virtual gfx::Size GetPhysicalBackingSize() const OVERRIDE;
65 #if defined(OS_WIN) && !defined(USE_AURA) 53 #if defined(OS_WIN) && !defined(USE_AURA)
66 virtual void SetClickthroughRegion(SkRegion* region) OVERRIDE; 54 virtual void SetClickthroughRegion(SkRegion* region) OVERRIDE;
67 #endif 55 #endif
68 56
69 // RenderWidgetHostViewPort implementation. 57 // RenderWidgetHostViewPort implementation.
70 virtual void InitAsPopup(RenderWidgetHostView* parent_host_view, 58 virtual void InitAsPopup(RenderWidgetHostView* parent_host_view,
71 const gfx::Rect& pos) OVERRIDE; 59 const gfx::Rect& pos) OVERRIDE;
72 virtual void InitAsFullscreen( 60 virtual void InitAsFullscreen(
73 RenderWidgetHostView* reference_host_view) OVERRIDE; 61 RenderWidgetHostView* reference_host_view) OVERRIDE;
74 virtual void WasShown() OVERRIDE; 62 virtual void WasShown() OVERRIDE;
75 virtual void WasHidden() OVERRIDE; 63 virtual void WasHidden() OVERRIDE;
76 virtual void MovePluginWindows( 64 virtual void MovePluginWindows(
77 const gfx::Vector2d& scroll_offset, 65 const gfx::Vector2d& scroll_offset,
78 const std::vector<WebPluginGeometry>& moves) OVERRIDE; 66 const std::vector<WebPluginGeometry>& moves) OVERRIDE {}
79 virtual void Focus() OVERRIDE;
80 virtual void Blur() OVERRIDE; 67 virtual void Blur() OVERRIDE;
81 virtual void UpdateCursor(const WebCursor& cursor) OVERRIDE; 68 virtual void UpdateCursor(const WebCursor& cursor) OVERRIDE {}
82 virtual void SetIsLoading(bool is_loading) OVERRIDE; 69 virtual void SetIsLoading(bool is_loading) OVERRIDE;
83 virtual void TextInputTypeChanged(ui::TextInputType type, 70 virtual void TextInputTypeChanged(ui::TextInputType type,
84 ui::TextInputMode input_mode, 71 ui::TextInputMode input_mode,
85 bool can_compose_inline) OVERRIDE; 72 bool can_compose_inline) OVERRIDE;
86 virtual void ImeCancelComposition() OVERRIDE; 73 virtual void ImeCancelComposition() OVERRIDE;
87 #if defined(OS_MACOSX) || defined(OS_WIN) || defined(USE_AURA) 74 #if defined(OS_MACOSX) || defined(OS_WIN) || defined(USE_AURA)
88 virtual void ImeCompositionRangeChanged( 75 virtual void ImeCompositionRangeChanged(
89 const gfx::Range& range, 76 const gfx::Range& range,
90 const std::vector<gfx::Rect>& character_bounds) OVERRIDE; 77 const std::vector<gfx::Rect>& character_bounds) OVERRIDE;
91 #endif 78 #endif
92 virtual void DidUpdateBackingStore( 79 virtual void DidUpdateBackingStore(
93 const gfx::Rect& scroll_rect, 80 const gfx::Rect& scroll_rect,
94 const gfx::Vector2d& scroll_delta, 81 const gfx::Vector2d& scroll_delta,
95 const std::vector<gfx::Rect>& copy_rects, 82 const std::vector<gfx::Rect>& copy_rects,
96 const ui::LatencyInfo& latency_info) OVERRIDE; 83 const ui::LatencyInfo& latency_info) OVERRIDE;
97 virtual void RenderProcessGone(base::TerminationStatus status, 84 virtual void RenderProcessGone(base::TerminationStatus status,
98 int error_code) OVERRIDE; 85 int error_code) OVERRIDE {}
99 virtual void Destroy() OVERRIDE; 86 virtual void Destroy() OVERRIDE;
100 virtual void WillDestroyRenderWidget(RenderWidgetHost* rwh) {} 87 virtual void SetTooltipText(const string16& tooltip_text) OVERRIDE {}
101 virtual void SetTooltipText(const base::string16& tooltip_text) OVERRIDE; 88 virtual void SelectionChanged(const string16& text,
102 virtual void SelectionChanged(const base::string16& text,
103 size_t offset, 89 size_t offset,
104 const gfx::Range& range) OVERRIDE; 90 const gfx::Range& range) OVERRIDE {}
105 virtual void SelectionBoundsChanged( 91 virtual void SelectionBoundsChanged(
106 const ViewHostMsg_SelectionBounds_Params& params) OVERRIDE; 92 const ViewHostMsg_SelectionBounds_Params& params) OVERRIDE {}
107 virtual void ScrollOffsetChanged() OVERRIDE; 93 virtual void ScrollOffsetChanged() OVERRIDE;
108 virtual BackingStore* AllocBackingStore(const gfx::Size& size) OVERRIDE; 94 virtual BackingStore* AllocBackingStore(const gfx::Size& size) OVERRIDE;
109 virtual void CopyFromCompositingSurface( 95 virtual void CopyFromCompositingSurface(
110 const gfx::Rect& src_subrect, 96 const gfx::Rect& src_subrect,
111 const gfx::Size& dst_size, 97 const gfx::Size& dst_size,
112 const base::Callback<void(bool, const SkBitmap&)>& callback) OVERRIDE; 98 const base::Callback<void(bool, const SkBitmap&)>& callback) OVERRIDE;
113 virtual void CopyFromCompositingSurfaceToVideoFrame( 99 virtual void CopyFromCompositingSurfaceToVideoFrame(
114 const gfx::Rect& src_subrect, 100 const gfx::Rect& src_subrect,
115 const scoped_refptr<media::VideoFrame>& target, 101 const scoped_refptr<media::VideoFrame>& target,
116 const base::Callback<void(bool)>& callback) OVERRIDE; 102 const base::Callback<void(bool)>& callback) OVERRIDE;
117 virtual bool CanCopyToVideoFrame() const OVERRIDE; 103 virtual bool CanCopyToVideoFrame() const OVERRIDE;
118 virtual void OnAcceleratedCompositingStateChange() OVERRIDE; 104 virtual void OnAcceleratedCompositingStateChange() OVERRIDE;
119 virtual void AcceleratedSurfaceInitialized(int host_id, 105 virtual void AcceleratedSurfaceInitialized(int host_id,
120 int route_id) OVERRIDE; 106 int route_id) OVERRIDE;
121 virtual void AcceleratedSurfaceBuffersSwapped( 107 virtual void AcceleratedSurfaceBuffersSwapped(
122 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params, 108 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params,
123 int gpu_host_id) OVERRIDE; 109 int gpu_host_id) OVERRIDE;
124 virtual void AcceleratedSurfacePostSubBuffer( 110 virtual void AcceleratedSurfacePostSubBuffer(
125 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params, 111 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params,
126 int gpu_host_id) OVERRIDE; 112 int gpu_host_id) OVERRIDE {}
113 virtual void AcceleratedSurfaceSuspend() OVERRIDE;
114 virtual void AcceleratedSurfaceRelease() OVERRIDE;
115 virtual bool HasAcceleratedSurface(const gfx::Size& desired_size) OVERRIDE;
127 virtual void OnSwapCompositorFrame( 116 virtual void OnSwapCompositorFrame(
128 uint32 output_surface_id, 117 uint32 output_surface_id,
129 scoped_ptr<cc::CompositorFrame> frame) OVERRIDE; 118 scoped_ptr<cc::CompositorFrame> frame) OVERRIDE;
130 virtual void AcceleratedSurfaceSuspend() OVERRIDE; 119 virtual void GetScreenInfo(blink::WebScreenInfo* results) OVERRIDE {}
131 virtual void AcceleratedSurfaceRelease() OVERRIDE;
132 virtual bool HasAcceleratedSurface(const gfx::Size& desired_size) OVERRIDE;
133 virtual void SetHasHorizontalScrollbar(
134 bool has_horizontal_scrollbar) OVERRIDE;
135 virtual void SetScrollOffsetPinning(
136 bool is_pinned_to_left, bool is_pinned_to_right) OVERRIDE;
137 virtual gfx::Rect GetBoundsInRootWindow() OVERRIDE; 120 virtual gfx::Rect GetBoundsInRootWindow() OVERRIDE;
138 virtual gfx::GLSurfaceHandle GetCompositingSurface() OVERRIDE; 121 virtual gfx::GLSurfaceHandle GetCompositingSurface() OVERRIDE;
122 virtual void SetHasHorizontalScrollbar(
123 bool has_horizontal_scrollbar) OVERRIDE {}
124 virtual void SetScrollOffsetPinning(
125 bool is_pinned_to_left, bool is_pinned_to_right) OVERRIDE {}
139 #if defined(OS_WIN) || defined(USE_AURA) 126 #if defined(OS_WIN) || defined(USE_AURA)
140 virtual void ProcessAckedTouchEvent( 127 virtual void ProcessAckedTouchEvent(
141 const TouchEventWithLatencyInfo& touch, 128 const TouchEventWithLatencyInfo& touch,
142 InputEventAckState ack_result) OVERRIDE; 129 InputEventAckState ack_result) OVERRIDE {}
143 #endif // defined(OS_WIN) || defined(USE_AURA) 130 #endif // defined(OS_WIN) || defined(USE_AURA)
144 virtual bool LockMouse() OVERRIDE; 131 virtual bool LockMouse() OVERRIDE;
145 virtual void UnlockMouse() OVERRIDE; 132 virtual void UnlockMouse() OVERRIDE {}
146 virtual void GetScreenInfo(blink::WebScreenInfo* results) OVERRIDE;
147 virtual void OnAccessibilityEvents( 133 virtual void OnAccessibilityEvents(
148 const std::vector<AccessibilityHostMsg_EventParams>& 134 const std::vector<AccessibilityHostMsg_EventParams>&
149 params) OVERRIDE; 135 params) OVERRIDE {}
150 136
151 #if defined(OS_MACOSX) 137 #if defined(OS_MACOSX)
152 // RenderWidgetHostView implementation. 138 // RenderWidgetHostView implementation.
153 virtual void SetActive(bool active) OVERRIDE; 139 virtual void SetActive(bool active) OVERRIDE {}
154 virtual void SetTakesFocusOnlyOnMouseDown(bool flag) OVERRIDE; 140 virtual void SetTakesFocusOnlyOnMouseDown(bool flag) OVERRIDE {}
155 virtual void SetWindowVisibility(bool visible) OVERRIDE; 141 virtual void SetWindowVisibility(bool visible) OVERRIDE {}
156 virtual void WindowFrameChanged() OVERRIDE; 142 virtual void WindowFrameChanged() OVERRIDE {}
157 virtual void ShowDefinitionForSelection() OVERRIDE; 143 virtual void ShowDefinitionForSelection() OVERRIDE {}
158 virtual bool SupportsSpeech() const OVERRIDE; 144 virtual bool SupportsSpeech() const OVERRIDE;
159 virtual void SpeakSelection() OVERRIDE; 145 virtual void SpeakSelection() OVERRIDE {}
160 virtual bool IsSpeaking() const OVERRIDE; 146 virtual bool IsSpeaking() const OVERRIDE;
161 virtual void StopSpeaking() OVERRIDE; 147 virtual void StopSpeaking() OVERRIDE{}
162 148
163 // RenderWidgetHostViewPort implementation. 149 // RenderWidgetHostViewPort implementation.
164 virtual void AboutToWaitForBackingStoreMsg() OVERRIDE; 150 virtual void AboutToWaitForBackingStoreMsg() OVERRIDE {}
165 virtual bool PostProcessEventForPluginIme( 151 virtual bool PostProcessEventForPluginIme(
166 const NativeWebKeyboardEvent& event) OVERRIDE; 152 const NativeWebKeyboardEvent& event) OVERRIDE;
167 #endif // defined(OS_MACOSX) 153 #endif // defined(OS_MACOSX)
168 154
169 #if defined(OS_ANDROID) 155 #if defined(OS_ANDROID)
170 // RenderWidgetHostViewPort implementation. 156 // RenderWidgetHostViewPort implementation.
171 virtual void ShowDisambiguationPopup(const gfx::Rect& target_rect, 157 virtual void ShowDisambiguationPopup(const gfx::Rect& target_rect,
172 const SkBitmap& zoomed_bitmap) OVERRIDE; 158 const SkBitmap& zoomed_bitmap)
173 virtual void HasTouchEventHandlers(bool need_touch_events) OVERRIDE; 159 OVERRIDE {}
160 virtual void HasTouchEventHandlers(bool need_touch_events) OVERRIDE {}
174 #endif // defined(OS_ANDROID) 161 #endif // defined(OS_ANDROID)
175 162
176 #if defined(TOOLKIT_GTK) 163 #if defined(TOOLKIT_GTK)
177 virtual GdkEventButton* GetLastMouseDown() OVERRIDE; 164 virtual GdkEventButton* GetLastMouseDown() OVERRIDE;
178 virtual gfx::NativeView BuildInputMethodsGtkMenu() OVERRIDE; 165 virtual gfx::NativeView BuildInputMethodsGtkMenu() OVERRIDE;
179 #endif // defined(TOOLKIT_GTK) 166 #endif // defined(TOOLKIT_GTK)
180 167
181 #if defined(OS_WIN) && !defined(USE_AURA) 168 #if defined(OS_WIN) && !defined(USE_AURA)
182 virtual void WillWmDestroy() OVERRIDE; 169 virtual void WillWmDestroy() OVERRIDE {}
183 #endif // defined(OS_WIN) && !defined(USE_AURA) 170 #endif // defined(OS_WIN) && !defined(USE_AURA)
184 171
185 #if defined(OS_WIN) && defined(USE_AURA) 172 #if defined(OS_WIN) && defined(USE_AURA)
186 virtual void SetParentNativeViewAccessible( 173 virtual void SetParentNativeViewAccessible(
187 gfx::NativeViewAccessible accessible_parent) OVERRIDE; 174 gfx::NativeViewAccessible accessible_parent) OVERRIDE {}
188 virtual gfx::NativeViewId GetParentForWindowlessPlugin() const OVERRIDE; 175 virtual gfx::NativeViewId GetParentForWindowlessPlugin() const OVERRIDE;
189 #endif 176 #endif
190 177
191 // Overridden from ui::GestureEventHelper.
192 virtual bool CanDispatchToConsumer(ui::GestureConsumer* consumer) OVERRIDE;
193 virtual void DispatchPostponedGestureEvent(ui::GestureEvent* event) OVERRIDE;
194 virtual void DispatchCancelTouchEvent(ui::TouchEvent* event) OVERRIDE;
195
196 protected: 178 protected:
197 friend class RenderWidgetHostView; 179 friend class RenderWidgetHostView;
198 180
199 private: 181 // Members will become private when RenderWidgetHostViewGuest is removed.
200 // Destroys this view without calling |Destroy| on |platform_view_|.
201 void DestroyGuestView();
202
203 // Builds and forwards a WebKitGestureEvent to the renderer.
204 bool ForwardGestureEventToRenderer(ui::GestureEvent* gesture);
205
206 // Process all of the given gestures (passes them on to renderer)
207 void ProcessGestures(ui::GestureRecognizer::Gestures* gestures);
208
209 // The model object. 182 // The model object.
210 RenderWidgetHostImpl* host_; 183 RenderWidgetHostImpl* host_;
211 184
212 BrowserPluginGuest *guest_; 185 // frame_connector_ provides a platform abstraction. Messages
186 // sent through it are routed to the embedding renderer process.
187 CrossProcessFrameConnector* frame_connector_;
188
213 gfx::Size size_; 189 gfx::Size size_;
214 // The platform view for this RenderWidgetHostView. 190
215 // RenderWidgetHostViewGuest mostly only cares about stuff related to 191 private:
216 // compositing, the rest are directly forwared to this |platform_view_|. 192 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewChildFrame);
217 RenderWidgetHostViewPort* platform_view_;
218 #if defined(OS_WIN) || defined(USE_AURA)
219 scoped_ptr<ui::GestureRecognizer> gesture_recognizer_;
220 #endif // defined(OS_WIN) || defined(USE_AURA)
221 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewGuest);
222 }; 193 };
223 194
224 } // namespace content 195 } // namespace content
225 196
226 #endif // CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_GUEST_H_ 197 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_WIDGET_HOST_VIEW_CHILD_FRAME_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698