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.
5 #ifndef ASH_WM_RESIZE_HANDLE_WINDOW_TARGETER_H_
6 #define ASH_WM_RESIZE_HANDLE_WINDOW_TARGETER_H_
8 #include "ash/wm/window_state_observer.h"
9 #include "ui/aura/window_observer.h"
10 #include "ui/aura/window_targeter.h"
11 #include "ui/gfx/geometry/insets.h"
15 class ImmersiveFullscreenController
;
17 // To allow easy resize, the resize handles should slightly overlap the content
18 // area of non-maximized and non-fullscreen windows. For immersive fullscreen
19 // windows, this targeter makes sure that touch-events towards the top of the
20 // screen are targeted to the window itself (instead of a child window that may
21 // otherwise have been targeted) when the top-of-window views are not revealed.
22 class ResizeHandleWindowTargeter
: public wm::WindowStateObserver
,
23 public aura::WindowObserver
,
24 public aura::WindowTargeter
{
26 ResizeHandleWindowTargeter(aura::Window
* window
,
27 ImmersiveFullscreenController
* immersive
);
28 ~ResizeHandleWindowTargeter() override
;
31 // wm::WindowStateObserver:
32 void OnPostWindowStateTypeChange(wm::WindowState
* window_state
,
33 wm::WindowStateType old_type
) override
;
34 // aura::WindowObserver:
35 void OnWindowDestroying(aura::Window
* window
) override
;
37 // aura::WindowTargeter:
38 ui::EventTarget
* FindTargetForLocatedEvent(ui::EventTarget
* root
,
39 ui::LocatedEvent
* event
) override
;
40 bool SubtreeShouldBeExploredForEvent(ui::EventTarget
* target
,
41 const ui::LocatedEvent
& event
) override
;
43 // The targeter does not take ownership of |window_| or
44 // |immersive_controller_|.
45 aura::Window
* window_
;
46 gfx::Insets frame_border_inset_
;
47 ImmersiveFullscreenController
* immersive_controller_
;
49 DISALLOW_COPY_AND_ASSIGN(ResizeHandleWindowTargeter
);
54 #endif // ASH_WM_RESIZE_HANDLE_WINDOW_TARGETER_H_