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_SCREEN_UTIL_H_
65d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#define ASH_SCREEN_UTIL_H_
75d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
85d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "ash/ash_export.h"
95d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "base/basictypes.h"
105d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
115d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)namespace aura {
125d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)class Window;
135d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)}
145d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
155d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)namespace gfx {
165d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)class Display;
175d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)class Rect;
185d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)class Point;
195d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)}
205d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
215d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)namespace ash {
225d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
235d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)class ASH_EXPORT ScreenUtil {
245d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) public:
255d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // Finds the display that contains |point| in screeen coordinates.
265d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // Returns invalid display if there is no display that can satisfy
275d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // the condition.
285d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  static gfx::Display FindDisplayContainingPoint(const gfx::Point& point);
295d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
305d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // Returns the bounds for maximized windows in parent coordinates.
315d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // Maximized windows trigger auto-hiding the shelf.
325d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  static gfx::Rect GetMaximizedWindowBoundsInParent(aura::Window* window);
335d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
345d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // Returns the display bounds in parent coordinates.
355d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  static gfx::Rect GetDisplayBoundsInParent(aura::Window* window);
365d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
375d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // Returns the display's work area bounds in parent coordinates.
385d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  static gfx::Rect GetDisplayWorkAreaBoundsInParent(aura::Window* window);
395d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
405d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // TODO(oshima): Move following two to wm/coordinate_conversion.h
415d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // Converts |rect| from |window|'s coordinates to the virtual screen
425d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // coordinates.
435d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  static gfx::Rect ConvertRectToScreen(aura::Window* window,
445d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)                                       const gfx::Rect& rect);
455d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
465d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // Converts |rect| from virtual screen coordinates to the |window|'s
475d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // coordinates.
485d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  static gfx::Rect ConvertRectFromScreen(aura::Window* window,
495d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)                                         const gfx::Rect& rect);
505d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
515d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // Returns a gfx::Display object for secondary display. Returns
525d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // invalid display if there is no secondary display connected.
535d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  static const gfx::Display& GetSecondaryDisplay();
545d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
555d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // Returns a gfx::Display object for the specified id.  Returns
565d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // invalid display if no such display is connected.
575d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  static const gfx::Display& GetDisplayForId(int64 display_id);
585d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
595f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) private:
605d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  ScreenUtil() {}
615d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  ~ScreenUtil() {}
625d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
635d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  DISALLOW_COPY_AND_ASSIGN(ScreenUtil);
645d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)};
655d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
665d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)}  // namespace ash
675d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
685d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#endif  // ASH_SCREEN_UTIL_H_
69