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