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_CORE_EASY_RESIZE_WINDOW_TARGETER_H_ 6 #define UI_WM_CORE_EASY_RESIZE_WINDOW_TARGETER_H_ 7 8 #include "base/macros.h" 9 #include "ui/aura/window_targeter.h" 10 #include "ui/wm/core/wm_core_export.h" 11 12 namespace gfx { 13 class Insets; 14 } 15 16 namespace wm { 17 18 // An EventTargeter for a container window that uses a slightly larger 19 // hit-target region for easier resize. It extends the hit test region for child 20 // windows (top level Widgets that are resizable) to outside their bounds. For 21 // Ash, this correlates to ash::kResizeOutsideBoundsSize. For the interior 22 // resize area, see ash::InstallResizeHandleWindowTargeterForWindow(). 23 class WM_CORE_EXPORT EasyResizeWindowTargeter : public aura::WindowTargeter { 24 public: 25 // NOTE: the insets must be negative. 26 EasyResizeWindowTargeter(const gfx::Insets& mouse_extend, 27 const gfx::Insets& touch_extend); 28 29 ~EasyResizeWindowTargeter() override; 30 31 private: 32 // aura::WindowTargeter: 33 // Delegates to WindowTargeter's impl and prevents overriding in subclasses. 34 bool EventLocationInsideBounds(aura::Window* target, 35 const ui::LocatedEvent& event) const override; 36 37 // Returns true if the hit testing (GetHitTestRects()) should use the 38 // extended bounds. 39 bool ShouldUseExtendedBounds(const aura::Window* w) const override; 40 41 DISALLOW_COPY_AND_ASSIGN(EasyResizeWindowTargeter); 42 }; 43 44 } // namespace wm 45 46 #endif // UI_WM_CORE_EASY_RESIZE_WINDOW_TARGETER_H_ 47