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