| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 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 | |
| 5 #ifndef UI_WM_PUBLIC_EASY_RESIZE_WINDOW_TARGETER_H_ | |
| 6 #define UI_WM_PUBLIC_EASY_RESIZE_WINDOW_TARGETER_H_ | |
| 7 | |
| 8 #include "ui/aura/window_targeter.h" | |
| 9 #include "ui/gfx/geometry/insets.h" | |
| 10 | |
| 11 namespace wm { | |
| 12 | |
| 13 // An EventTargeter for a container window that uses a slightly larger | |
| 14 // hit-target region for easier resize. | |
| 15 class EasyResizeWindowTargeter : public aura::WindowTargeter { | |
| 16 public: | |
| 17 // |container| window is the owner of this targeter. | |
| 18 EasyResizeWindowTargeter(aura::Window* container, | |
| 19 const gfx::Insets& mouse_extend, | |
| 20 const gfx::Insets& touch_extend); | |
| 21 | |
| 22 virtual ~EasyResizeWindowTargeter(); | |
| 23 | |
| 24 protected: | |
| 25 void set_mouse_extend(const gfx::Insets& mouse_extend) { | |
| 26 mouse_extend_ = mouse_extend; | |
| 27 } | |
| 28 | |
| 29 void set_touch_extend(const gfx::Insets& touch_extend) { | |
| 30 touch_extend_ = touch_extend; | |
| 31 } | |
| 32 | |
| 33 // aura::WindowTargeter: | |
| 34 virtual bool EventLocationInsideBounds( | |
| 35 aura::Window* window, | |
| 36 const ui::LocatedEvent& event) const OVERRIDE; | |
| 37 | |
| 38 private: | |
| 39 // Returns true if the hit testing (EventLocationInsideBounds()) should use | |
| 40 // the extended bounds. | |
| 41 bool ShouldUseExtendedBounds(const aura::Window* window) const; | |
| 42 | |
| 43 aura::Window* container_; | |
| 44 gfx::Insets mouse_extend_; | |
| 45 gfx::Insets touch_extend_; | |
| 46 | |
| 47 DISALLOW_COPY_AND_ASSIGN(EasyResizeWindowTargeter); | |
| 48 }; | |
| 49 | |
| 50 } // namespace wm | |
| 51 | |
| 52 #endif // UI_WM_PUBLIC_EASY_RESIZE_WINDOW_TARGETER_H_ | |
| OLD | NEW |