| 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_FRAME_HOST_RENDER_WIDGET_HOST_VIEW_GUEST_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_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" |
| 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 // ----------------------------------------------------------------------------- | |
| 32 // See comments in render_widget_host_view.h about this class and its members. | 31 // 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 | 32 // This version is for the BrowserPlugin which handles a lot of the |
| 34 // functionality in a diffent place and isn't platform specific. | 33 // functionality in a diffent place and isn't platform specific. |
| 34 // The BrowserPlugin is currently a special case for out-of-process rendered |
| 35 // content and therefore inherits from RenderWidgetHostViewChildFrame. |
| 36 // Eventually all RenderWidgetHostViewGuest code will be subsumed by |
| 37 // RenderWidgetHostViewChildFrame and this class will be removed. |
| 35 // | 38 // |
| 36 // Some elements that are platform specific will be deal with by delegating | 39 // Some elements that are platform specific will be deal with by delegating |
| 37 // the relevant calls to the platform view. | 40 // the relevant calls to the platform view. |
| 38 // ----------------------------------------------------------------------------- | |
| 39 class CONTENT_EXPORT RenderWidgetHostViewGuest | 41 class CONTENT_EXPORT RenderWidgetHostViewGuest |
| 40 : public RenderWidgetHostViewBase, | 42 : public RenderWidgetHostViewChildFrame, |
| 41 public ui::GestureConsumer, | 43 public ui::GestureConsumer, |
| 42 public ui::GestureEventHelper { | 44 public ui::GestureEventHelper { |
| 43 public: | 45 public: |
| 44 RenderWidgetHostViewGuest(RenderWidgetHost* widget, | 46 RenderWidgetHostViewGuest(RenderWidgetHost* widget, |
| 45 BrowserPluginGuest* guest, | 47 BrowserPluginGuest* guest, |
| 46 RenderWidgetHostView* platform_view); | 48 RenderWidgetHostView* platform_view); |
| 47 virtual ~RenderWidgetHostViewGuest(); | 49 virtual ~RenderWidgetHostViewGuest(); |
| 48 | 50 |
| 49 // RenderWidgetHostView implementation. | 51 // RenderWidgetHostView implementation. |
| 50 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; | 52 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; |
| 51 virtual void InitAsChild(gfx::NativeView parent_view) OVERRIDE; | 53 virtual void InitAsChild(gfx::NativeView parent_view) OVERRIDE; |
| 52 virtual RenderWidgetHost* GetRenderWidgetHost() const OVERRIDE; | |
| 53 virtual void SetSize(const gfx::Size& size) OVERRIDE; | 54 virtual void SetSize(const gfx::Size& size) OVERRIDE; |
| 54 virtual void SetBounds(const gfx::Rect& rect) OVERRIDE; | 55 virtual void SetBounds(const gfx::Rect& rect) OVERRIDE; |
| 55 virtual gfx::NativeView GetNativeView() const OVERRIDE; | 56 virtual gfx::NativeView GetNativeView() const OVERRIDE; |
| 56 virtual gfx::NativeViewId GetNativeViewId() const OVERRIDE; | 57 virtual gfx::NativeViewId GetNativeViewId() const OVERRIDE; |
| 57 virtual gfx::NativeViewAccessible GetNativeViewAccessible() OVERRIDE; | 58 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; | 59 virtual gfx::Rect GetViewBounds() const OVERRIDE; |
| 64 virtual void SetBackground(const SkBitmap& background) OVERRIDE; | 60 virtual void SetBackground(const SkBitmap& background) OVERRIDE; |
| 65 #if defined(OS_WIN) && !defined(USE_AURA) | 61 virtual gfx::Size GetPhysicalBackingSize() const OVERRIDE; |
| 66 virtual void SetClickthroughRegion(SkRegion* region) OVERRIDE; | |
| 67 #endif | |
| 68 | 62 |
| 69 // RenderWidgetHostViewPort implementation. | 63 // RenderWidgetHostViewPort implementation. |
| 70 virtual void InitAsPopup(RenderWidgetHostView* parent_host_view, | 64 virtual void InitAsPopup(RenderWidgetHostView* parent_host_view, |
| 71 const gfx::Rect& pos) OVERRIDE; | 65 const gfx::Rect& pos) OVERRIDE; |
| 72 virtual void InitAsFullscreen( | 66 virtual void InitAsFullscreen( |
| 73 RenderWidgetHostView* reference_host_view) OVERRIDE; | 67 RenderWidgetHostView* reference_host_view) OVERRIDE; |
| 74 virtual void WasShown() OVERRIDE; | 68 virtual void WasShown() OVERRIDE; |
| 75 virtual void WasHidden() OVERRIDE; | 69 virtual void WasHidden() OVERRIDE; |
| 76 virtual void MovePluginWindows( | 70 virtual void MovePluginWindows( |
| 77 const gfx::Vector2d& scroll_offset, | 71 const gfx::Vector2d& scroll_offset, |
| 78 const std::vector<WebPluginGeometry>& moves) OVERRIDE; | 72 const std::vector<WebPluginGeometry>& moves) OVERRIDE; |
| 79 virtual void Focus() OVERRIDE; | |
| 80 virtual void Blur() OVERRIDE; | |
| 81 virtual void UpdateCursor(const WebCursor& cursor) OVERRIDE; | 73 virtual void UpdateCursor(const WebCursor& cursor) OVERRIDE; |
| 82 virtual void SetIsLoading(bool is_loading) OVERRIDE; | 74 virtual void SetIsLoading(bool is_loading) OVERRIDE; |
| 83 virtual void TextInputTypeChanged(ui::TextInputType type, | 75 virtual void TextInputTypeChanged(ui::TextInputType type, |
| 84 ui::TextInputMode input_mode, | 76 ui::TextInputMode input_mode, |
| 85 bool can_compose_inline) OVERRIDE; | 77 bool can_compose_inline) OVERRIDE; |
| 86 virtual void ImeCancelComposition() OVERRIDE; | 78 virtual void ImeCancelComposition() OVERRIDE; |
| 87 #if defined(OS_MACOSX) || defined(OS_WIN) || defined(USE_AURA) | 79 #if defined(OS_MACOSX) || defined(OS_WIN) || defined(USE_AURA) |
| 88 virtual void ImeCompositionRangeChanged( | 80 virtual void ImeCompositionRangeChanged( |
| 89 const gfx::Range& range, | 81 const gfx::Range& range, |
| 90 const std::vector<gfx::Rect>& character_bounds) OVERRIDE; | 82 const std::vector<gfx::Rect>& character_bounds) OVERRIDE; |
| 91 #endif | 83 #endif |
| 92 virtual void DidUpdateBackingStore( | 84 virtual void DidUpdateBackingStore( |
| 93 const gfx::Rect& scroll_rect, | 85 const gfx::Rect& scroll_rect, |
| 94 const gfx::Vector2d& scroll_delta, | 86 const gfx::Vector2d& scroll_delta, |
| 95 const std::vector<gfx::Rect>& copy_rects, | 87 const std::vector<gfx::Rect>& copy_rects, |
| 96 const std::vector<ui::LatencyInfo>& latency_info) OVERRIDE; | 88 const std::vector<ui::LatencyInfo>& latency_info) OVERRIDE; |
| 97 virtual void RenderProcessGone(base::TerminationStatus status, | 89 virtual void RenderProcessGone(base::TerminationStatus status, |
| 98 int error_code) OVERRIDE; | 90 int error_code) OVERRIDE; |
| 99 virtual void Destroy() OVERRIDE; | 91 virtual void Destroy() OVERRIDE; |
| 100 virtual void WillDestroyRenderWidget(RenderWidgetHost* rwh) {} | |
| 101 virtual void SetTooltipText(const base::string16& tooltip_text) OVERRIDE; | 92 virtual void SetTooltipText(const base::string16& tooltip_text) OVERRIDE; |
| 102 virtual void SelectionChanged(const base::string16& text, | 93 virtual void SelectionChanged(const base::string16& text, |
| 103 size_t offset, | 94 size_t offset, |
| 104 const gfx::Range& range) OVERRIDE; | 95 const gfx::Range& range) OVERRIDE; |
| 105 virtual void SelectionBoundsChanged( | 96 virtual void SelectionBoundsChanged( |
| 106 const ViewHostMsg_SelectionBounds_Params& params) OVERRIDE; | 97 const ViewHostMsg_SelectionBounds_Params& params) OVERRIDE; |
| 107 virtual void ScrollOffsetChanged() OVERRIDE; | |
| 108 virtual BackingStore* AllocBackingStore(const gfx::Size& size) OVERRIDE; | |
| 109 virtual void CopyFromCompositingSurface( | 98 virtual void CopyFromCompositingSurface( |
| 110 const gfx::Rect& src_subrect, | 99 const gfx::Rect& src_subrect, |
| 111 const gfx::Size& dst_size, | 100 const gfx::Size& dst_size, |
| 112 const base::Callback<void(bool, const SkBitmap&)>& callback) OVERRIDE; | 101 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( | 102 virtual void AcceleratedSurfaceBuffersSwapped( |
| 122 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params, | 103 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params, |
| 123 int gpu_host_id) OVERRIDE; | 104 int gpu_host_id) OVERRIDE; |
| 124 virtual void AcceleratedSurfacePostSubBuffer( | 105 virtual void AcceleratedSurfacePostSubBuffer( |
| 125 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params, | 106 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params, |
| 126 int gpu_host_id) OVERRIDE; | 107 int gpu_host_id) OVERRIDE; |
| 127 virtual void OnSwapCompositorFrame( | 108 virtual void OnSwapCompositorFrame( |
| 128 uint32 output_surface_id, | 109 uint32 output_surface_id, |
| 129 scoped_ptr<cc::CompositorFrame> frame) OVERRIDE; | 110 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( | 111 virtual void SetHasHorizontalScrollbar( |
| 134 bool has_horizontal_scrollbar) OVERRIDE; | 112 bool has_horizontal_scrollbar) OVERRIDE; |
| 135 virtual void SetScrollOffsetPinning( | 113 virtual void SetScrollOffsetPinning( |
| 136 bool is_pinned_to_left, bool is_pinned_to_right) OVERRIDE; | 114 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) | 115 #if defined(OS_WIN) || defined(USE_AURA) |
| 140 virtual void ProcessAckedTouchEvent( | 116 virtual void ProcessAckedTouchEvent( |
| 141 const TouchEventWithLatencyInfo& touch, | 117 const TouchEventWithLatencyInfo& touch, |
| 142 InputEventAckState ack_result) OVERRIDE; | 118 InputEventAckState ack_result) OVERRIDE; |
| 143 #endif // defined(OS_WIN) || defined(USE_AURA) | 119 #endif // defined(OS_WIN) || defined(USE_AURA) |
| 144 virtual bool LockMouse() OVERRIDE; | 120 virtual bool LockMouse() OVERRIDE; |
| 145 virtual void UnlockMouse() OVERRIDE; | 121 virtual void UnlockMouse() OVERRIDE; |
| 146 virtual void GetScreenInfo(blink::WebScreenInfo* results) OVERRIDE; | 122 virtual void GetScreenInfo(blink::WebScreenInfo* results) OVERRIDE; |
| 147 | 123 |
| 148 #if defined(OS_MACOSX) | 124 #if defined(OS_MACOSX) |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 private: | 171 private: |
| 196 // Destroys this view without calling |Destroy| on |platform_view_|. | 172 // Destroys this view without calling |Destroy| on |platform_view_|. |
| 197 void DestroyGuestView(); | 173 void DestroyGuestView(); |
| 198 | 174 |
| 199 // Builds and forwards a WebKitGestureEvent to the renderer. | 175 // Builds and forwards a WebKitGestureEvent to the renderer. |
| 200 bool ForwardGestureEventToRenderer(ui::GestureEvent* gesture); | 176 bool ForwardGestureEventToRenderer(ui::GestureEvent* gesture); |
| 201 | 177 |
| 202 // Process all of the given gestures (passes them on to renderer) | 178 // Process all of the given gestures (passes them on to renderer) |
| 203 void ProcessGestures(ui::GestureRecognizer::Gestures* gestures); | 179 void ProcessGestures(ui::GestureRecognizer::Gestures* gestures); |
| 204 | 180 |
| 205 // The model object. | |
| 206 RenderWidgetHostImpl* host_; | |
| 207 | |
| 208 BrowserPluginGuest *guest_; | 181 BrowserPluginGuest *guest_; |
| 209 gfx::Size size_; | 182 gfx::Size size_; |
| 210 // The platform view for this RenderWidgetHostView. | 183 // The platform view for this RenderWidgetHostView. |
| 211 // RenderWidgetHostViewGuest mostly only cares about stuff related to | 184 // RenderWidgetHostViewGuest mostly only cares about stuff related to |
| 212 // compositing, the rest are directly forwared to this |platform_view_|. | 185 // compositing, the rest are directly forwared to this |platform_view_|. |
| 213 RenderWidgetHostViewPort* platform_view_; | 186 RenderWidgetHostViewPort* platform_view_; |
| 214 #if defined(OS_WIN) || defined(USE_AURA) | 187 #if defined(OS_WIN) || defined(USE_AURA) |
| 215 scoped_ptr<ui::GestureRecognizer> gesture_recognizer_; | 188 scoped_ptr<ui::GestureRecognizer> gesture_recognizer_; |
| 216 #endif // defined(OS_WIN) || defined(USE_AURA) | 189 #endif // defined(OS_WIN) || defined(USE_AURA) |
| 217 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewGuest); | 190 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_GUEST_H_ |
| OLD | NEW |