| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "chrome/browser/chromeos/login/wallpaper_manager.h" | 5 #include "chrome/browser/chromeos/login/wallpaper_manager.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 WallpaperInfo info = { | 483 WallpaperInfo info = { |
| 484 file, | 484 file, |
| 485 layout, | 485 layout, |
| 486 User::CUSTOMIZED, | 486 User::CUSTOMIZED, |
| 487 base::Time::Now().LocalMidnight() | 487 base::Time::Now().LocalMidnight() |
| 488 }; | 488 }; |
| 489 SetUserWallpaperInfo(username, info, is_persistent); | 489 SetUserWallpaperInfo(username, info, is_persistent); |
| 490 } | 490 } |
| 491 | 491 |
| 492 void WallpaperManager::SetDefaultWallpaper() { | 492 void WallpaperManager::SetDefaultWallpaper() { |
| 493 ash::DesktopBackgroundController* controller = | |
| 494 ash::Shell::GetInstance()->desktop_background_controller(); | |
| 495 ash::WallpaperResolution resolution = controller->GetAppropriateResolution(); | |
| 496 ash::WallpaperInfo info; | |
| 497 if (UserManager::Get()->IsLoggedInAsGuest()) { | |
| 498 info = (resolution == ash::WALLPAPER_RESOLUTION_LARGE) ? | |
| 499 ash::kGuestLargeWallpaper : ash::kGuestSmallWallpaper; | |
| 500 } else { | |
| 501 info = (resolution == ash::WALLPAPER_RESOLUTION_LARGE) ? | |
| 502 ash::kDefaultLargeWallpaper : ash::kDefaultSmallWallpaper; | |
| 503 } | |
| 504 | |
| 505 // Prevents loading of the same wallpaper as the currently loading/loaded one. | |
| 506 if (controller->GetWallpaperIDR() == info.idr) | |
| 507 return; | |
| 508 | |
| 509 current_wallpaper_path_.clear(); | 493 current_wallpaper_path_.clear(); |
| 510 loaded_wallpapers_++; | 494 if (ash::Shell::GetInstance()->desktop_background_controller()-> |
| 511 controller->SetDefaultWallpaper(info); | 495 SetDefaultWallpaper(UserManager::Get()->IsLoggedInAsGuest())) |
| 496 loaded_wallpapers_++; |
| 512 } | 497 } |
| 513 | 498 |
| 514 void WallpaperManager::SetInitialUserWallpaper(const std::string& username, | 499 void WallpaperManager::SetInitialUserWallpaper(const std::string& username, |
| 515 bool is_persistent) { | 500 bool is_persistent) { |
| 516 current_user_wallpaper_info_.file = ""; | 501 current_user_wallpaper_info_.file = ""; |
| 517 current_user_wallpaper_info_.layout = ash::WALLPAPER_LAYOUT_CENTER_CROPPED; | 502 current_user_wallpaper_info_.layout = ash::WALLPAPER_LAYOUT_CENTER_CROPPED; |
| 518 current_user_wallpaper_info_.type = User::DEFAULT; | 503 current_user_wallpaper_info_.type = User::DEFAULT; |
| 519 current_user_wallpaper_info_.date = base::Time::Now().LocalMidnight(); | 504 current_user_wallpaper_info_.date = base::Time::Now().LocalMidnight(); |
| 520 | 505 |
| 521 WallpaperInfo info = current_user_wallpaper_info_; | 506 WallpaperInfo info = current_user_wallpaper_info_; |
| (...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1110 | 1095 |
| 1111 void WallpaperManager::SystemResumed(const base::TimeDelta& sleep_duration) { | 1096 void WallpaperManager::SystemResumed(const base::TimeDelta& sleep_duration) { |
| 1112 BatchUpdateWallpaper(); | 1097 BatchUpdateWallpaper(); |
| 1113 } | 1098 } |
| 1114 | 1099 |
| 1115 void WallpaperManager::TimezoneChanged(const icu::TimeZone& timezone) { | 1100 void WallpaperManager::TimezoneChanged(const icu::TimeZone& timezone) { |
| 1116 RestartTimer(); | 1101 RestartTimer(); |
| 1117 } | 1102 } |
| 1118 | 1103 |
| 1119 } // namespace chromeos | 1104 } // namespace chromeos |
| OLD | NEW |