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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
111 int gpu_host_id) OVERRIDE; | 113 int gpu_host_id) OVERRIDE; |
112 virtual void AcceleratedSurfacePostSubBuffer( | 114 virtual void AcceleratedSurfacePostSubBuffer( |
113 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params_in_pixel, | 115 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params_in_pixel, |
114 int gpu_host_id) OVERRIDE; | 116 int gpu_host_id) OVERRIDE; |
115 virtual void AcceleratedSurfaceSuspend() OVERRIDE; | 117 virtual void AcceleratedSurfaceSuspend() OVERRIDE; |
116 virtual bool HasAcceleratedSurface(const gfx::Size& desired_size) OVERRIDE; | 118 virtual bool HasAcceleratedSurface(const gfx::Size& desired_size) OVERRIDE; |
117 virtual void AcceleratedSurfaceNew( | 119 virtual void AcceleratedSurfaceNew( |
118 int32 width_in_pixel, | 120 int32 width_in_pixel, |
119 int32 height_in_pixel, | 121 int32 height_in_pixel, |
120 uint64* surface_id, | 122 uint64* surface_id, |
121 TransportDIB::Handle* surface_handle) OVERRIDE; | 123 TransportDIB::Handle* surface_handle, |
124 int32 route_id) OVERRIDE; | |
122 virtual void AcceleratedSurfaceRelease(uint64 surface_id) OVERRIDE; | 125 virtual void AcceleratedSurfaceRelease(uint64 surface_id) OVERRIDE; |
123 virtual void GetScreenInfo(WebKit::WebScreenInfo* results) OVERRIDE; | 126 virtual void GetScreenInfo(WebKit::WebScreenInfo* results) OVERRIDE; |
124 virtual gfx::Rect GetRootWindowBounds() OVERRIDE; | 127 virtual gfx::Rect GetRootWindowBounds() OVERRIDE; |
125 virtual void ProcessTouchAck(WebKit::WebInputEvent::Type type, | 128 virtual void ProcessTouchAck(WebKit::WebInputEvent::Type type, |
126 bool processed) OVERRIDE; | 129 bool processed) OVERRIDE; |
127 virtual void SetHasHorizontalScrollbar( | 130 virtual void SetHasHorizontalScrollbar( |
128 bool has_horizontal_scrollbar) OVERRIDE; | 131 bool has_horizontal_scrollbar) OVERRIDE; |
129 virtual void SetScrollOffsetPinning( | 132 virtual void SetScrollOffsetPinning( |
130 bool is_pinned_to_left, bool is_pinned_to_right) OVERRIDE; | 133 bool is_pinned_to_left, bool is_pinned_to_right) OVERRIDE; |
131 virtual gfx::GLSurfaceHandle GetCompositingSurface() OVERRIDE; | 134 virtual gfx::GLSurfaceHandle GetCompositingSurface() OVERRIDE; |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
221 // Helper method to determine if, in mouse locked mode, the cursor should be | 224 // Helper method to determine if, in mouse locked mode, the cursor should be |
222 // moved to center. | 225 // moved to center. |
223 bool ShouldMoveToCenter(); | 226 bool ShouldMoveToCenter(); |
224 | 227 |
225 // Run the compositing callbacks. | 228 // Run the compositing callbacks. |
226 void RunCompositingCallbacks(); | 229 void RunCompositingCallbacks(); |
227 | 230 |
228 // Called when window_ is removed from the window tree. | 231 // Called when window_ is removed from the window tree. |
229 void RemovingFromRootWindow(); | 232 void RemovingFromRootWindow(); |
230 | 233 |
234 void SetSurfaceNotInUseByCompositor(); | |
sky
2012/06/13 16:21:23
Add descriptions for these.
mmocny
2012/06/13 18:40:05
Done.
| |
235 void AdjustSurfaceProtection(); | |
236 | |
237 void CopyFromCompositingSurfaceFinished(base::Callback<void(bool)> callback, | |
238 bool result); | |
239 | |
231 ui::Compositor* GetCompositor(); | 240 ui::Compositor* GetCompositor(); |
232 | 241 |
233 // Detaches |this| from the input method object. | 242 // Detaches |this| from the input method object. |
234 void DetachFromInputMethod(); | 243 void DetachFromInputMethod(); |
235 | 244 |
236 // The model object. | 245 // The model object. |
237 content::RenderWidgetHostImpl* host_; | 246 content::RenderWidgetHostImpl* host_; |
238 | 247 |
239 aura::Window* window_; | 248 aura::Window* window_; |
240 | 249 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
282 // Current tooltip text. | 291 // Current tooltip text. |
283 string16 tooltip_; | 292 string16 tooltip_; |
284 | 293 |
285 std::vector< base::Callback<void(void)> > on_compositing_ended_callbacks_; | 294 std::vector< base::Callback<void(void)> > on_compositing_ended_callbacks_; |
286 | 295 |
287 std::map<uint64, scoped_refptr<ImageTransportClient> > | 296 std::map<uint64, scoped_refptr<ImageTransportClient> > |
288 image_transport_clients_; | 297 image_transport_clients_; |
289 | 298 |
290 uint64 current_surface_; | 299 uint64 current_surface_; |
291 | 300 |
301 // Protected means that the current_surface_ may be in use by ui and cannot | |
sky
2012/06/13 16:21:23
Use |s around argument names and field names in do
mmocny
2012/06/13 18:40:05
Done.
| |
302 // be safely discarded. Things to consider are thumbnailer, compositor draw | |
303 // pending, and tab visibility. | |
304 bool current_surface_is_protected_; | |
305 bool current_surface_in_use_by_compositor_; | |
306 | |
307 int pending_thumbnail_tasks_; | |
308 | |
309 // This id increments every time surface_is_protected changes. | |
310 // Keeps gpu/browser IPC messages relying on protection state in sync. | |
311 uint32 protection_state_id_; | |
312 | |
313 int32 surface_route_id_; | |
314 | |
292 gfx::GLSurfaceHandle shared_surface_handle_; | 315 gfx::GLSurfaceHandle shared_surface_handle_; |
293 | 316 |
294 // If non-NULL we're in OnPaint() and this is the supplied canvas. | 317 // If non-NULL we're in OnPaint() and this is the supplied canvas. |
295 gfx::Canvas* paint_canvas_; | 318 gfx::Canvas* paint_canvas_; |
296 | 319 |
297 // Used to record the last position of the mouse. | 320 // Used to record the last position of the mouse. |
298 // While the mouse is locked, they store the last known position just as mouse | 321 // While the mouse is locked, they store the last known position just as mouse |
299 // lock was entered. | 322 // lock was entered. |
300 // Relative to the upper-left corner of the view. | 323 // Relative to the upper-left corner of the view. |
301 gfx::Point unlocked_mouse_position_; | 324 gfx::Point unlocked_mouse_position_; |
(...skipping 19 matching lines...) Expand all Loading... | |
321 // These locks are the ones waiting for a frame to be drawn. | 344 // These locks are the ones waiting for a frame to be drawn. |
322 std::vector<linked_ptr<ResizeLock> > locks_pending_draw_; | 345 std::vector<linked_ptr<ResizeLock> > locks_pending_draw_; |
323 | 346 |
324 // This lock is for waiting for a front surface to become available to draw. | 347 // This lock is for waiting for a front surface to become available to draw. |
325 scoped_refptr<aura::CompositorLock> released_front_lock_; | 348 scoped_refptr<aura::CompositorLock> released_front_lock_; |
326 | 349 |
327 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAura); | 350 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAura); |
328 }; | 351 }; |
329 | 352 |
330 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_ | 353 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_ |
OLD | NEW |