| Index: ash/desktop_background/desktop_background_controller.cc
|
| diff --git a/ash/desktop_background/desktop_background_controller.cc b/ash/desktop_background/desktop_background_controller.cc
|
| index a40974dcaf8174b084f175d032da0f561aa01099..15d18374548684a03ec22325f11dfcee20f926ed 100644
|
| --- a/ash/desktop_background/desktop_background_controller.cc
|
| +++ b/ash/desktop_background/desktop_background_controller.cc
|
| @@ -161,19 +161,25 @@ void DesktopBackgroundController::OnRootWindowAdded(aura::Window* root_window) {
|
|
|
| // static
|
| gfx::Size DesktopBackgroundController::GetMaxDisplaySizeInNative() {
|
| + // Return an empty size for test environments where the screen is null.
|
| + if (!display::Screen::GetScreen())
|
| + return gfx::Size();
|
| +
|
| int width = 0;
|
| int height = 0;
|
| - std::vector<display::Display> displays =
|
| - display::Screen::GetScreen()->GetAllDisplays();
|
| - DisplayManager* display_manager = Shell::GetInstance()->display_manager();
|
| -
|
| - for (std::vector<display::Display>::iterator iter = displays.begin();
|
| - iter != displays.end(); ++iter) {
|
| + DisplayManager* display_manager =
|
| + Shell::HasInstance() ? Shell::GetInstance()->display_manager() : nullptr;
|
| + for (auto& display : display::Screen::GetScreen()->GetAllDisplays()) {
|
| // Don't use size_in_pixel because we want to use the native pixel size.
|
| + // TODO(msw): Fix this for Mash/Mus; see http://crbug.com/613657.
|
| gfx::Size size_in_pixel =
|
| - display_manager->GetDisplayInfo(iter->id()).bounds_in_native().size();
|
| - if (iter->rotation() == display::Display::ROTATE_90 ||
|
| - iter->rotation() == display::Display::ROTATE_270) {
|
| + display_manager
|
| + ? display_manager->GetDisplayInfo(display.id())
|
| + .bounds_in_native()
|
| + .size()
|
| + : display.size();
|
| + if (display.rotation() == display::Display::ROTATE_90 ||
|
| + display.rotation() == display::Display::ROTATE_270) {
|
| size_in_pixel = gfx::Size(size_in_pixel.height(), size_in_pixel.width());
|
| }
|
| width = std::max(size_in_pixel.width(), width);
|
|
|