| 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" | |
| 8 #include "ash/shelf/shelf.h" | 7 #include "ash/shelf/shelf.h" |
| 9 #include "ash/shell.h" | 8 #include "ash/shell.h" |
| 10 #include "ash/shell_port.h" | 9 #include "ash/shell_port.h" |
| 11 #include "base/logging.h" | 10 #include "base/logging.h" |
| 12 #include "ui/aura/client/screen_position_client.h" | 11 #include "ui/aura/client/screen_position_client.h" |
| 13 #include "ui/aura/window_event_dispatcher.h" | 12 #include "ui/aura/window_event_dispatcher.h" |
| 14 #include "ui/display/display.h" | 13 #include "ui/display/display.h" |
| 15 #include "ui/display/manager/display_manager.h" | 14 #include "ui/display/manager/display_manager.h" |
| 16 #include "ui/display/screen.h" | 15 #include "ui/display/screen.h" |
| 17 #include "ui/gfx/geometry/size_conversions.h" | 16 #include "ui/gfx/geometry/size_conversions.h" |
| 18 #include "ui/wm/core/coordinate_conversion.h" | 17 #include "ui/wm/core/coordinate_conversion.h" |
| 19 | 18 |
| 20 namespace ash { | 19 namespace ash { |
| 21 | 20 |
| 22 // static | 21 // static |
| 23 gfx::Rect ScreenUtil::GetMaximizedWindowBoundsInParent(aura::Window* window) { | 22 gfx::Rect ScreenUtil::GetMaximizedWindowBoundsInParent(aura::Window* window) { |
| 24 aura::Window* root_window = window->GetRootWindow(); | 23 if (Shelf::ForWindow(window)->shelf_widget()) |
| 25 if (GetRootWindowController(root_window)->shelf()->shelf_widget()) | |
| 26 return GetDisplayWorkAreaBoundsInParent(window); | 24 return GetDisplayWorkAreaBoundsInParent(window); |
| 27 return GetDisplayBoundsInParent(window); | 25 return GetDisplayBoundsInParent(window); |
| 28 } | 26 } |
| 29 | 27 |
| 30 // static | 28 // static |
| 31 gfx::Rect ScreenUtil::GetDisplayBoundsInParent(aura::Window* window) { | 29 gfx::Rect ScreenUtil::GetDisplayBoundsInParent(aura::Window* window) { |
| 32 gfx::Rect result = | 30 gfx::Rect result = |
| 33 display::Screen::GetScreen()->GetDisplayNearestWindow(window).bounds(); | 31 display::Screen::GetScreen()->GetDisplayNearestWindow(window).bounds(); |
| 34 ::wm::ConvertRectFromScreen(window->parent(), &result); | 32 ::wm::ConvertRectFromScreen(window->parent(), &result); |
| 35 return result; | 33 return result; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 58 gfx::SizeF size(ShellPort::Get()->GetFirstDisplay().size()); | 56 gfx::SizeF size(ShellPort::Get()->GetFirstDisplay().size()); |
| 59 float scale = window->GetRootWindow()->bounds().height() / size.height(); | 57 float scale = window->GetRootWindow()->bounds().height() / size.height(); |
| 60 size.Scale(scale, scale); | 58 size.Scale(scale, scale); |
| 61 return gfx::Rect(gfx::ToCeiledSize(size)); | 59 return gfx::Rect(gfx::ToCeiledSize(size)); |
| 62 } | 60 } |
| 63 | 61 |
| 64 return window->GetRootWindow()->bounds(); | 62 return window->GetRootWindow()->bounds(); |
| 65 } | 63 } |
| 66 | 64 |
| 67 } // namespace ash | 65 } // namespace ash |
| OLD | NEW |