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 virtual ~ResizeHandleWindowTargeter();
31 // wm::WindowStateObserver:
32 virtual void OnPostWindowStateTypeChange(
33 wm::WindowState
* window_state
,
34 wm::WindowStateType old_type
) OVERRIDE
;
35 // aura::WindowObserver:
36 virtual void OnWindowDestroying(aura::Window
* window
) OVERRIDE
;
38 // aura::WindowTargeter:
39 virtual ui::EventTarget
* FindTargetForLocatedEvent(
40 ui::EventTarget
* root
,
41 ui::LocatedEvent
* event
) OVERRIDE
;
42 virtual bool SubtreeShouldBeExploredForEvent(
43 ui::EventTarget
* target
,
44 const ui::LocatedEvent
& event
) OVERRIDE
;
46 // The targeter does not take ownership of |window_| or
47 // |immersive_controller_|.
48 aura::Window
* window_
;
49 gfx::Insets frame_border_inset_
;
50 ImmersiveFullscreenController
* immersive_controller_
;
52 DISALLOW_COPY_AND_ASSIGN(ResizeHandleWindowTargeter
);
57 #endif // ASH_WM_RESIZE_HANDLE_WINDOW_TARGETER_H_