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_AURA_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/callback.h" | 12 #include "base/callback.h" |
13 #include "base/memory/linked_ptr.h" | 13 #include "base/memory/linked_ptr.h" |
14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 15 #include "base/memory/weak_ptr.h" |
15 #include "content/browser/renderer_host/image_transport_factory.h" | 16 #include "content/browser/renderer_host/image_transport_factory.h" |
16 #include "content/browser/renderer_host/render_widget_host_view_base.h" | 17 #include "content/browser/renderer_host/render_widget_host_view_base.h" |
17 #include "content/common/content_export.h" | 18 #include "content/common/content_export.h" |
18 #include "ui/aura/client/activation_delegate.h" | 19 #include "ui/aura/client/activation_delegate.h" |
19 #include "ui/aura/window_delegate.h" | 20 #include "ui/aura/window_delegate.h" |
20 #include "ui/base/ime/text_input_client.h" | 21 #include "ui/base/ime/text_input_client.h" |
21 #include "ui/compositor/compositor_observer.h" | 22 #include "ui/compositor/compositor_observer.h" |
22 #include "ui/gfx/rect.h" | 23 #include "ui/gfx/rect.h" |
23 #include "webkit/glue/webcursor.h" | 24 #include "webkit/glue/webcursor.h" |
24 | 25 |
(...skipping 20 matching lines...) Expand all Loading... |
45 | 46 |
46 class ImageTransportClient; | 47 class ImageTransportClient; |
47 | 48 |
48 // RenderWidgetHostView class hierarchy described in render_widget_host_view.h. | 49 // RenderWidgetHostView class hierarchy described in render_widget_host_view.h. |
49 class RenderWidgetHostViewAura | 50 class RenderWidgetHostViewAura |
50 : public content::RenderWidgetHostViewBase, | 51 : public content::RenderWidgetHostViewBase, |
51 public ui::CompositorObserver, | 52 public ui::CompositorObserver, |
52 public ui::TextInputClient, | 53 public ui::TextInputClient, |
53 public aura::WindowDelegate, | 54 public aura::WindowDelegate, |
54 public aura::client::ActivationDelegate, | 55 public aura::client::ActivationDelegate, |
55 public ImageTransportFactoryObserver { | 56 public ImageTransportFactoryObserver, |
| 57 public base::SupportsWeakPtr<RenderWidgetHostViewAura> { |
56 public: | 58 public: |
57 virtual ~RenderWidgetHostViewAura(); | 59 virtual ~RenderWidgetHostViewAura(); |
58 | 60 |
59 // RenderWidgetHostView implementation. | 61 // RenderWidgetHostView implementation. |
60 virtual void InitAsChild(gfx::NativeView parent_view) OVERRIDE; | 62 virtual void InitAsChild(gfx::NativeView parent_view) OVERRIDE; |
61 virtual content::RenderWidgetHost* GetRenderWidgetHost() const OVERRIDE; | 63 virtual content::RenderWidgetHost* GetRenderWidgetHost() const OVERRIDE; |
62 virtual void SetSize(const gfx::Size& size) OVERRIDE; | 64 virtual void SetSize(const gfx::Size& size) OVERRIDE; |
63 virtual void SetBounds(const gfx::Rect& rect) OVERRIDE; | 65 virtual void SetBounds(const gfx::Rect& rect) OVERRIDE; |
64 virtual gfx::NativeView GetNativeView() const OVERRIDE; | 66 virtual gfx::NativeView GetNativeView() const OVERRIDE; |
65 virtual gfx::NativeViewId GetNativeViewId() const OVERRIDE; | 67 virtual gfx::NativeViewId GetNativeViewId() const OVERRIDE; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 int gpu_host_id) OVERRIDE; | 110 int gpu_host_id) OVERRIDE; |
109 virtual void AcceleratedSurfacePostSubBuffer( | 111 virtual void AcceleratedSurfacePostSubBuffer( |
110 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params_in_pixel, | 112 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params_in_pixel, |
111 int gpu_host_id) OVERRIDE; | 113 int gpu_host_id) OVERRIDE; |
112 virtual void AcceleratedSurfaceSuspend() OVERRIDE; | 114 virtual void AcceleratedSurfaceSuspend() OVERRIDE; |
113 virtual bool HasAcceleratedSurface(const gfx::Size& desired_size) OVERRIDE; | 115 virtual bool HasAcceleratedSurface(const gfx::Size& desired_size) OVERRIDE; |
114 virtual void AcceleratedSurfaceNew( | 116 virtual void AcceleratedSurfaceNew( |
115 int32 width_in_pixel, | 117 int32 width_in_pixel, |
116 int32 height_in_pixel, | 118 int32 height_in_pixel, |
117 uint64* surface_id, | 119 uint64* surface_id, |
118 TransportDIB::Handle* surface_handle) OVERRIDE; | 120 TransportDIB::Handle* surface_handle, |
| 121 int32 route_id) OVERRIDE; |
119 virtual void AcceleratedSurfaceRelease(uint64 surface_id) OVERRIDE; | 122 virtual void AcceleratedSurfaceRelease(uint64 surface_id) OVERRIDE; |
120 virtual void GetScreenInfo(WebKit::WebScreenInfo* results) OVERRIDE; | 123 virtual void GetScreenInfo(WebKit::WebScreenInfo* results) OVERRIDE; |
121 virtual gfx::Rect GetRootWindowBounds() OVERRIDE; | 124 virtual gfx::Rect GetRootWindowBounds() OVERRIDE; |
122 virtual void ProcessTouchAck(WebKit::WebInputEvent::Type type, | 125 virtual void ProcessTouchAck(WebKit::WebInputEvent::Type type, |
123 bool processed) OVERRIDE; | 126 bool processed) OVERRIDE; |
124 virtual void SetHasHorizontalScrollbar( | 127 virtual void SetHasHorizontalScrollbar( |
125 bool has_horizontal_scrollbar) OVERRIDE; | 128 bool has_horizontal_scrollbar) OVERRIDE; |
126 virtual void SetScrollOffsetPinning( | 129 virtual void SetScrollOffsetPinning( |
127 bool is_pinned_to_left, bool is_pinned_to_right) OVERRIDE; | 130 bool is_pinned_to_left, bool is_pinned_to_right) OVERRIDE; |
128 virtual gfx::GLSurfaceHandle GetCompositingSurface() OVERRIDE; | 131 virtual gfx::GLSurfaceHandle GetCompositingSurface() OVERRIDE; |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 // Helper method to determine if, in mouse locked mode, the cursor should be | 221 // Helper method to determine if, in mouse locked mode, the cursor should be |
219 // moved to center. | 222 // moved to center. |
220 bool ShouldMoveToCenter(); | 223 bool ShouldMoveToCenter(); |
221 | 224 |
222 // Run the compositing callbacks. | 225 // Run the compositing callbacks. |
223 void RunCompositingCallbacks(); | 226 void RunCompositingCallbacks(); |
224 | 227 |
225 // Called when window_ is removed from the window tree. | 228 // Called when window_ is removed from the window tree. |
226 void RemovingFromRootWindow(); | 229 void RemovingFromRootWindow(); |
227 | 230 |
| 231 void SetSurfaceNotInUseByCompositor(); |
| 232 void AdjustSurfaceProtection(); |
| 233 |
| 234 void CopyFromCompositingSurfaceFinished(base::Callback<void(bool)> callback, |
| 235 bool result); |
| 236 |
228 ui::Compositor* GetCompositor(); | 237 ui::Compositor* GetCompositor(); |
229 | 238 |
230 // The model object. | 239 // The model object. |
231 content::RenderWidgetHostImpl* host_; | 240 content::RenderWidgetHostImpl* host_; |
232 | 241 |
233 aura::Window* window_; | 242 aura::Window* window_; |
234 | 243 |
235 scoped_ptr<WindowObserver> window_observer_; | 244 scoped_ptr<WindowObserver> window_observer_; |
236 | 245 |
237 // Are we in the process of closing? Tracked so fullscreen views can avoid | 246 // Are we in the process of closing? Tracked so fullscreen views can avoid |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 // Current tooltip text. | 282 // Current tooltip text. |
274 string16 tooltip_; | 283 string16 tooltip_; |
275 | 284 |
276 std::vector< base::Callback<void(void)> > on_compositing_ended_callbacks_; | 285 std::vector< base::Callback<void(void)> > on_compositing_ended_callbacks_; |
277 | 286 |
278 std::map<uint64, scoped_refptr<ImageTransportClient> > | 287 std::map<uint64, scoped_refptr<ImageTransportClient> > |
279 image_transport_clients_; | 288 image_transport_clients_; |
280 | 289 |
281 uint64 current_surface_; | 290 uint64 current_surface_; |
282 | 291 |
| 292 // Protected means that the current_surface_ may be in use by ui and cannot |
| 293 // be safely discarded. Things to consider are thumbnailer, compositor draw |
| 294 // pending, and tab visibility. |
| 295 bool current_surface_is_protected_; |
| 296 bool current_surface_in_use_by_compositor_; |
| 297 |
| 298 int pending_thumbnail_tasks_; |
| 299 |
| 300 // This id increments every time surface_is_protected changes. |
| 301 // Keeps gpu/browser IPC messages relying on protection state in sync. |
| 302 uint32 protection_state_id_; |
| 303 |
| 304 int32 surface_route_id_; |
| 305 |
283 gfx::GLSurfaceHandle shared_surface_handle_; | 306 gfx::GLSurfaceHandle shared_surface_handle_; |
284 | 307 |
285 // If non-NULL we're in OnPaint() and this is the supplied canvas. | 308 // If non-NULL we're in OnPaint() and this is the supplied canvas. |
286 gfx::Canvas* paint_canvas_; | 309 gfx::Canvas* paint_canvas_; |
287 | 310 |
288 // Used to record the last position of the mouse. | 311 // Used to record the last position of the mouse. |
289 // While the mouse is locked, they store the last known position just as mouse | 312 // While the mouse is locked, they store the last known position just as mouse |
290 // lock was entered. | 313 // lock was entered. |
291 // Relative to the upper-left corner of the view. | 314 // Relative to the upper-left corner of the view. |
292 gfx::Point unlocked_mouse_position_; | 315 gfx::Point unlocked_mouse_position_; |
(...skipping 19 matching lines...) Expand all Loading... |
312 // These locks are the ones waiting for a frame to be drawn. | 335 // These locks are the ones waiting for a frame to be drawn. |
313 std::vector<linked_ptr<ResizeLock> > locks_pending_draw_; | 336 std::vector<linked_ptr<ResizeLock> > locks_pending_draw_; |
314 | 337 |
315 // This lock is for waiting for a front surface to become available to draw. | 338 // This lock is for waiting for a front surface to become available to draw. |
316 scoped_refptr<aura::CompositorLock> released_front_lock_; | 339 scoped_refptr<aura::CompositorLock> released_front_lock_; |
317 | 340 |
318 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAura); | 341 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAura); |
319 }; | 342 }; |
320 | 343 |
321 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_ | 344 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_ |
OLD | NEW |