| 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 display::Display display = | 74 display::Display display = |
| 75 display::Screen::GetScreen()->GetDisplayNearestWindow(window); | 75 display::Screen::GetScreen()->GetDisplayNearestWindow(window); |
| 76 return display.bounds(); | 76 return display.bounds(); |
| 77 } | 77 } |
| 78 | 78 |
| 79 return window->GetRootWindow()->bounds(); | 79 return window->GetRootWindow()->bounds(); |
| 80 } | 80 } |
| 81 | 81 |
| 82 // static | 82 // static |
| 83 gfx::Rect ScreenUtil::ConvertRectToScreen(aura::Window* window, | 83 gfx::Rect ScreenUtil::ConvertRectToScreen(aura::Window* window, |
| 84 const gfx::Rect& rect) { | 84 const gfx::Rect& rect) { |
| 85 gfx::Point point = rect.origin(); | 85 gfx::Point point = rect.origin(); |
| 86 aura::client::GetScreenPositionClient(window->GetRootWindow())-> | 86 aura::client::GetScreenPositionClient(window->GetRootWindow()) |
| 87 ConvertPointToScreen(window, &point); | 87 ->ConvertPointToScreen(window, &point); |
| 88 return gfx::Rect(point, rect.size()); | 88 return gfx::Rect(point, rect.size()); |
| 89 } | 89 } |
| 90 | 90 |
| 91 // static | 91 // static |
| 92 gfx::Rect ScreenUtil::ConvertRectFromScreen(aura::Window* window, | 92 gfx::Rect ScreenUtil::ConvertRectFromScreen(aura::Window* window, |
| 93 const gfx::Rect& rect) { | 93 const gfx::Rect& rect) { |
| 94 gfx::Point point = rect.origin(); | 94 gfx::Point point = rect.origin(); |
| 95 aura::client::GetScreenPositionClient(window->GetRootWindow())-> | 95 aura::client::GetScreenPositionClient(window->GetRootWindow()) |
| 96 ConvertPointFromScreen(window, &point); | 96 ->ConvertPointFromScreen(window, &point); |
| 97 return gfx::Rect(point, rect.size()); | 97 return gfx::Rect(point, rect.size()); |
| 98 } | 98 } |
| 99 | 99 |
| 100 // static | 100 // static |
| 101 const display::Display& ScreenUtil::GetSecondaryDisplay() { | 101 const display::Display& ScreenUtil::GetSecondaryDisplay() { |
| 102 DisplayManager* display_manager = GetDisplayManager(); | 102 DisplayManager* display_manager = GetDisplayManager(); |
| 103 CHECK_LE(2U, display_manager->GetNumDisplays()); | 103 CHECK_LE(2U, display_manager->GetNumDisplays()); |
| 104 return display_manager->GetDisplayAt(0).id() == | 104 return display_manager->GetDisplayAt(0).id() == |
| 105 display::Screen::GetScreen()->GetPrimaryDisplay().id() | 105 display::Screen::GetScreen()->GetPrimaryDisplay().id() |
| 106 ? display_manager->GetDisplayAt(1) | 106 ? display_manager->GetDisplayAt(1) |
| 107 : display_manager->GetDisplayAt(0); | 107 : display_manager->GetDisplayAt(0); |
| 108 } | 108 } |
| 109 | 109 |
| 110 } // namespace ash | 110 } // namespace ash |
| OLD | NEW |