| 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_BASE_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_BASE_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_BASE_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_BASE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #if defined(OS_MACOSX) | 9 #if defined(OS_MACOSX) |
| 10 #include <OpenGL/OpenGL.h> | 10 #include <OpenGL/OpenGL.h> |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 | 46 |
| 47 // RenderWidgetHostViewPort implementation. | 47 // RenderWidgetHostViewPort implementation. |
| 48 virtual void SelectionChanged(const string16& text, | 48 virtual void SelectionChanged(const string16& text, |
| 49 size_t offset, | 49 size_t offset, |
| 50 const ui::Range& range) OVERRIDE; | 50 const ui::Range& range) OVERRIDE; |
| 51 virtual void SetBackground(const SkBitmap& background) OVERRIDE; | 51 virtual void SetBackground(const SkBitmap& background) OVERRIDE; |
| 52 virtual const SkBitmap& GetBackground() OVERRIDE; | 52 virtual const SkBitmap& GetBackground() OVERRIDE; |
| 53 virtual bool IsShowingContextMenu() const OVERRIDE; | 53 virtual bool IsShowingContextMenu() const OVERRIDE; |
| 54 virtual void SetShowingContextMenu(bool showing_menu) OVERRIDE; | 54 virtual void SetShowingContextMenu(bool showing_menu) OVERRIDE; |
| 55 virtual bool IsMouseLocked() OVERRIDE; | 55 virtual bool IsMouseLocked() OVERRIDE; |
| 56 virtual gfx::GLSurfaceHandle GetCompositingSurface() OVERRIDE; |
| 57 virtual bool ResizeNeedsNewSurface() OVERRIDE; |
| 56 virtual void UnhandledWheelEvent( | 58 virtual void UnhandledWheelEvent( |
| 57 const WebKit::WebMouseWheelEvent& event) OVERRIDE; | 59 const WebKit::WebMouseWheelEvent& event) OVERRIDE; |
| 58 virtual void SetPopupType(WebKit::WebPopupType popup_type) OVERRIDE; | 60 virtual void SetPopupType(WebKit::WebPopupType popup_type) OVERRIDE; |
| 59 virtual WebKit::WebPopupType GetPopupType() OVERRIDE; | 61 virtual WebKit::WebPopupType GetPopupType() OVERRIDE; |
| 60 virtual BrowserAccessibilityManager* | 62 virtual BrowserAccessibilityManager* |
| 61 GetBrowserAccessibilityManager() const OVERRIDE; | 63 GetBrowserAccessibilityManager() const OVERRIDE; |
| 62 | 64 |
| 65 virtual void AcceleratedSurfaceBuffersSwapped( |
| 66 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params_in_pixel, |
| 67 int gpu_host_id) OVERRIDE; |
| 68 virtual void AcceleratedSurfaceNew( |
| 69 int32 width_in_pixel, |
| 70 int32 height_in_pixel, |
| 71 uint64* surface_handle, |
| 72 TransportDIB::Handle* shm_handle) OVERRIDE; |
| 73 virtual void AcceleratedSurfaceRelease(uint64 surface_handle) OVERRIDE; |
| 74 virtual void AcceleratedSurfacePostSubBuffer( |
| 75 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params_in_pixel, |
| 76 int gpu_host_id) OVERRIDE; |
| 77 |
| 63 void SetBrowserAccessibilityManager(BrowserAccessibilityManager* manager); | 78 void SetBrowserAccessibilityManager(BrowserAccessibilityManager* manager); |
| 64 | 79 |
| 65 // Notification that a resize or move session ended on the native widget. | 80 // Notification that a resize or move session ended on the native widget. |
| 66 void UpdateScreenInfo(); | 81 void UpdateScreenInfo(); |
| 67 | 82 |
| 83 // A small wrapper to represent a pluggable mechanism for generating a |
| 84 // GLSurfaceHandle. Normally the platform-specific derived class will |
| 85 // provide an implementation, but for the browser plugin, an alternate |
| 86 // implementation is used. |
| 87 class CompositingDelegate { |
| 88 public: |
| 89 virtual gfx::GLSurfaceHandle GetCompositingSurface() = 0; |
| 90 virtual bool ResizeNeedsNewSurface() = 0; |
| 91 virtual void AcceleratedSurfaceBuffersSwapped( |
| 92 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params_in_pixe
l, |
| 93 int gpu_host_id) = 0; |
| 94 virtual void AcceleratedSurfaceNew( |
| 95 int32 width_in_pixel, |
| 96 int32 height_in_pixel, |
| 97 uint64* surface_handle, |
| 98 TransportDIB::Handle* shm_handle); |
| 99 virtual void AcceleratedSurfaceRelease(uint64 surface_handle); |
| 100 virtual void AcceleratedSurfacePostSubBuffer( |
| 101 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params_in_pixel
, |
| 102 int gpu_host_id) = 0; |
| 103 virtual ~CompositingDelegate(); |
| 104 }; |
| 105 |
| 106 void SetCompositingDelegate(scoped_ptr<CompositingDelegate> delegate) { |
| 107 compositing_delegate_.reset(delegate.release()); |
| 108 } |
| 109 |
| 68 protected: | 110 protected: |
| 69 // Interface class only, do not construct. | 111 // Interface class only, do not construct. |
| 70 RenderWidgetHostViewBase(); | 112 RenderWidgetHostViewBase(scoped_ptr<CompositingDelegate> delegate); |
| 71 | 113 |
| 72 // Whether this view is a popup and what kind of popup it is (select, | 114 // Whether this view is a popup and what kind of popup it is (select, |
| 73 // autofill...). | 115 // autofill...). |
| 74 WebKit::WebPopupType popup_type_; | 116 WebKit::WebPopupType popup_type_; |
| 75 | 117 |
| 76 // A custom background to paint behind the web content. This will be tiled | 118 // A custom background to paint behind the web content. This will be tiled |
| 77 // horizontally. Can be null, in which case we fall back to painting white. | 119 // horizontally. Can be null, in which case we fall back to painting white. |
| 78 SkBitmap background_; | 120 SkBitmap background_; |
| 79 | 121 |
| 80 // While the mouse is locked, the cursor is hidden from the user. Mouse events | 122 // While the mouse is locked, the cursor is hidden from the user. Mouse events |
| 81 // are still generated. However, the position they report is the last known | 123 // are still generated. However, the position they report is the last known |
| 82 // mouse position just as mouse lock was entered; the movement they report | 124 // mouse position just as mouse lock was entered; the movement they report |
| 83 // indicates what the change in position of the mouse would be had it not been | 125 // indicates what the change in position of the mouse would be had it not been |
| 84 // locked. | 126 // locked. |
| 85 bool mouse_locked_; | 127 bool mouse_locked_; |
| 86 | 128 |
| 87 // Whether we are showing a context menu. | 129 // Whether we are showing a context menu. |
| 88 bool showing_context_menu_; | 130 bool showing_context_menu_; |
| 89 | 131 |
| 90 // A buffer containing the text inside and around the current selection range. | 132 // A buffer containing the text inside and around the current selection range. |
| 91 string16 selection_text_; | 133 string16 selection_text_; |
| 92 | 134 |
| 93 // The offset of the text stored in |selection_text_| relative to the start of | 135 // The offset of the text stored in |selection_text_| relative to the start of |
| 94 // the web page. | 136 // the web page. |
| 95 size_t selection_text_offset_; | 137 size_t selection_text_offset_; |
| 96 | 138 |
| 97 // The current selection range relative to the start of the web page. | 139 // The current selection range relative to the start of the web page. |
| 98 ui::Range selection_range_; | 140 ui::Range selection_range_; |
| 99 | 141 |
| 142 |
| 100 private: | 143 private: |
| 101 // Manager of the tree representation of the WebKit render tree. | 144 // Manager of the tree representation of the WebKit render tree. |
| 102 scoped_ptr<BrowserAccessibilityManager> browser_accessibility_manager_; | 145 scoped_ptr<BrowserAccessibilityManager> browser_accessibility_manager_; |
| 103 | 146 |
| 104 gfx::Rect current_display_area_; | 147 gfx::Rect current_display_area_; |
| 105 float current_device_scale_factor_; | 148 float current_device_scale_factor_; |
| 106 | 149 |
| 150 scoped_ptr<CompositingDelegate> compositing_delegate_; |
| 151 |
| 107 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewBase); | 152 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewBase); |
| 108 }; | 153 }; |
| 109 | 154 |
| 110 } // namespace content | 155 } // namespace content |
| 111 | 156 |
| 112 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_BASE_H_ | 157 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_BASE_H_ |
| OLD | NEW |