Chromium Code Reviews| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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()) / |
| 63 first.size().height(); | 63 first.size().height(); |
| 64 gfx::SizeF size(first.size()); | 64 gfx::SizeF size(first.size()); |
| 65 size.Scale(scale, scale); | 65 size.Scale(scale, scale); |
| 66 return gfx::Rect(gfx::ToCeiledSize(size)); | 66 return gfx::Rect(gfx::ToCeiledSize(size)); |
| 67 } else { | 67 } else { |
| 68 if (window->GetRootWindow()->bounds().IsEmpty()) { | |
| 69 // TODO(sad): This only happens when running with mustash, since the | |
| 70 // root-window here refers to the shelf Widget, which has not been | |
| 71 // sized/positioned yet. Use the bounds of the display in this case. | |
|
msw
2016/02/09 18:31:26
Could this always use the display bounds? When are
sadrul
2016/02/10 08:04:41
Looks like it could always use the display bounds
| |
| 72 gfx::Display display = | |
|
sky
2016/02/09 20:44:08
We shouldn't be calling this code right? I think i
sadrul
2016/02/10 08:04:41
Added a NOTIMPLEMENTED() here. We do still need th
| |
| 73 gfx::Screen::GetScreen()->GetDisplayNearestWindow(window); | |
| 74 return gfx::Rect(display.size()); | |
| 75 } | |
| 68 return window->GetRootWindow()->bounds(); | 76 return window->GetRootWindow()->bounds(); |
| 69 } | 77 } |
| 70 } | 78 } |
| 71 | 79 |
| 72 // static | 80 // static |
| 73 gfx::Rect ScreenUtil::ConvertRectToScreen(aura::Window* window, | 81 gfx::Rect ScreenUtil::ConvertRectToScreen(aura::Window* window, |
| 74 const gfx::Rect& rect) { | 82 const gfx::Rect& rect) { |
| 75 gfx::Point point = rect.origin(); | 83 gfx::Point point = rect.origin(); |
| 76 aura::client::GetScreenPositionClient(window->GetRootWindow())-> | 84 aura::client::GetScreenPositionClient(window->GetRootWindow())-> |
| 77 ConvertPointToScreen(window, &point); | 85 ConvertPointToScreen(window, &point); |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 91 const gfx::Display& ScreenUtil::GetSecondaryDisplay() { | 99 const gfx::Display& ScreenUtil::GetSecondaryDisplay() { |
| 92 DisplayManager* display_manager = GetDisplayManager(); | 100 DisplayManager* display_manager = GetDisplayManager(); |
| 93 CHECK_LE(2U, display_manager->GetNumDisplays()); | 101 CHECK_LE(2U, display_manager->GetNumDisplays()); |
| 94 return display_manager->GetDisplayAt(0).id() == | 102 return display_manager->GetDisplayAt(0).id() == |
| 95 gfx::Screen::GetScreen()->GetPrimaryDisplay().id() | 103 gfx::Screen::GetScreen()->GetPrimaryDisplay().id() |
| 96 ? display_manager->GetDisplayAt(1) | 104 ? display_manager->GetDisplayAt(1) |
| 97 : display_manager->GetDisplayAt(0); | 105 : display_manager->GetDisplayAt(0); |
| 98 } | 106 } |
| 99 | 107 |
| 100 } // namespace ash | 108 } // namespace ash |
| OLD | NEW |