OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/desktop_background/desktop_background_controller.h" | 5 #include "ash/desktop_background/desktop_background_controller.h" |
6 | 6 |
7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
8 #include "ash/desktop_background/desktop_background_controller_observer.h" | 8 #include "ash/desktop_background/desktop_background_controller_observer.h" |
9 #include "ash/desktop_background/desktop_background_view.h" | 9 #include "ash/desktop_background/desktop_background_view.h" |
10 #include "ash/desktop_background/desktop_background_widget_controller.h" | 10 #include "ash/desktop_background/desktop_background_widget_controller.h" |
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 int DesktopBackgroundController::GetBackgroundContainerId(bool locked) { | 431 int DesktopBackgroundController::GetBackgroundContainerId(bool locked) { |
432 return locked ? internal::kShellWindowId_LockScreenBackgroundContainer : | 432 return locked ? internal::kShellWindowId_LockScreenBackgroundContainer : |
433 internal::kShellWindowId_DesktopBackgroundContainer; | 433 internal::kShellWindowId_DesktopBackgroundContainer; |
434 } | 434 } |
435 | 435 |
436 void DesktopBackgroundController::UpdateWallpaper() { | 436 void DesktopBackgroundController::UpdateWallpaper() { |
437 current_wallpaper_.reset(NULL); | 437 current_wallpaper_.reset(NULL); |
438 current_default_wallpaper_path_ = base::FilePath(); | 438 current_default_wallpaper_path_ = base::FilePath(); |
439 current_default_wallpaper_resource_id_ = -1; | 439 current_default_wallpaper_resource_id_ = -1; |
440 ash::Shell::GetInstance()->user_wallpaper_delegate()-> | 440 ash::Shell::GetInstance()->user_wallpaper_delegate()-> |
441 UpdateWallpaper(); | 441 UpdateWallpaper(true /* clear cache */); |
442 } | 442 } |
443 | 443 |
444 // static | 444 // static |
445 gfx::Size DesktopBackgroundController::GetMaxDisplaySizeInNative() { | 445 gfx::Size DesktopBackgroundController::GetMaxDisplaySizeInNative() { |
446 int width = 0; | 446 int width = 0; |
447 int height = 0; | 447 int height = 0; |
448 std::vector<gfx::Display> displays = Shell::GetScreen()->GetAllDisplays(); | 448 std::vector<gfx::Display> displays = Shell::GetScreen()->GetAllDisplays(); |
449 internal::DisplayManager* display_manager = | 449 internal::DisplayManager* display_manager = |
450 Shell::GetInstance()->display_manager(); | 450 Shell::GetInstance()->display_manager(); |
451 | 451 |
452 for (std::vector<gfx::Display>::iterator iter = displays.begin(); | 452 for (std::vector<gfx::Display>::iterator iter = displays.begin(); |
453 iter != displays.end(); ++iter) { | 453 iter != displays.end(); ++iter) { |
454 // Don't use size_in_pixel because we want to use the native pixel size. | 454 // Don't use size_in_pixel because we want to use the native pixel size. |
455 gfx::Size size_in_pixel = | 455 gfx::Size size_in_pixel = |
456 display_manager->GetDisplayInfo(iter->id()).bounds_in_native().size(); | 456 display_manager->GetDisplayInfo(iter->id()).bounds_in_native().size(); |
457 if (iter->rotation() == gfx::Display::ROTATE_90 || | 457 if (iter->rotation() == gfx::Display::ROTATE_90 || |
458 iter->rotation() == gfx::Display::ROTATE_270) { | 458 iter->rotation() == gfx::Display::ROTATE_270) { |
459 size_in_pixel = gfx::Size(size_in_pixel.height(), size_in_pixel.width()); | 459 size_in_pixel = gfx::Size(size_in_pixel.height(), size_in_pixel.width()); |
460 } | 460 } |
461 width = std::max(size_in_pixel.width(), width); | 461 width = std::max(size_in_pixel.width(), width); |
462 height = std::max(size_in_pixel.height(), height); | 462 height = std::max(size_in_pixel.height(), height); |
463 } | 463 } |
464 return gfx::Size(width, height); | 464 return gfx::Size(width, height); |
465 } | 465 } |
466 | 466 |
467 } // namespace ash | 467 } // namespace ash |
OLD | NEW |