Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_GUEST_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_GUEST_H_ |
|
nasko
2013/12/20 17:21:05
The guard should be updated to reflect the new pat
awong
2013/12/20 23:53:38
Done.
| |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_GUEST_H_ | 6 #define CONTENT_BROWSER_RENDERER_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" |
| 11 #include "content/browser/renderer_host/render_widget_host_view_base.h" | 11 #include "content/browser/frame_host/render_widget_host_view_child_frame.h" |
| 12 #include "content/common/content_export.h" | 12 #include "content/common/content_export.h" |
| 13 #include "ui/events/event.h" | 13 #include "ui/events/event.h" |
| 14 #include "ui/events/gestures/gesture_recognizer.h" | 14 #include "ui/events/gestures/gesture_recognizer.h" |
| 15 #include "ui/events/gestures/gesture_types.h" | 15 #include "ui/events/gestures/gesture_types.h" |
| 16 #include "ui/gfx/native_widget_types.h" | 16 #include "ui/gfx/native_widget_types.h" |
| 17 #include "ui/gfx/rect.h" | 17 #include "ui/gfx/rect.h" |
| 18 #include "ui/gfx/vector2d_f.h" | 18 #include "ui/gfx/vector2d_f.h" |
| 19 #include "webkit/common/cursors/webcursor.h" | 19 #include "webkit/common/cursors/webcursor.h" |
| 20 | 20 |
| 21 #if defined(TOOLKIT_GTK) | 21 #if defined(TOOLKIT_GTK) |
| 22 #include "content/browser/renderer_host/gtk_plugin_container_manager.h" | 22 #include "content/browser/renderer_host/gtk_plugin_container_manager.h" |
| 23 #endif // defined(TOOLKIT_GTK) | 23 #endif // defined(TOOLKIT_GTK) |
| 24 | 24 |
| 25 namespace content { | 25 namespace content { |
| 26 class RenderWidgetHost; | 26 class RenderWidgetHost; |
| 27 class RenderWidgetHostImpl; | 27 class RenderWidgetHostImpl; |
| 28 class BrowserPluginGuest; | 28 class BrowserPluginGuest; |
| 29 struct NativeWebKeyboardEvent; | 29 struct NativeWebKeyboardEvent; |
| 30 | 30 |
| 31 // ----------------------------------------------------------------------------- | 31 // ----------------------------------------------------------------------------- |
| 32 // See comments in render_widget_host_view.h about this class and its members. | 32 // 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 | 33 // This version is for the webview plugin which handles a lot of the |
| 34 // functionality in a diffent place and isn't platform specific. | 34 // functionality in a diffent place and isn't platform specific. |
| 35 // The webview plugin is currently a special case for out-of-process rendered | |
|
nasko
2013/12/20 17:21:05
nit: It should be either <webview> or BrowserPlugi
awong
2013/12/20 23:53:38
Done.
| |
| 36 // content, and therefore inherits RenderWidgetHostViewChildFrame. Eventually | |
| 37 // all RenderWidgetHostViewGuest code will be subsumed by | |
| 38 // RenderWidgetHostViewChildFrame and this class will be removed. | |
| 35 // | 39 // |
| 36 // Some elements that are platform specific will be deal with by delegating | 40 // Some elements that are platform specific will be deal with by delegating |
| 37 // the relevant calls to the platform view. | 41 // the relevant calls to the platform view. |
| 38 // ----------------------------------------------------------------------------- | 42 // ----------------------------------------------------------------------------- |
| 39 class CONTENT_EXPORT RenderWidgetHostViewGuest | 43 class CONTENT_EXPORT RenderWidgetHostViewGuest |
| 40 : public RenderWidgetHostViewBase, | 44 : public RenderWidgetHostViewChildFrame, |
| 41 public ui::GestureConsumer, | 45 public ui::GestureConsumer, |
| 42 public ui::GestureEventHelper { | 46 public ui::GestureEventHelper { |
| 43 public: | 47 public: |
| 44 RenderWidgetHostViewGuest(RenderWidgetHost* widget, | 48 RenderWidgetHostViewGuest(RenderWidgetHost* widget, |
| 45 BrowserPluginGuest* guest, | 49 BrowserPluginGuest* guest, |
| 46 RenderWidgetHostView* platform_view); | 50 RenderWidgetHostView* platform_view); |
| 47 virtual ~RenderWidgetHostViewGuest(); | 51 virtual ~RenderWidgetHostViewGuest(); |
| 48 | 52 |
| 49 // RenderWidgetHostView implementation. | 53 // RenderWidgetHostView implementation. |
| 50 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; | 54 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; |
| 51 virtual void InitAsChild(gfx::NativeView parent_view) OVERRIDE; | 55 virtual void InitAsChild(gfx::NativeView parent_view) OVERRIDE; |
| 52 virtual RenderWidgetHost* GetRenderWidgetHost() const OVERRIDE; | |
| 53 virtual void SetSize(const gfx::Size& size) OVERRIDE; | 56 virtual void SetSize(const gfx::Size& size) OVERRIDE; |
| 54 virtual void SetBounds(const gfx::Rect& rect) OVERRIDE; | 57 virtual void SetBounds(const gfx::Rect& rect) OVERRIDE; |
| 55 virtual gfx::NativeView GetNativeView() const OVERRIDE; | 58 virtual gfx::NativeView GetNativeView() const OVERRIDE; |
| 56 virtual gfx::NativeViewId GetNativeViewId() const OVERRIDE; | 59 virtual gfx::NativeViewId GetNativeViewId() const OVERRIDE; |
| 57 virtual gfx::NativeViewAccessible GetNativeViewAccessible() OVERRIDE; | 60 virtual gfx::NativeViewAccessible GetNativeViewAccessible() OVERRIDE; |
| 58 virtual bool HasFocus() const OVERRIDE; | |
| 59 virtual bool IsSurfaceAvailableForCopy() const OVERRIDE; | |
| 60 virtual void Show() OVERRIDE; | |
| 61 virtual void Hide() OVERRIDE; | |
| 62 virtual bool IsShowing() OVERRIDE; | |
| 63 virtual gfx::Rect GetViewBounds() const OVERRIDE; | 61 virtual gfx::Rect GetViewBounds() const OVERRIDE; |
| 64 virtual void SetBackground(const SkBitmap& background) OVERRIDE; | 62 virtual void SetBackground(const SkBitmap& background) OVERRIDE; |
| 65 #if defined(OS_WIN) && !defined(USE_AURA) | 63 virtual gfx::Size GetPhysicalBackingSize() const OVERRIDE; |
| 66 virtual void SetClickthroughRegion(SkRegion* region) OVERRIDE; | |
| 67 #endif | |
| 68 | 64 |
| 69 // RenderWidgetHostViewPort implementation. | 65 // RenderWidgetHostViewPort implementation. |
| 70 virtual void InitAsPopup(RenderWidgetHostView* parent_host_view, | 66 virtual void InitAsPopup(RenderWidgetHostView* parent_host_view, |
| 71 const gfx::Rect& pos) OVERRIDE; | 67 const gfx::Rect& pos) OVERRIDE; |
| 72 virtual void InitAsFullscreen( | 68 virtual void InitAsFullscreen( |
| 73 RenderWidgetHostView* reference_host_view) OVERRIDE; | 69 RenderWidgetHostView* reference_host_view) OVERRIDE; |
| 74 virtual void WasShown() OVERRIDE; | 70 virtual void WasShown() OVERRIDE; |
| 75 virtual void WasHidden() OVERRIDE; | 71 virtual void WasHidden() OVERRIDE; |
| 76 virtual void MovePluginWindows( | 72 virtual void MovePluginWindows( |
| 77 const gfx::Vector2d& scroll_offset, | 73 const gfx::Vector2d& scroll_offset, |
| 78 const std::vector<WebPluginGeometry>& moves) OVERRIDE; | 74 const std::vector<WebPluginGeometry>& moves) OVERRIDE; |
| 79 virtual void Focus() OVERRIDE; | |
| 80 virtual void Blur() OVERRIDE; | |
| 81 virtual void UpdateCursor(const WebCursor& cursor) OVERRIDE; | 75 virtual void UpdateCursor(const WebCursor& cursor) OVERRIDE; |
| 82 virtual void SetIsLoading(bool is_loading) OVERRIDE; | 76 virtual void SetIsLoading(bool is_loading) OVERRIDE; |
| 83 virtual void TextInputTypeChanged(ui::TextInputType type, | 77 virtual void TextInputTypeChanged(ui::TextInputType type, |
| 84 ui::TextInputMode input_mode, | 78 ui::TextInputMode input_mode, |
| 85 bool can_compose_inline) OVERRIDE; | 79 bool can_compose_inline) OVERRIDE; |
| 86 virtual void ImeCancelComposition() OVERRIDE; | 80 virtual void ImeCancelComposition() OVERRIDE; |
| 87 #if defined(OS_MACOSX) || defined(OS_WIN) || defined(USE_AURA) | 81 #if defined(OS_MACOSX) || defined(OS_WIN) || defined(USE_AURA) |
| 88 virtual void ImeCompositionRangeChanged( | 82 virtual void ImeCompositionRangeChanged( |
| 89 const gfx::Range& range, | 83 const gfx::Range& range, |
| 90 const std::vector<gfx::Rect>& character_bounds) OVERRIDE; | 84 const std::vector<gfx::Rect>& character_bounds) OVERRIDE; |
| 91 #endif | 85 #endif |
| 92 virtual void DidUpdateBackingStore( | 86 virtual void DidUpdateBackingStore( |
| 93 const gfx::Rect& scroll_rect, | 87 const gfx::Rect& scroll_rect, |
| 94 const gfx::Vector2d& scroll_delta, | 88 const gfx::Vector2d& scroll_delta, |
| 95 const std::vector<gfx::Rect>& copy_rects, | 89 const std::vector<gfx::Rect>& copy_rects, |
| 96 const ui::LatencyInfo& latency_info) OVERRIDE; | 90 const ui::LatencyInfo& latency_info) OVERRIDE; |
| 97 virtual void RenderProcessGone(base::TerminationStatus status, | 91 virtual void RenderProcessGone(base::TerminationStatus status, |
| 98 int error_code) OVERRIDE; | 92 int error_code) OVERRIDE; |
| 99 virtual void Destroy() OVERRIDE; | 93 virtual void Destroy() OVERRIDE; |
| 100 virtual void WillDestroyRenderWidget(RenderWidgetHost* rwh) {} | |
| 101 virtual void SetTooltipText(const base::string16& tooltip_text) OVERRIDE; | 94 virtual void SetTooltipText(const base::string16& tooltip_text) OVERRIDE; |
| 102 virtual void SelectionChanged(const base::string16& text, | 95 virtual void SelectionChanged(const base::string16& text, |
| 103 size_t offset, | 96 size_t offset, |
| 104 const gfx::Range& range) OVERRIDE; | 97 const gfx::Range& range) OVERRIDE; |
| 105 virtual void SelectionBoundsChanged( | 98 virtual void SelectionBoundsChanged( |
| 106 const ViewHostMsg_SelectionBounds_Params& params) OVERRIDE; | 99 const ViewHostMsg_SelectionBounds_Params& params) OVERRIDE; |
| 107 virtual void ScrollOffsetChanged() OVERRIDE; | |
| 108 virtual BackingStore* AllocBackingStore(const gfx::Size& size) OVERRIDE; | |
| 109 virtual void CopyFromCompositingSurface( | 100 virtual void CopyFromCompositingSurface( |
| 110 const gfx::Rect& src_subrect, | 101 const gfx::Rect& src_subrect, |
| 111 const gfx::Size& dst_size, | 102 const gfx::Size& dst_size, |
| 112 const base::Callback<void(bool, const SkBitmap&)>& callback) OVERRIDE; | 103 const base::Callback<void(bool, const SkBitmap&)>& callback) OVERRIDE; |
| 113 virtual void CopyFromCompositingSurfaceToVideoFrame( | |
| 114 const gfx::Rect& src_subrect, | |
| 115 const scoped_refptr<media::VideoFrame>& target, | |
| 116 const base::Callback<void(bool)>& callback) OVERRIDE; | |
| 117 virtual bool CanCopyToVideoFrame() const OVERRIDE; | |
| 118 virtual void OnAcceleratedCompositingStateChange() OVERRIDE; | |
| 119 virtual void AcceleratedSurfaceInitialized(int host_id, | |
| 120 int route_id) OVERRIDE; | |
| 121 virtual void AcceleratedSurfaceBuffersSwapped( | 104 virtual void AcceleratedSurfaceBuffersSwapped( |
| 122 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params, | 105 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params, |
| 123 int gpu_host_id) OVERRIDE; | 106 int gpu_host_id) OVERRIDE; |
| 124 virtual void AcceleratedSurfacePostSubBuffer( | 107 virtual void AcceleratedSurfacePostSubBuffer( |
| 125 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params, | 108 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params, |
| 126 int gpu_host_id) OVERRIDE; | 109 int gpu_host_id) OVERRIDE; |
| 127 virtual void OnSwapCompositorFrame( | 110 virtual void OnSwapCompositorFrame( |
| 128 uint32 output_surface_id, | 111 uint32 output_surface_id, |
| 129 scoped_ptr<cc::CompositorFrame> frame) OVERRIDE; | 112 scoped_ptr<cc::CompositorFrame> frame) OVERRIDE; |
| 130 virtual void AcceleratedSurfaceSuspend() OVERRIDE; | |
| 131 virtual void AcceleratedSurfaceRelease() OVERRIDE; | |
| 132 virtual bool HasAcceleratedSurface(const gfx::Size& desired_size) OVERRIDE; | |
| 133 virtual void SetHasHorizontalScrollbar( | 113 virtual void SetHasHorizontalScrollbar( |
| 134 bool has_horizontal_scrollbar) OVERRIDE; | 114 bool has_horizontal_scrollbar) OVERRIDE; |
| 135 virtual void SetScrollOffsetPinning( | 115 virtual void SetScrollOffsetPinning( |
| 136 bool is_pinned_to_left, bool is_pinned_to_right) OVERRIDE; | 116 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) | 117 #if defined(OS_WIN) || defined(USE_AURA) |
| 140 virtual void ProcessAckedTouchEvent( | 118 virtual void ProcessAckedTouchEvent( |
| 141 const TouchEventWithLatencyInfo& touch, | 119 const TouchEventWithLatencyInfo& touch, |
| 142 InputEventAckState ack_result) OVERRIDE; | 120 InputEventAckState ack_result) OVERRIDE; |
| 143 #endif // defined(OS_WIN) || defined(USE_AURA) | 121 #endif // defined(OS_WIN) || defined(USE_AURA) |
| 144 virtual bool LockMouse() OVERRIDE; | 122 virtual bool LockMouse() OVERRIDE; |
| 145 virtual void UnlockMouse() OVERRIDE; | 123 virtual void UnlockMouse() OVERRIDE; |
| 146 virtual void GetScreenInfo(blink::WebScreenInfo* results) OVERRIDE; | 124 virtual void GetScreenInfo(blink::WebScreenInfo* results) OVERRIDE; |
| 147 virtual void OnAccessibilityEvents( | 125 virtual void OnAccessibilityEvents( |
| 148 const std::vector<AccessibilityHostMsg_EventParams>& | 126 const std::vector<AccessibilityHostMsg_EventParams>& |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 198 private: | 176 private: |
| 199 // Destroys this view without calling |Destroy| on |platform_view_|. | 177 // Destroys this view without calling |Destroy| on |platform_view_|. |
| 200 void DestroyGuestView(); | 178 void DestroyGuestView(); |
| 201 | 179 |
| 202 // Builds and forwards a WebKitGestureEvent to the renderer. | 180 // Builds and forwards a WebKitGestureEvent to the renderer. |
| 203 bool ForwardGestureEventToRenderer(ui::GestureEvent* gesture); | 181 bool ForwardGestureEventToRenderer(ui::GestureEvent* gesture); |
| 204 | 182 |
| 205 // Process all of the given gestures (passes them on to renderer) | 183 // Process all of the given gestures (passes them on to renderer) |
| 206 void ProcessGestures(ui::GestureRecognizer::Gestures* gestures); | 184 void ProcessGestures(ui::GestureRecognizer::Gestures* gestures); |
| 207 | 185 |
| 208 // The model object. | |
| 209 RenderWidgetHostImpl* host_; | |
| 210 | |
| 211 BrowserPluginGuest *guest_; | 186 BrowserPluginGuest *guest_; |
| 212 gfx::Size size_; | 187 gfx::Size size_; |
| 213 // The platform view for this RenderWidgetHostView. | 188 // The platform view for this RenderWidgetHostView. |
| 214 // RenderWidgetHostViewGuest mostly only cares about stuff related to | 189 // RenderWidgetHostViewGuest mostly only cares about stuff related to |
| 215 // compositing, the rest are directly forwared to this |platform_view_|. | 190 // compositing, the rest are directly forwared to this |platform_view_|. |
| 216 RenderWidgetHostViewPort* platform_view_; | 191 RenderWidgetHostViewPort* platform_view_; |
| 217 #if defined(OS_WIN) || defined(USE_AURA) | 192 #if defined(OS_WIN) || defined(USE_AURA) |
| 218 scoped_ptr<ui::GestureRecognizer> gesture_recognizer_; | 193 scoped_ptr<ui::GestureRecognizer> gesture_recognizer_; |
| 219 #endif // defined(OS_WIN) || defined(USE_AURA) | 194 #endif // defined(OS_WIN) || defined(USE_AURA) |
| 220 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewGuest); | 195 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewGuest); |
| 221 }; | 196 }; |
| 222 | 197 |
| 223 } // namespace content | 198 } // namespace content |
| 224 | 199 |
| 225 #endif // CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_GUEST_H_ | 200 #endif // CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_GUEST_H_ |
| OLD | NEW |