ash_window_tree_host_platform.h 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. // Copyright 2016 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_HOST_ASH_WINDOW_TREE_HOST_PLATFORM_H_
  5. #define ASH_HOST_ASH_WINDOW_TREE_HOST_PLATFORM_H_
  6. #include <memory>
  7. #include "ash/ash_export.h"
  8. #include "ash/host/ash_window_tree_host.h"
  9. #include "ash/host/transformer_helper.h"
  10. #include "base/gtest_prod_util.h"
  11. #include "ui/aura/window_tree_host_platform.h"
  12. #include "ui/ozone/public/input_controller.h"
  13. namespace ui {
  14. struct PlatformWindowInitProperties;
  15. }
  16. namespace ash {
  17. class AshWindowTreeHostDelegate;
  18. class ExtendedMouseWarpControllerTest;
  19. class AshWindowTreeHostPlatformTest;
  20. class ASH_EXPORT AshWindowTreeHostPlatform
  21. : public AshWindowTreeHost,
  22. public aura::WindowTreeHostPlatform {
  23. public:
  24. AshWindowTreeHostPlatform(ui::PlatformWindowInitProperties properties,
  25. AshWindowTreeHostDelegate* delegate);
  26. AshWindowTreeHostPlatform(const AshWindowTreeHostPlatform&) = delete;
  27. AshWindowTreeHostPlatform& operator=(const AshWindowTreeHostPlatform&) =
  28. delete;
  29. ~AshWindowTreeHostPlatform() override;
  30. protected:
  31. friend ExtendedMouseWarpControllerTest;
  32. FRIEND_TEST_ALL_PREFIXES(ExtendedMouseWarpControllerTest,
  33. CheckHostPointToScreenInMouseWarpRegion);
  34. friend AshWindowTreeHostPlatformTest;
  35. FRIEND_TEST_ALL_PREFIXES(AshWindowTreeHostPlatformTest, UnadjustedMovement);
  36. AshWindowTreeHostPlatform(std::unique_ptr<ui::PlatformWindow> window,
  37. AshWindowTreeHostDelegate* delegate,
  38. size_t compositor_memory_limit_mb = 0);
  39. // AshWindowTreeHost:
  40. void ConfineCursorToRootWindow() override;
  41. void ConfineCursorToBoundsInRoot(const gfx::Rect& bounds_in_root) override;
  42. gfx::Rect GetLastCursorConfineBoundsInPixels() const override;
  43. void SetRootWindowTransformer(
  44. std::unique_ptr<RootWindowTransformer> transformer) override;
  45. gfx::Insets GetHostInsets() const override;
  46. aura::WindowTreeHost* AsWindowTreeHost() override;
  47. void PrepareForShutdown() override;
  48. void UpdateCursorConfig() override;
  49. void ClearCursorConfig() override;
  50. void UpdateRootWindowSize() override;
  51. // aura::WindowTreeHostPlatform:
  52. void SetRootTransform(const gfx::Transform& transform) override;
  53. gfx::Transform GetRootTransform() const override;
  54. gfx::Transform GetInverseRootTransform() const override;
  55. gfx::Rect GetTransformedRootWindowBoundsFromPixelSize(
  56. const gfx::Size& host_size_in_pixels) const override;
  57. void OnCursorVisibilityChangedNative(bool show) override;
  58. void SetBoundsInPixels(const gfx::Rect& bounds) override;
  59. void DispatchEvent(ui::Event* event) override;
  60. std::unique_ptr<aura::ScopedEnableUnadjustedMouseEvents>
  61. RequestUnadjustedMovement() override;
  62. AshWindowTreeHostDelegate* delegate_ = nullptr; // Not owned.
  63. private:
  64. // All constructors call into this.
  65. void CommonInit();
  66. // Temporarily disable the tap-to-click feature. Used on CrOS.
  67. void SetTapToClickPaused(bool state);
  68. TransformerHelper transformer_helper_;
  69. ui::InputController* input_controller_ = nullptr;
  70. gfx::Rect last_cursor_confine_bounds_in_pixels_;
  71. };
  72. } // namespace ash
  73. #endif // ASH_HOST_ASH_WINDOW_TREE_HOST_PLATFORM_H_