| 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/common/shelf/shelf_widget.h" | 7 #include "ash/aura/wm_shelf_aura.h" |
| 8 #include "ash/display/display_manager.h" | 8 #include "ash/display/display_manager.h" |
| 9 #include "ash/root_window_controller.h" | 9 #include "ash/root_window_controller.h" |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.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/screen.h" | 15 #include "ui/display/screen.h" |
| 16 #include "ui/gfx/geometry/size_conversions.h" | 16 #include "ui/gfx/geometry/size_conversions.h" |
| 17 | 17 |
| 18 namespace ash { | 18 namespace ash { |
| 19 | 19 |
| 20 namespace { | 20 namespace { |
| 21 DisplayManager* GetDisplayManager() { | 21 DisplayManager* GetDisplayManager() { |
| 22 return Shell::GetInstance()->display_manager(); | 22 return Shell::GetInstance()->display_manager(); |
| 23 } | 23 } |
| 24 } | 24 } |
| 25 | 25 |
| 26 // static | 26 // static |
| 27 display::Display ScreenUtil::FindDisplayContainingPoint( | 27 display::Display ScreenUtil::FindDisplayContainingPoint( |
| 28 const gfx::Point& point) { | 28 const gfx::Point& point) { |
| 29 return GetDisplayManager()->FindDisplayContainingPoint(point); | 29 return GetDisplayManager()->FindDisplayContainingPoint(point); |
| 30 } | 30 } |
| 31 | 31 |
| 32 // static | 32 // static |
| 33 gfx::Rect ScreenUtil::GetMaximizedWindowBoundsInParent(aura::Window* window) { | 33 gfx::Rect ScreenUtil::GetMaximizedWindowBoundsInParent(aura::Window* window) { |
| 34 if (GetRootWindowController(window->GetRootWindow())->shelf_widget()) | 34 aura::Window* root_window = window->GetRootWindow(); |
| 35 if (GetRootWindowController(root_window)->wm_shelf_aura()->shelf_widget()) |
| 35 return GetDisplayWorkAreaBoundsInParent(window); | 36 return GetDisplayWorkAreaBoundsInParent(window); |
| 36 else | 37 else |
| 37 return GetDisplayBoundsInParent(window); | 38 return GetDisplayBoundsInParent(window); |
| 38 } | 39 } |
| 39 | 40 |
| 40 // static | 41 // static |
| 41 gfx::Rect ScreenUtil::GetDisplayBoundsInParent(aura::Window* window) { | 42 gfx::Rect ScreenUtil::GetDisplayBoundsInParent(aura::Window* window) { |
| 42 return ConvertRectFromScreen( | 43 return ConvertRectFromScreen( |
| 43 window->parent(), | 44 window->parent(), |
| 44 display::Screen::GetScreen()->GetDisplayNearestWindow(window).bounds()); | 45 display::Screen::GetScreen()->GetDisplayNearestWindow(window).bounds()); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 74 const display::Display& ScreenUtil::GetSecondaryDisplay() { | 75 const display::Display& ScreenUtil::GetSecondaryDisplay() { |
| 75 DisplayManager* display_manager = GetDisplayManager(); | 76 DisplayManager* display_manager = GetDisplayManager(); |
| 76 CHECK_LE(2U, display_manager->GetNumDisplays()); | 77 CHECK_LE(2U, display_manager->GetNumDisplays()); |
| 77 return display_manager->GetDisplayAt(0).id() == | 78 return display_manager->GetDisplayAt(0).id() == |
| 78 display::Screen::GetScreen()->GetPrimaryDisplay().id() | 79 display::Screen::GetScreen()->GetPrimaryDisplay().id() |
| 79 ? display_manager->GetDisplayAt(1) | 80 ? display_manager->GetDisplayAt(1) |
| 80 : display_manager->GetDisplayAt(0); | 81 : display_manager->GetDisplayAt(0); |
| 81 } | 82 } |
| 82 | 83 |
| 83 } // namespace ash | 84 } // namespace ash |
| OLD | NEW |