shelf_window_targeter.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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_SHELF_SHELF_WINDOW_TARGETER_H_
  5. #define ASH_SHELF_SHELF_WINDOW_TARGETER_H_
  6. #include "ash/shelf/shelf_observer.h"
  7. #include "ui/aura/window_observer.h"
  8. #include "ui/wm/core/easy_resize_window_targeter.h"
  9. namespace ash {
  10. class Shelf;
  11. // ShelfWindowTargeter makes it easier to resize windows with the mouse when the
  12. // window-edge slightly overlaps with the shelf edge. The targeter also makes it
  13. // easier to drag the shelf out with touch while it is hidden.
  14. class ShelfWindowTargeter : public ::wm::EasyResizeWindowTargeter,
  15. public aura::WindowObserver,
  16. public ShelfObserver {
  17. public:
  18. ShelfWindowTargeter(aura::Window* container, Shelf* shelf);
  19. ShelfWindowTargeter(const ShelfWindowTargeter&) = delete;
  20. ShelfWindowTargeter& operator=(const ShelfWindowTargeter&) = delete;
  21. ~ShelfWindowTargeter() override;
  22. private:
  23. // ::wm::EasyResizeWindowTargeter:
  24. bool ShouldUseExtendedBounds(const aura::Window* window) const override;
  25. bool GetHitTestRects(aura::Window* target,
  26. gfx::Rect* hit_test_rect_mouse,
  27. gfx::Rect* hit_test_rect_touch) const override;
  28. // aura::WindowObserver:
  29. void OnWindowDestroying(aura::Window* window) override;
  30. // ShelfObserver:
  31. void WillChangeVisibilityState(ShelfVisibilityState new_state) override;
  32. Shelf* shelf_;
  33. };
  34. } // namespace ash
  35. #endif // ASH_SHELF_SHELF_WINDOW_TARGETER_H_