cast_window_manager_aura.h 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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 CHROMECAST_GRAPHICS_CAST_WINDOW_MANAGER_AURA_H_
  5. #define CHROMECAST_GRAPHICS_CAST_WINDOW_MANAGER_AURA_H_
  6. #include <memory>
  7. #include "base/observer_list.h"
  8. #include "chromecast/graphics/cast_window_manager.h"
  9. #include "ui/aura/client/default_capture_client.h"
  10. #include "ui/aura/client/window_parenting_client.h"
  11. #include "ui/aura/window_tree_host_platform.h"
  12. namespace aura {
  13. namespace client {
  14. class ScreenPositionClient;
  15. } // namespace client
  16. } // namespace aura
  17. namespace chromecast {
  18. class CastTouchEventGate;
  19. class CastFocusClientAura;
  20. class CastGestureHandler;
  21. class CastSystemGestureEventHandler;
  22. class CastSystemGestureDispatcher;
  23. class SideSwipeDetector;
  24. class CastWindowTreeHostAura;
  25. class CastWindowManagerAura : public CastWindowManager,
  26. public aura::client::WindowParentingClient {
  27. public:
  28. explicit CastWindowManagerAura(bool enable_input);
  29. CastWindowManagerAura(const CastWindowManagerAura&) = delete;
  30. CastWindowManagerAura& operator=(const CastWindowManagerAura&) = delete;
  31. ~CastWindowManagerAura() override;
  32. void Setup();
  33. void OnWindowOrderChanged(std::vector<WindowId> window_order);
  34. // CastWindowManager implementation:
  35. void TearDown() override;
  36. void AddWindow(gfx::NativeView window) override;
  37. gfx::NativeView GetRootWindow() override;
  38. std::vector<WindowId> GetWindowOrder() override;
  39. void SetZOrder(gfx::NativeView window, mojom::ZOrder z_order) override;
  40. void InjectEvent(ui::Event* event) override;
  41. void AddObserver(Observer* observer) override;
  42. void RemoveObserver(Observer* observer) override;
  43. void AddGestureHandler(CastGestureHandler* handler) override;
  44. void RemoveGestureHandler(CastGestureHandler* handler) override;
  45. void SetTouchInputDisabled(bool disabled) override;
  46. void AddTouchActivityObserver(CastTouchActivityObserver* observer) override;
  47. void RemoveTouchActivityObserver(
  48. CastTouchActivityObserver* observer) override;
  49. // aura::client::WindowParentingClient implementation:
  50. aura::Window* GetDefaultParent(aura::Window* window,
  51. const gfx::Rect& bounds) override;
  52. CastWindowTreeHostAura* window_tree_host() const;
  53. CastGestureHandler* GetGestureHandler() const;
  54. aura::client::CaptureClient* capture_client() const {
  55. return capture_client_.get();
  56. }
  57. private:
  58. const bool enable_input_;
  59. std::unique_ptr<CastWindowTreeHostAura> window_tree_host_;
  60. std::unique_ptr<aura::client::DefaultCaptureClient> capture_client_;
  61. std::unique_ptr<CastFocusClientAura> focus_client_;
  62. std::unique_ptr<aura::client::ScreenPositionClient> screen_position_client_;
  63. std::unique_ptr<CastTouchEventGate> event_gate_;
  64. std::unique_ptr<CastSystemGestureDispatcher> system_gesture_dispatcher_;
  65. std::unique_ptr<CastSystemGestureEventHandler> system_gesture_event_handler_;
  66. std::unique_ptr<SideSwipeDetector> side_swipe_detector_;
  67. std::vector<WindowId> window_order_;
  68. base::ObserverList<Observer>::Unchecked observer_list_;
  69. };
  70. } // namespace chromecast
  71. #endif // CHROMECAST_GRAPHICS_CAST_WINDOW_MANAGER_AURA_H_