| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ash/common/wm/wm_screen_util.h" | 5 #include "ash/common/wm/wm_screen_util.h" |
| 6 | 6 |
| 7 #include "ash/common/wm_root_window_controller.h" | 7 #include "ash/common/wm_root_window_controller.h" |
| 8 #include "ash/common/wm_shell.h" |
| 8 #include "ash/common/wm_window.h" | 9 #include "ash/common/wm_window.h" |
| 9 #include "ui/display/display.h" | 10 #include "ui/display/display.h" |
| 11 #include "ui/display/screen.h" |
| 12 #include "ui/gfx/geometry/size_conversions.h" |
| 10 | 13 |
| 11 namespace ash { | 14 namespace ash { |
| 12 namespace wm { | 15 namespace wm { |
| 13 | 16 |
| 14 gfx::Rect GetDisplayWorkAreaBoundsInParent(WmWindow* window) { | 17 gfx::Rect GetDisplayWorkAreaBoundsInParent(WmWindow* window) { |
| 15 return GetDisplayWorkAreaBounds(window->GetParent()); | 18 return GetDisplayWorkAreaBounds(window->GetParent()); |
| 16 } | 19 } |
| 17 | 20 |
| 18 gfx::Rect GetDisplayWorkAreaBounds(WmWindow* window) { | 21 gfx::Rect GetDisplayWorkAreaBounds(WmWindow* window) { |
| 19 display::Display display = window->GetDisplayNearestWindow(); | 22 display::Display display = window->GetDisplayNearestWindow(); |
| 20 return window->GetParent()->ConvertRectFromScreen(display.work_area()); | 23 return window->GetParent()->ConvertRectFromScreen(display.work_area()); |
| 21 } | 24 } |
| 22 | 25 |
| 23 gfx::Rect GetDisplayBoundsInParent(WmWindow* window) { | 26 gfx::Rect GetDisplayBoundsInParent(WmWindow* window) { |
| 24 display::Display display = window->GetDisplayNearestWindow(); | 27 display::Display display = window->GetDisplayNearestWindow(); |
| 25 return window->GetParent()->ConvertRectFromScreen(display.bounds()); | 28 return window->GetParent()->ConvertRectFromScreen(display.bounds()); |
| 26 } | 29 } |
| 27 | 30 |
| 28 gfx::Rect GetMaximizedWindowBoundsInParent(WmWindow* window) { | 31 gfx::Rect GetMaximizedWindowBoundsInParent(WmWindow* window) { |
| 29 if (window->GetRootWindowController()->HasShelf()) | 32 if (window->GetRootWindowController()->HasShelf()) |
| 30 return GetDisplayWorkAreaBoundsInParent(window); | 33 return GetDisplayWorkAreaBoundsInParent(window); |
| 31 | 34 |
| 32 return GetDisplayBoundsInParent(window); | 35 return GetDisplayBoundsInParent(window); |
| 33 } | 36 } |
| 34 | 37 |
| 38 gfx::Rect GetDisplayBoundsWithShelf(WmWindow* window) { |
| 39 if (WmShell::Get()->IsInUnifiedMode()) { |
| 40 // In unified desktop mode, there is only one shelf in the first display. |
| 41 gfx::SizeF size(WmShell::Get()->GetFirstDisplay().size()); |
| 42 float scale = window->GetRootWindow()->GetBounds().height() / size.height(); |
| 43 size.Scale(scale, scale); |
| 44 return gfx::Rect(gfx::ToCeiledSize(size)); |
| 45 } |
| 46 |
| 47 return window->GetRootWindow()->GetBounds(); |
| 48 } |
| 49 |
| 35 } // namespace wm | 50 } // namespace wm |
| 36 } // namespace ash | 51 } // namespace ash |
| OLD | NEW |