native_cursor_manager_ash.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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
  3. // found in the LICENSE file.
  4. #ifndef ASH_WM_NATIVE_CURSOR_MANAGER_ASH_H_
  5. #define ASH_WM_NATIVE_CURSOR_MANAGER_ASH_H_
  6. #include "ash/ash_export.h"
  7. #include "ui/display/display.h"
  8. #include "ui/wm/core/cursor_loader.h"
  9. #include "ui/wm/core/native_cursor_manager.h"
  10. namespace ash {
  11. // This does the ash-specific setting of cursor details like cursor
  12. // visibility. It communicates back with the CursorManager through the
  13. // NativeCursorManagerDelegate interface, which receives messages about what
  14. // changes were acted on.
  15. class ASH_EXPORT NativeCursorManagerAsh : public ::wm::NativeCursorManager {
  16. public:
  17. NativeCursorManagerAsh();
  18. NativeCursorManagerAsh(const NativeCursorManagerAsh&) = delete;
  19. NativeCursorManagerAsh& operator=(const NativeCursorManagerAsh&) = delete;
  20. ~NativeCursorManagerAsh() override;
  21. // Toggle native cursor enabled/disabled.
  22. // The native cursor is enabled by default. When disabled, we hide the native
  23. // cursor regardless of visibility state, and let CursorWindowController draw
  24. // the cursor.
  25. void SetNativeCursorEnabled(bool enabled);
  26. // Returns the rotation of the currently loaded cursor.
  27. display::Display::Rotation GetRotation() const;
  28. // Overridden from ::wm::NativeCursorManager:
  29. void SetDisplay(const display::Display& display,
  30. ::wm::NativeCursorManagerDelegate* delegate) override;
  31. void SetCursor(gfx::NativeCursor cursor,
  32. ::wm::NativeCursorManagerDelegate* delegate) override;
  33. void SetVisibility(bool visible,
  34. ::wm::NativeCursorManagerDelegate* delegate) override;
  35. void SetCursorSize(ui::CursorSize cursor_size,
  36. ::wm::NativeCursorManagerDelegate* delegate) override;
  37. void SetMouseEventsEnabled(
  38. bool enabled,
  39. ::wm::NativeCursorManagerDelegate* delegate) override;
  40. private:
  41. friend class CursorManagerTestApi;
  42. // The cursor location where the cursor was disabled.
  43. gfx::Point disabled_cursor_location_;
  44. bool native_cursor_enabled_;
  45. wm::CursorLoader cursor_loader_{/*use_platform_cursors=*/false};
  46. };
  47. } // namespace ash
  48. #endif // ASH_WM_NATIVE_CURSOR_MANAGER_ASH_H_