| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/screen_util.h" | 5 #include "ash/screen_util.h" |
| 6 | 6 |
| 7 #include "ash/root_window_controller.h" | 7 #include "ash/root_window_controller.h" |
| 8 #include "ash/shelf/wm_shelf.h" | 8 #include "ash/shelf/shelf.h" |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "ash/shell_port.h" | 10 #include "ash/shell_port.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "ui/aura/client/screen_position_client.h" | 12 #include "ui/aura/client/screen_position_client.h" |
| 13 #include "ui/aura/window_event_dispatcher.h" | 13 #include "ui/aura/window_event_dispatcher.h" |
| 14 #include "ui/display/display.h" | 14 #include "ui/display/display.h" |
| 15 #include "ui/display/manager/display_manager.h" | 15 #include "ui/display/manager/display_manager.h" |
| 16 #include "ui/display/screen.h" | 16 #include "ui/display/screen.h" |
| 17 #include "ui/gfx/geometry/size_conversions.h" | 17 #include "ui/gfx/geometry/size_conversions.h" |
| 18 #include "ui/wm/core/coordinate_conversion.h" | 18 #include "ui/wm/core/coordinate_conversion.h" |
| 19 | 19 |
| 20 namespace ash { | 20 namespace ash { |
| 21 | 21 |
| 22 // static | 22 // static |
| 23 gfx::Rect ScreenUtil::GetMaximizedWindowBoundsInParent(aura::Window* window) { | 23 gfx::Rect ScreenUtil::GetMaximizedWindowBoundsInParent(aura::Window* window) { |
| 24 aura::Window* root_window = window->GetRootWindow(); | 24 aura::Window* root_window = window->GetRootWindow(); |
| 25 if (GetRootWindowController(root_window)->wm_shelf()->shelf_widget()) | 25 if (GetRootWindowController(root_window)->shelf()->shelf_widget()) |
| 26 return GetDisplayWorkAreaBoundsInParent(window); | 26 return GetDisplayWorkAreaBoundsInParent(window); |
| 27 return GetDisplayBoundsInParent(window); | 27 return GetDisplayBoundsInParent(window); |
| 28 } | 28 } |
| 29 | 29 |
| 30 // static | 30 // static |
| 31 gfx::Rect ScreenUtil::GetDisplayBoundsInParent(aura::Window* window) { | 31 gfx::Rect ScreenUtil::GetDisplayBoundsInParent(aura::Window* window) { |
| 32 gfx::Rect result = | 32 gfx::Rect result = |
| 33 display::Screen::GetScreen()->GetDisplayNearestWindow(window).bounds(); | 33 display::Screen::GetScreen()->GetDisplayNearestWindow(window).bounds(); |
| 34 ::wm::ConvertRectFromScreen(window->parent(), &result); | 34 ::wm::ConvertRectFromScreen(window->parent(), &result); |
| 35 return result; | 35 return result; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 50 gfx::SizeF size(ShellPort::Get()->GetFirstDisplay().size()); | 50 gfx::SizeF size(ShellPort::Get()->GetFirstDisplay().size()); |
| 51 float scale = window->GetRootWindow()->bounds().height() / size.height(); | 51 float scale = window->GetRootWindow()->bounds().height() / size.height(); |
| 52 size.Scale(scale, scale); | 52 size.Scale(scale, scale); |
| 53 return gfx::Rect(gfx::ToCeiledSize(size)); | 53 return gfx::Rect(gfx::ToCeiledSize(size)); |
| 54 } | 54 } |
| 55 | 55 |
| 56 return window->GetRootWindow()->bounds(); | 56 return window->GetRootWindow()->bounds(); |
| 57 } | 57 } |
| 58 | 58 |
| 59 } // namespace ash | 59 } // namespace ash |
| OLD | NEW |