screen_util.h revision 5d1f7b1de12d16ceb2c938c56701a3e8bfa558f7
1ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru// Copyright 2014 The Chromium Authors. All rights reserved. 2ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru// Use of this source code is governed by a BSD-style license that can be 3ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru// found in the LICENSE file. 485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho 5ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#ifndef ASH_SCREEN_UTIL_H_ 6ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#define ASH_SCREEN_UTIL_H_ 7ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 8ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "ash/ash_export.h" 9ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "base/basictypes.h" 10ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 11ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Querunamespace aura { 12ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruclass Window; 13ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru} 14ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 15ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Querunamespace gfx { 16ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruclass Display; 17ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruclass Rect; 18ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruclass Point; 19ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru} 20ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 21ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Querunamespace ash { 22ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 23ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruclass ASH_EXPORT ScreenUtil { 24ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru public: 25ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru // Finds the display that contains |point| in screeen coordinates. 26ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru // Returns invalid display if there is no display that can satisfy 27ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru // the condition. 28ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru static gfx::Display FindDisplayContainingPoint(const gfx::Point& point); 29ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 30ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru // Returns the bounds for maximized windows in parent coordinates. 31ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru // Maximized windows trigger auto-hiding the shelf. 32ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru static gfx::Rect GetMaximizedWindowBoundsInParent(aura::Window* window); 33ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 34ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru // Returns the display bounds in parent coordinates. 35ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru static gfx::Rect GetDisplayBoundsInParent(aura::Window* window); 36ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 37ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru // Returns the display's work area bounds in parent coordinates. 38ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru static gfx::Rect GetDisplayWorkAreaBoundsInParent(aura::Window* window); 39ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 40ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru // TODO(oshima): Move following two to wm/coordinate_conversion.h 41ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru // Converts |rect| from |window|'s coordinates to the virtual screen 42ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru // coordinates. 43ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru static gfx::Rect ConvertRectToScreen(aura::Window* window, 44ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru const gfx::Rect& rect); 45ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 46ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru // Converts |rect| from virtual screen coordinates to the |window|'s 47ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru // coordinates. 48ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru static gfx::Rect ConvertRectFromScreen(aura::Window* window, 49ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru const gfx::Rect& rect); 50ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 51ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru // Returns a gfx::Display object for secondary display. Returns 52ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru // invalid display if there is no secondary display connected. 53ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru static const gfx::Display& GetSecondaryDisplay(); 54ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 55ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru // Returns a gfx::Display object for the specified id. Returns 56ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru // invalid display if no such display is connected. 57ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru static const gfx::Display& GetDisplayForId(int64 display_id); 58ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 59ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruprivate: 60ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru ScreenUtil() {} 61ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru ~ScreenUtil() {} 62ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 63ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru DISALLOW_COPY_AND_ASSIGN(ScreenUtil); 64ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru}; 65ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 66ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru} // namespace ash 67ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 68ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#endif // ASH_SCREEN_UTIL_H_ 69ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru