15d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// Copyright 2014 The Chromium Authors. All rights reserved. 25d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 35d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// found in the LICENSE file. 45d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 55d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#ifndef ASH_WM_RESIZE_HANDLE_WINDOW_TARGETER_H_ 65d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#define ASH_WM_RESIZE_HANDLE_WINDOW_TARGETER_H_ 75d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 85d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "ash/wm/window_state_observer.h" 95d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "ui/aura/window_observer.h" 105d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "ui/aura/window_targeter.h" 115d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "ui/gfx/geometry/insets.h" 125d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 135d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)namespace ash { 145d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 155d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)class ImmersiveFullscreenController; 165d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 175d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// To allow easy resize, the resize handles should slightly overlap the content 185d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// area of non-maximized and non-fullscreen windows. For immersive fullscreen 195d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// windows, this targeter makes sure that touch-events towards the top of the 205d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// screen are targeted to the window itself (instead of a child window that may 215d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// otherwise have been targeted) when the top-of-window views are not revealed. 225d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)class ResizeHandleWindowTargeter : public wm::WindowStateObserver, 235d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) public aura::WindowObserver, 245d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) public aura::WindowTargeter { 255d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) public: 265d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) ResizeHandleWindowTargeter(aura::Window* window, 275d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) ImmersiveFullscreenController* immersive); 285d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) virtual ~ResizeHandleWindowTargeter(); 295d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 305d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) private: 315d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // wm::WindowStateObserver: 32a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) virtual void OnPostWindowStateTypeChange( 33a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) wm::WindowState* window_state, 34a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) wm::WindowStateType old_type) OVERRIDE; 355d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // aura::WindowObserver: 365d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) virtual void OnWindowDestroying(aura::Window* window) OVERRIDE; 375d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 385d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // aura::WindowTargeter: 395d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) virtual ui::EventTarget* FindTargetForLocatedEvent( 405d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) ui::EventTarget* root, 415d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) ui::LocatedEvent* event) OVERRIDE; 425d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) virtual bool SubtreeShouldBeExploredForEvent( 435d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) ui::EventTarget* target, 445d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) const ui::LocatedEvent& event) OVERRIDE; 455d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 465d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // The targeter does not take ownership of |window_| or 475d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // |immersive_controller_|. 485d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) aura::Window* window_; 495d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) gfx::Insets frame_border_inset_; 505d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) ImmersiveFullscreenController* immersive_controller_; 515d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 525d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) DISALLOW_COPY_AND_ASSIGN(ResizeHandleWindowTargeter); 535d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)}; 545d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 555d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)} // namespace ash 565d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 575d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#endif // ASH_WM_RESIZE_HANDLE_WINDOW_TARGETER_H_ 58