| OLD | NEW |
| (Empty) |
| 1 // Copyright 2016 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 #include "ash/common/wm/wm_screen_util.h" | |
| 6 | |
| 7 #include "ash/common/wm_shell.h" | |
| 8 #include "ash/common/wm_window.h" | |
| 9 #include "ash/root_window_controller.h" | |
| 10 #include "ui/display/display.h" | |
| 11 #include "ui/display/screen.h" | |
| 12 #include "ui/gfx/geometry/size_conversions.h" | |
| 13 | |
| 14 namespace ash { | |
| 15 namespace wm { | |
| 16 | |
| 17 gfx::Rect GetDisplayWorkAreaBoundsInParent(WmWindow* window) { | |
| 18 display::Display display = window->GetDisplayNearestWindow(); | |
| 19 return window->GetParent()->ConvertRectFromScreen(display.work_area()); | |
| 20 } | |
| 21 | |
| 22 gfx::Rect GetDisplayBoundsInParent(WmWindow* window) { | |
| 23 display::Display display = window->GetDisplayNearestWindow(); | |
| 24 return window->GetParent()->ConvertRectFromScreen(display.bounds()); | |
| 25 } | |
| 26 | |
| 27 gfx::Rect GetMaximizedWindowBoundsInParent(WmWindow* window) { | |
| 28 if (window->GetRootWindowController()->HasShelf()) | |
| 29 return GetDisplayWorkAreaBoundsInParent(window); | |
| 30 | |
| 31 return GetDisplayBoundsInParent(window); | |
| 32 } | |
| 33 | |
| 34 gfx::Rect GetDisplayBoundsWithShelf(WmWindow* window) { | |
| 35 if (WmShell::Get()->IsInUnifiedMode()) { | |
| 36 // In unified desktop mode, there is only one shelf in the first display. | |
| 37 gfx::SizeF size(WmShell::Get()->GetFirstDisplay().size()); | |
| 38 float scale = window->GetRootWindow()->GetBounds().height() / size.height(); | |
| 39 size.Scale(scale, scale); | |
| 40 return gfx::Rect(gfx::ToCeiledSize(size)); | |
| 41 } | |
| 42 | |
| 43 return window->GetRootWindow()->GetBounds(); | |
| 44 } | |
| 45 | |
| 46 } // namespace wm | |
| 47 } // namespace ash | |
| OLD | NEW |