| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 ASH_DISPLAY_CURSOR_WINDOW_CONTROLLER_H_ | 5 #ifndef ASH_DISPLAY_CURSOR_WINDOW_CONTROLLER_H_ |
| 6 #define ASH_DISPLAY_CURSOR_WINDOW_CONTROLLER_H_ | 6 #define ASH_DISPLAY_CURSOR_WINDOW_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include "ui/aura/window.h" | 8 #include "ui/aura/window.h" |
| 9 #include "ui/base/cursor/cursor.h" | 9 #include "ui/base/cursor/cursor.h" |
| 10 #include "ui/gfx/display.h" | 10 #include "ui/gfx/display.h" |
| 11 | 11 |
| 12 namespace ash { | 12 namespace ash { |
| 13 namespace test { | 13 namespace test { |
| 14 class MirrorWindowTestApi; | 14 class MirrorWindowTestApi; |
| 15 } | 15 } |
| 16 | 16 |
| 17 class CursorWindowControllerTest; |
| 17 class CursorWindowDelegate; | 18 class CursorWindowDelegate; |
| 18 | 19 |
| 19 // Draws a mouse cursor on a given container window. | 20 // Draws a mouse cursor on a given container window. |
| 20 // When cursor compositing is disabled, CursorWindowController is responsible | 21 // When cursor compositing is disabled, CursorWindowController is responsible |
| 21 // to scale and rotate the mouse cursor bitmap to match settings of the | 22 // to scale and rotate the mouse cursor bitmap to match settings of the |
| 22 // primary display. | 23 // primary display. |
| 23 // When cursor compositing is enabled, just draw the cursor as-is. | 24 // When cursor compositing is enabled, just draw the cursor as-is. |
| 24 class CursorWindowController { | 25 class CursorWindowController { |
| 25 public: | 26 public: |
| 26 CursorWindowController(); | 27 CursorWindowController(); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 40 // Only applicable when cursor compositing is enabled. | 41 // Only applicable when cursor compositing is enabled. |
| 41 void SetDisplay(const gfx::Display& display); | 42 void SetDisplay(const gfx::Display& display); |
| 42 | 43 |
| 43 // Sets cursor location, shape, set and visibility. | 44 // Sets cursor location, shape, set and visibility. |
| 44 void UpdateLocation(); | 45 void UpdateLocation(); |
| 45 void SetCursor(gfx::NativeCursor cursor); | 46 void SetCursor(gfx::NativeCursor cursor); |
| 46 void SetCursorSet(ui::CursorSetType); | 47 void SetCursorSet(ui::CursorSetType); |
| 47 void SetVisibility(bool visible); | 48 void SetVisibility(bool visible); |
| 48 | 49 |
| 49 private: | 50 private: |
| 51 friend class CursorWindowControllerTest; |
| 50 friend class test::MirrorWindowTestApi; | 52 friend class test::MirrorWindowTestApi; |
| 51 | 53 |
| 52 // Sets the container window for the cursor window controller. | 54 // Sets the container window for the cursor window controller. |
| 53 // Closes the cursor window if |container| is NULL. | 55 // Closes the cursor window if |container| is NULL. |
| 54 void SetContainer(aura::Window* container); | 56 void SetContainer(aura::Window* container); |
| 55 | 57 |
| 56 // Sets the bounds of the container in screen coordinates. | 58 // Sets the bounds of the container in screen coordinates. |
| 57 void SetBoundsInScreen(const gfx::Rect& bounds); | 59 void SetBoundsInScreen(const gfx::Rect& bounds); |
| 58 | 60 |
| 59 // Updates cursor image based on current cursor state. | 61 // Updates cursor image based on current cursor state. |
| 60 void UpdateCursorImage(); | 62 void UpdateCursorImage(); |
| 61 | 63 |
| 62 bool is_cursor_compositing_enabled_; | 64 bool is_cursor_compositing_enabled_; |
| 63 aura::Window* container_; | 65 aura::Window* container_; |
| 64 | 66 |
| 65 // The bounds of the container in screen coordinates. | 67 // The bounds of the container in screen coordinates. |
| 66 gfx::Rect bounds_in_screen_; | 68 gfx::Rect bounds_in_screen_; |
| 67 | 69 |
| 68 // The native_type of the cursor, see definitions in cursor.h | 70 // The native_type of the cursor, see definitions in cursor.h |
| 69 int cursor_type_; | 71 int cursor_type_; |
| 70 | 72 |
| 71 ui::CursorSetType cursor_set_; | 73 ui::CursorSetType cursor_set_; |
| 72 gfx::Display::Rotation cursor_rotation_; | |
| 73 gfx::Point hot_point_; | 74 gfx::Point hot_point_; |
| 74 | 75 |
| 75 // The display on which the cursor is drawn. | 76 // The display on which the cursor is drawn. |
| 76 // For mirroring mode, the display is always the primary display. | 77 // For mirroring mode, the display is always the primary display. |
| 77 gfx::Display display_; | 78 gfx::Display display_; |
| 78 | 79 |
| 79 scoped_ptr<aura::Window> cursor_window_; | 80 scoped_ptr<aura::Window> cursor_window_; |
| 80 scoped_ptr<CursorWindowDelegate> delegate_; | 81 scoped_ptr<CursorWindowDelegate> delegate_; |
| 81 | 82 |
| 82 DISALLOW_COPY_AND_ASSIGN(CursorWindowController); | 83 DISALLOW_COPY_AND_ASSIGN(CursorWindowController); |
| 83 }; | 84 }; |
| 84 | 85 |
| 85 } // namespace ash | 86 } // namespace ash |
| 86 | 87 |
| 87 #endif // ASH_DISPLAY_CURSOR_WINDOW_CONTROLLER_H_ | 88 #endif // ASH_DISPLAY_CURSOR_WINDOW_CONTROLLER_H_ |
| OLD | NEW |