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