| 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/display/display_manager.h" | 7 #include "ash/display/display_manager.h" |
| 8 #include "ash/root_window_controller.h" | 8 #include "ash/root_window_controller.h" |
| 9 #include "ash/shelf/shelf_layout_manager.h" | 9 #include "ash/shelf/shelf_layout_manager.h" |
| 10 #include "ash/shelf/shelf_widget.h" | 10 #include "ash/shelf/shelf_widget.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 if (GetRootWindowController(window->GetRootWindow())->shelf()) | 35 if (GetRootWindowController(window->GetRootWindow())->shelf()) |
| 36 return GetDisplayWorkAreaBoundsInParent(window); | 36 return GetDisplayWorkAreaBoundsInParent(window); |
| 37 else | 37 else |
| 38 return GetDisplayBoundsInParent(window); | 38 return GetDisplayBoundsInParent(window); |
| 39 } | 39 } |
| 40 | 40 |
| 41 // static | 41 // static |
| 42 gfx::Rect ScreenUtil::GetDisplayBoundsInParent(aura::Window* window) { | 42 gfx::Rect ScreenUtil::GetDisplayBoundsInParent(aura::Window* window) { |
| 43 return ConvertRectFromScreen( | 43 return ConvertRectFromScreen( |
| 44 window->parent(), | 44 window->parent(), |
| 45 Shell::GetScreen()->GetDisplayNearestWindow(window).bounds()); | 45 gfx::Screen::GetScreen()->GetDisplayNearestWindow(window).bounds()); |
| 46 } | 46 } |
| 47 | 47 |
| 48 // static | 48 // static |
| 49 gfx::Rect ScreenUtil::GetDisplayWorkAreaBoundsInParent(aura::Window* window) { | 49 gfx::Rect ScreenUtil::GetDisplayWorkAreaBoundsInParent(aura::Window* window) { |
| 50 return ConvertRectFromScreen( | 50 return ConvertRectFromScreen( |
| 51 window->parent(), | 51 window->parent(), |
| 52 Shell::GetScreen()->GetDisplayNearestWindow(window).work_area()); | 52 gfx::Screen::GetScreen()->GetDisplayNearestWindow(window).work_area()); |
| 53 } | 53 } |
| 54 | 54 |
| 55 gfx::Rect ScreenUtil::GetShelfDisplayBoundsInRoot(aura::Window* window) { | 55 gfx::Rect ScreenUtil::GetShelfDisplayBoundsInRoot(aura::Window* window) { |
| 56 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); | 56 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
| 57 if (display_manager->IsInUnifiedMode()) { | 57 if (display_manager->IsInUnifiedMode()) { |
| 58 // In unified desktop mode, there is only one shelf in the 1st display. | 58 // In unified desktop mode, there is only one shelf in the 1st display. |
| 59 const gfx::Display& first = | 59 const gfx::Display& first = |
| 60 display_manager->software_mirroring_display_list()[0]; | 60 display_manager->software_mirroring_display_list()[0]; |
| 61 float scale = | 61 float scale = |
| 62 static_cast<float>(window->GetRootWindow()->bounds().height()) / | 62 static_cast<float>(window->GetRootWindow()->bounds().height()) / |
| (...skipping 22 matching lines...) Expand all Loading... |
| 85 aura::client::GetScreenPositionClient(window->GetRootWindow())-> | 85 aura::client::GetScreenPositionClient(window->GetRootWindow())-> |
| 86 ConvertPointFromScreen(window, &point); | 86 ConvertPointFromScreen(window, &point); |
| 87 return gfx::Rect(point, rect.size()); | 87 return gfx::Rect(point, rect.size()); |
| 88 } | 88 } |
| 89 | 89 |
| 90 // static | 90 // static |
| 91 const gfx::Display& ScreenUtil::GetSecondaryDisplay() { | 91 const gfx::Display& ScreenUtil::GetSecondaryDisplay() { |
| 92 DisplayManager* display_manager = GetDisplayManager(); | 92 DisplayManager* display_manager = GetDisplayManager(); |
| 93 CHECK_LE(2U, display_manager->GetNumDisplays()); | 93 CHECK_LE(2U, display_manager->GetNumDisplays()); |
| 94 return display_manager->GetDisplayAt(0).id() == | 94 return display_manager->GetDisplayAt(0).id() == |
| 95 Shell::GetScreen()->GetPrimaryDisplay().id() ? | 95 gfx::Screen::GetScreen()->GetPrimaryDisplay().id() |
| 96 display_manager->GetDisplayAt(1) : display_manager->GetDisplayAt(0); | 96 ? display_manager->GetDisplayAt(1) |
| 97 : display_manager->GetDisplayAt(0); |
| 97 } | 98 } |
| 98 | 99 |
| 99 } // namespace ash | 100 } // namespace ash |
| OLD | NEW |