shared_display_edge_indicator.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. // Copyright (c) 2012 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_DISPLAY_SHARED_DISPLAY_EDGE_INDICATOR_H_
  5. #define ASH_DISPLAY_SHARED_DISPLAY_EDGE_INDICATOR_H_
  6. #include <memory>
  7. #include "ash/ash_export.h"
  8. #include "ui/gfx/animation/animation_delegate.h"
  9. namespace gfx {
  10. class Rect;
  11. class ThrobAnimation;
  12. }
  13. namespace views {
  14. class Widget;
  15. }
  16. namespace ash {
  17. // SharedDisplayEdgeIndicator is responsible for showing a window that indicates
  18. // the edge that a window can be dragged into another display.
  19. class ASH_EXPORT SharedDisplayEdgeIndicator : public gfx::AnimationDelegate {
  20. public:
  21. SharedDisplayEdgeIndicator();
  22. SharedDisplayEdgeIndicator(const SharedDisplayEdgeIndicator&) = delete;
  23. SharedDisplayEdgeIndicator& operator=(const SharedDisplayEdgeIndicator&) =
  24. delete;
  25. ~SharedDisplayEdgeIndicator() override;
  26. // Shows the indicator window. The |src_bounds| is for the window on the
  27. // source display, and the |dst_bounds| is for the window on the other
  28. // display. Hiding is done in the destructor, when the widgets get released.
  29. void Show(const gfx::Rect& src_bounds, const gfx::Rect& dst_bounds);
  30. // gfx::AnimationDelegate:
  31. void AnimationProgressed(const gfx::Animation* animation) override;
  32. private:
  33. // Used to show the displays' shared edge where a window can be moved across.
  34. // |src_widget_| is for the display where drag starts and |dst_widget_| is
  35. // for the other display.
  36. std::unique_ptr<views::Widget> src_widget_;
  37. std::unique_ptr<views::Widget> dst_widget_;
  38. // Used to transition the opacity.
  39. std::unique_ptr<gfx::ThrobAnimation> animation_;
  40. };
  41. } // namespace ash
  42. #endif // ASH_DISPLAY_SHARED_DISPLAY_EDGE_INDICATOR_H_