| OLD | NEW |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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_MEDIA_CAPTURE_CURSOR_RENDERER_AURA_H_ | 5 #ifndef CONTENT_BROWSER_MEDIA_CAPTURE_CURSOR_RENDERER_AURA_H_ |
| 6 #define CONTENT_BROWSER_MEDIA_CAPTURE_CURSOR_RENDERER_AURA_H_ | 6 #define CONTENT_BROWSER_MEDIA_CAPTURE_CURSOR_RENDERER_AURA_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 | 34 |
| 35 // CursorRender implementation. | 35 // CursorRender implementation. |
| 36 void Clear() final; | 36 void Clear() final; |
| 37 bool SnapshotCursorState(const gfx::Rect& region_in_frame) final; | 37 bool SnapshotCursorState(const gfx::Rect& region_in_frame) final; |
| 38 void RenderOnVideoFrame( | 38 void RenderOnVideoFrame( |
| 39 const scoped_refptr<media::VideoFrame>& target) const final; | 39 const scoped_refptr<media::VideoFrame>& target) const final; |
| 40 base::WeakPtr<CursorRenderer> GetWeakPtr() final; | 40 base::WeakPtr<CursorRenderer> GetWeakPtr() final; |
| 41 | 41 |
| 42 // ui::EventHandler overrides. | 42 // ui::EventHandler overrides. |
| 43 void OnMouseEvent(ui::MouseEvent* event) final; | 43 void OnMouseEvent(ui::MouseEvent* event) final; |
| 44 void OnEvent(ui::Event* event) final; |
| 44 | 45 |
| 45 // aura::WindowObserver overrides. | 46 // aura::WindowObserver overrides. |
| 46 void OnWindowDestroying(aura::Window* window) final; | 47 void OnWindowDestroying(aura::Window* window) final; |
| 47 | 48 |
| 49 bool ui_event_detected() const final; |
| 50 |
| 48 private: | 51 private: |
| 49 friend class CursorRendererAuraTest; | 52 friend class CursorRendererAuraTest; |
| 50 | 53 |
| 51 aura::Window* window_; | 54 aura::Window* window_; |
| 52 | 55 |
| 53 // Snapshot of cursor, source size, position, and cursor bitmap; as of the | 56 // Snapshot of cursor, source size, position, and cursor bitmap; as of the |
| 54 // last call to SnapshotCursorState. | 57 // last call to SnapshotCursorState. |
| 55 ui::Cursor last_cursor_; | 58 ui::Cursor last_cursor_; |
| 56 gfx::Size window_size_when_cursor_last_updated_; | 59 gfx::Size window_size_when_cursor_last_updated_; |
| 57 gfx::Point cursor_position_in_frame_; | 60 gfx::Point cursor_position_in_frame_; |
| 58 SkBitmap scaled_cursor_bitmap_; | 61 SkBitmap scaled_cursor_bitmap_; |
| 59 | 62 |
| 60 // Updated in mouse event listener and used to make a decision on | 63 // Updated in mouse event listener and used to make a decision on |
| 61 // when the cursor is rendered. | 64 // when the cursor is rendered. |
| 62 base::TimeDelta last_mouse_movement_timestamp_; | 65 base::TimeDelta last_mouse_movement_timestamp_; |
| 63 float last_mouse_position_x_; | 66 float last_mouse_position_x_; |
| 64 float last_mouse_position_y_; | 67 float last_mouse_position_y_; |
| 65 bool cursor_displayed_; | 68 bool cursor_displayed_; |
| 66 | 69 |
| 70 base::TimeTicks last_time_ui_event_detected_; |
| 71 |
| 67 // Allows tests to replace the clock. | 72 // Allows tests to replace the clock. |
| 68 base::DefaultTickClock default_tick_clock_; | 73 base::DefaultTickClock default_tick_clock_; |
| 69 base::TickClock* tick_clock_; | 74 base::TickClock* tick_clock_; |
| 70 | 75 |
| 71 base::WeakPtrFactory<CursorRendererAura> weak_factory_; | 76 base::WeakPtrFactory<CursorRendererAura> weak_factory_; |
| 72 | 77 |
| 73 DISALLOW_COPY_AND_ASSIGN(CursorRendererAura); | 78 DISALLOW_COPY_AND_ASSIGN(CursorRendererAura); |
| 74 }; | 79 }; |
| 75 | 80 |
| 76 } // namespace content | 81 } // namespace content |
| 77 | 82 |
| 78 #endif // CONTENT_BROWSER_MEDIA_CAPTURE_CURSOR_RENDERER_AURA_H_ | 83 #endif // CONTENT_BROWSER_MEDIA_CAPTURE_CURSOR_RENDERER_AURA_H_ |
| OLD | NEW |