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

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

Powered by Google App Engine
This is Rietveld 408576698