Torne (Richard Coles) | 5d1f7b1 | 2014-02-21 12:16:55 +0000 | [diff] [blame] | 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 ASH_WM_RESIZE_HANDLE_WINDOW_TARGETER_H_ |
| 6 | #define ASH_WM_RESIZE_HANDLE_WINDOW_TARGETER_H_ |
| 7 | |
| 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" |
| 12 | |
| 13 | namespace ash { |
| 14 | |
| 15 | class ImmersiveFullscreenController; |
| 16 | |
| 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 { |
| 25 | public: |
| 26 | ResizeHandleWindowTargeter(aura::Window* window, |
| 27 | ImmersiveFullscreenController* immersive); |
| 28 | virtual ~ResizeHandleWindowTargeter(); |
| 29 | |
| 30 | private: |
| 31 | // wm::WindowStateObserver: |
Torne (Richard Coles) | a140131 | 2014-03-18 10:20:56 +0000 | [diff] [blame] | 32 | virtual void OnPostWindowStateTypeChange( |
| 33 | wm::WindowState* window_state, |
| 34 | wm::WindowStateType old_type) OVERRIDE; |
Torne (Richard Coles) | 5d1f7b1 | 2014-02-21 12:16:55 +0000 | [diff] [blame] | 35 | // aura::WindowObserver: |
| 36 | virtual void OnWindowDestroying(aura::Window* window) OVERRIDE; |
| 37 | |
| 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; |
| 45 | |
| 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_; |
| 51 | |
| 52 | DISALLOW_COPY_AND_ASSIGN(ResizeHandleWindowTargeter); |
| 53 | }; |
| 54 | |
| 55 | } // namespace ash |
| 56 | |
| 57 | #endif // ASH_WM_RESIZE_HANDLE_WINDOW_TARGETER_H_ |