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 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 virtual void SetHasHorizontalScrollbar( | 169 virtual void SetHasHorizontalScrollbar( |
170 bool has_horizontal_scrollbar) OVERRIDE; | 170 bool has_horizontal_scrollbar) OVERRIDE; |
171 virtual void SetScrollOffsetPinning( | 171 virtual void SetScrollOffsetPinning( |
172 bool is_pinned_to_left, bool is_pinned_to_right) OVERRIDE; | 172 bool is_pinned_to_left, bool is_pinned_to_right) OVERRIDE; |
173 virtual gfx::GLSurfaceHandle GetCompositingSurface() OVERRIDE; | 173 virtual gfx::GLSurfaceHandle GetCompositingSurface() OVERRIDE; |
174 virtual void OnAccessibilityNotifications( | 174 virtual void OnAccessibilityNotifications( |
175 const std::vector<AccessibilityHostMsg_NotificationParams>& | 175 const std::vector<AccessibilityHostMsg_NotificationParams>& |
176 params) OVERRIDE; | 176 params) OVERRIDE; |
177 virtual bool LockMouse() OVERRIDE; | 177 virtual bool LockMouse() OVERRIDE; |
178 virtual void UnlockMouse() OVERRIDE; | 178 virtual void UnlockMouse() OVERRIDE; |
| 179 virtual void OnSwapCompositorFrame(const cc::CompositorFrame& frame, |
| 180 int render_host_id, |
| 181 int route_id) OVERRIDE; |
179 | 182 |
180 // Overridden from ui::TextInputClient: | 183 // Overridden from ui::TextInputClient: |
181 virtual void SetCompositionText( | 184 virtual void SetCompositionText( |
182 const ui::CompositionText& composition) OVERRIDE; | 185 const ui::CompositionText& composition) OVERRIDE; |
183 virtual void ConfirmCompositionText() OVERRIDE; | 186 virtual void ConfirmCompositionText() OVERRIDE; |
184 virtual void ClearCompositionText() OVERRIDE; | 187 virtual void ClearCompositionText() OVERRIDE; |
185 virtual void InsertText(const string16& text) OVERRIDE; | 188 virtual void InsertText(const string16& text) OVERRIDE; |
186 virtual void InsertChar(char16 ch, int flags) OVERRIDE; | 189 virtual void InsertChar(char16 ch, int flags) OVERRIDE; |
187 virtual ui::TextInputType GetTextInputType() const OVERRIDE; | 190 virtual ui::TextInputType GetTextInputType() const OVERRIDE; |
188 virtual bool CanComposeInline() const OVERRIDE; | 191 virtual bool CanComposeInline() const OVERRIDE; |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 // SchedulePaint() is invoked for |rect|. | 314 // SchedulePaint() is invoked for |rect|. |
312 void SchedulePaintIfNotInClip(const gfx::Rect& rect, const gfx::Rect& clip); | 315 void SchedulePaintIfNotInClip(const gfx::Rect& rect, const gfx::Rect& clip); |
313 | 316 |
314 // Helper method to determine if, in mouse locked mode, the cursor should be | 317 // Helper method to determine if, in mouse locked mode, the cursor should be |
315 // moved to center. | 318 // moved to center. |
316 bool ShouldMoveToCenter(); | 319 bool ShouldMoveToCenter(); |
317 | 320 |
318 // Run the compositing callbacks. | 321 // Run the compositing callbacks. |
319 void RunCompositingDidCommitCallbacks(); | 322 void RunCompositingDidCommitCallbacks(); |
320 | 323 |
321 struct BufferPresentedParams { | |
322 BufferPresentedParams(int route_id, | |
323 int gpu_host_id); | |
324 ~BufferPresentedParams(); | |
325 | |
326 int32 route_id; | |
327 int gpu_host_id; | |
328 scoped_refptr<ui::Texture> texture_to_produce; | |
329 }; | |
330 | |
331 // Insert a sync point into the compositor's command stream and acknowledge | |
332 // that we have presented the accelerated surface buffer. | |
333 static void InsertSyncPointAndACK(const BufferPresentedParams& params); | |
334 | |
335 // Called after |window_| is parented to a RootWindow. | 324 // Called after |window_| is parented to a RootWindow. |
336 void AddedToRootWindow(); | 325 void AddedToRootWindow(); |
337 | 326 |
338 // Called prior to removing |window_| from a RootWindow. | 327 // Called prior to removing |window_| from a RootWindow. |
339 void RemovingFromRootWindow(); | 328 void RemovingFromRootWindow(); |
340 | 329 |
341 // Called after commit for the last reference to the texture going away | 330 // Called after commit for the last reference to the texture going away |
342 // after it was released as the frontbuffer. | 331 // after it was released as the frontbuffer. |
343 void SetSurfaceNotInUseByCompositor(scoped_refptr<ui::Texture>); | 332 void SetSurfaceNotInUseByCompositor(scoped_refptr<ui::Texture>); |
344 | 333 |
345 // Called after async thumbnailer task completes. Used to call | 334 // Called after async thumbnailer task completes. Used to call |
346 // AdjustSurfaceProtection. | 335 // AdjustSurfaceProtection. |
347 static void CopyFromCompositingSurfaceFinished( | 336 static void CopyFromCompositingSurfaceFinished( |
348 base::WeakPtr<RenderWidgetHostViewAura> render_widget_host_view, | 337 base::WeakPtr<RenderWidgetHostViewAura> render_widget_host_view, |
349 const SkBitmap& bitmap, | 338 const SkBitmap& bitmap, |
350 const base::Callback<void(bool, const SkBitmap&)>& callback, | 339 const base::Callback<void(bool, const SkBitmap&)>& callback, |
351 bool result); | 340 bool result); |
352 | 341 |
353 ui::Compositor* GetCompositor(); | 342 ui::Compositor* GetCompositor(); |
354 | 343 |
355 // Detaches |this| from the input method object. | 344 // Detaches |this| from the input method object. |
356 void DetachFromInputMethod(); | 345 void DetachFromInputMethod(); |
357 | 346 |
358 // Dismisses a Web Popup on mouse press outside the popup and its parent. | 347 // Dismisses a Web Popup on mouse press outside the popup and its parent. |
359 void ApplyEventFilterForPopupExit(ui::MouseEvent* event); | 348 void ApplyEventFilterForPopupExit(ui::MouseEvent* event); |
360 | 349 |
361 // Converts |rect| from window coordinate to screen coordinate. | 350 // Converts |rect| from window coordinate to screen coordinate. |
362 gfx::Rect ConvertRectToScreen(const gfx::Rect& rect); | 351 gfx::Rect ConvertRectToScreen(const gfx::Rect& rect); |
363 | 352 |
| 353 typedef base::Callback<void(const scoped_refptr<ui::Texture>&)> |
| 354 BufferPresentedCallback; |
| 355 |
| 356 // The common entry point for full buffer updates from renderer |
| 357 // and GPU process. Returns false if the frame is being skipped. |
| 358 bool BuffersSwapped(const gfx::Size& size, |
| 359 const std::string& mailbox_name, |
| 360 const BufferPresentedCallback& ack_callback); |
| 361 |
364 bool SwapBuffersPrepare(const gfx::Rect& surface_rect, | 362 bool SwapBuffersPrepare(const gfx::Rect& surface_rect, |
365 const gfx::Rect& damage_rect, | 363 const gfx::Rect& damage_rect, |
366 const std::string& mailbox_name, | 364 const std::string& mailbox_name); |
367 BufferPresentedParams* params); | |
368 | 365 |
369 void SwapBuffersCompleted(const BufferPresentedParams& params); | 366 void SwapBuffersCompleted( |
| 367 const BufferPresentedCallback& ack_callback, |
| 368 const scoped_refptr<ui::Texture>& texture_to_return); |
370 | 369 |
371 #if defined(OS_WIN) | 370 #if defined(OS_WIN) |
372 // Sets the cutout rects from transient windows. These are rectangles that | 371 // Sets the cutout rects from transient windows. These are rectangles that |
373 // windowed NPAPI plugins shouldn't paint in. Overwrites any previous cutout | 372 // windowed NPAPI plugins shouldn't paint in. Overwrites any previous cutout |
374 // rects. | 373 // rects. |
375 void UpdateTransientRects(const std::vector<gfx::Rect>& rects); | 374 void UpdateTransientRects(const std::vector<gfx::Rect>& rects); |
376 | 375 |
377 // Updates the total list of cutout rects, which is the union of transient | 376 // Updates the total list of cutout rects, which is the union of transient |
378 // windows and constrained windows. | 377 // windows and constrained windows. |
379 void UpdateCutoutRects(); | 378 void UpdateCutoutRects(); |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
528 #endif | 527 #endif |
529 | 528 |
530 base::TimeTicks last_draw_ended_; | 529 base::TimeTicks last_draw_ended_; |
531 | 530 |
532 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAura); | 531 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAura); |
533 }; | 532 }; |
534 | 533 |
535 } // namespace content | 534 } // namespace content |
536 | 535 |
537 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_ | 536 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_ |
OLD | NEW |