OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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_WM_ASH_NATIVE_CURSOR_MANAGER_H_ | 5 #ifndef ASH_WM_NATIVE_CURSOR_MANAGER_ASH_CLASSIC_H_ |
6 #define ASH_WM_ASH_NATIVE_CURSOR_MANAGER_H_ | 6 #define ASH_WM_NATIVE_CURSOR_MANAGER_ASH_CLASSIC_H_ |
7 | 7 |
8 #include <memory> | 8 #include "ash/wm/native_cursor_manager_ash.h" |
9 | |
10 #include "ash/ash_export.h" | |
11 #include "base/compiler_specific.h" | |
12 #include "base/macros.h" | |
13 #include "base/strings/string16.h" | |
14 #include "ui/gfx/geometry/point.h" | |
15 #include "ui/gfx/native_widget_types.h" | |
16 #include "ui/wm/core/native_cursor_manager.h" | |
17 #include "ui/wm/core/native_cursor_manager_delegate.h" | |
18 | 9 |
19 namespace ui { | 10 namespace ui { |
20 class ImageCursors; | 11 class ImageCursors; |
21 } | 12 } |
22 | 13 |
23 namespace ash { | 14 namespace ash { |
24 | 15 |
25 namespace test { | 16 namespace test { |
26 class CursorManagerTestApi; | 17 class CursorManagerTestApi; |
27 } | 18 } |
28 | 19 |
29 // This does the ash-specific setting of cursor details like cursor | 20 // This does the ash-specific setting of cursor details like cursor |
30 // visibility. It communicates back with the CursorManager through the | 21 // visibility. It communicates back with the CursorManager through the |
31 // NativeCursorManagerDelegate interface, which receives messages about what | 22 // NativeCursorManagerDelegate interface, which receives messages about what |
32 // changes were acted on. | 23 // changes were acted on. |
33 class ASH_EXPORT AshNativeCursorManager : public ::wm::NativeCursorManager { | 24 class ASH_EXPORT NativeCursorManagerAshClassic : public NativeCursorManagerAsh { |
34 public: | 25 public: |
35 AshNativeCursorManager(); | 26 NativeCursorManagerAshClassic(); |
36 ~AshNativeCursorManager() override; | 27 ~NativeCursorManagerAshClassic() override; |
37 | |
38 // Toggle native cursor enabled/disabled. | |
39 // The native cursor is enabled by default. When disabled, we hide the native | |
40 // cursor regardless of visibility state, and let CursorWindowManager draw | |
41 // the cursor. | |
42 void SetNativeCursorEnabled(bool enabled); | |
43 | 28 |
44 private: | 29 private: |
45 friend class test::CursorManagerTestApi; | 30 friend class test::CursorManagerTestApi; |
46 | 31 |
| 32 // Overridden from NativeCursorManagerAsh: |
| 33 void SetNativeCursorEnabled(bool enabled) override; |
| 34 float GetScale() const override; |
| 35 display::Display::Rotation GetRotation() const override; |
| 36 |
47 // Overridden from ::wm::NativeCursorManager: | 37 // Overridden from ::wm::NativeCursorManager: |
48 void SetDisplay(const display::Display& display, | 38 void SetDisplay(const display::Display& display, |
49 ::wm::NativeCursorManagerDelegate* delegate) override; | 39 ::wm::NativeCursorManagerDelegate* delegate) override; |
50 void SetCursor(gfx::NativeCursor cursor, | 40 void SetCursor(gfx::NativeCursor cursor, |
51 ::wm::NativeCursorManagerDelegate* delegate) override; | 41 ::wm::NativeCursorManagerDelegate* delegate) override; |
52 void SetVisibility(bool visible, | 42 void SetVisibility(bool visible, |
53 ::wm::NativeCursorManagerDelegate* delegate) override; | 43 ::wm::NativeCursorManagerDelegate* delegate) override; |
54 void SetCursorSet(ui::CursorSetType cursor_set, | 44 void SetCursorSet(ui::CursorSetType cursor_set, |
55 ::wm::NativeCursorManagerDelegate* delegate) override; | 45 ::wm::NativeCursorManagerDelegate* delegate) override; |
56 void SetMouseEventsEnabled( | 46 void SetMouseEventsEnabled( |
57 bool enabled, | 47 bool enabled, |
58 ::wm::NativeCursorManagerDelegate* delegate) override; | 48 ::wm::NativeCursorManagerDelegate* delegate) override; |
59 | 49 |
60 // The cursor location where the cursor was disabled. | 50 // The cursor location where the cursor was disabled. |
61 gfx::Point disabled_cursor_location_; | 51 gfx::Point disabled_cursor_location_; |
62 | 52 |
63 bool native_cursor_enabled_; | 53 bool native_cursor_enabled_; |
64 | 54 |
65 std::unique_ptr<ui::ImageCursors> image_cursors_; | 55 std::unique_ptr<ui::ImageCursors> image_cursors_; |
66 | 56 |
67 DISALLOW_COPY_AND_ASSIGN(AshNativeCursorManager); | 57 DISALLOW_COPY_AND_ASSIGN(NativeCursorManagerAshClassic); |
68 }; | 58 }; |
69 | 59 |
70 } // namespace ash | 60 } // namespace ash |
71 | 61 |
72 #endif // ASH_WM_ASH_NATIVE_CURSOR_MANAGER_H_ | 62 #endif // ASH_WM_NATIVE_CURSOR_MANAGER_ASH_CLASSIC_H_ |
OLD | NEW |