| 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 "chrome/browser/chromeos/login/wallpaper_manager.h" | 5 #include "chrome/browser/chromeos/login/wallpaper_manager.h" |
| 6 | 6 |
| 7 #include "ash/desktop_background/desktop_background_controller.h" | 7 #include "ash/desktop_background/desktop_background_controller.h" |
| 8 #include "ash/desktop_background/desktop_background_resources.h" | 8 #include "ash/desktop_background/desktop_background_resources.h" |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 // WallpaperManager, public: --------------------------------------------------- | 89 // WallpaperManager, public: --------------------------------------------------- |
| 90 | 90 |
| 91 // static | 91 // static |
| 92 WallpaperManager* WallpaperManager::Get() { | 92 WallpaperManager* WallpaperManager::Get() { |
| 93 if (!g_wallpaper_manager) | 93 if (!g_wallpaper_manager) |
| 94 g_wallpaper_manager = new WallpaperManager(); | 94 g_wallpaper_manager = new WallpaperManager(); |
| 95 return g_wallpaper_manager; | 95 return g_wallpaper_manager; |
| 96 } | 96 } |
| 97 | 97 |
| 98 WallpaperManager::WallpaperManager() | 98 WallpaperManager::WallpaperManager() |
| 99 : ALLOW_THIS_IN_INITIALIZER_LIST(wallpaper_loader_(new UserImageLoader)), | 99 : ALLOW_THIS_IN_INITIALIZER_LIST(wallpaper_loader_( |
| 100 new UserImageLoader(ImageDecoder::ROBUST_JPEG_CODEC))), |
| 100 current_user_wallpaper_type_(User::UNKNOWN), | 101 current_user_wallpaper_type_(User::UNKNOWN), |
| 101 ALLOW_THIS_IN_INITIALIZER_LIST(current_user_wallpaper_index_( | 102 ALLOW_THIS_IN_INITIALIZER_LIST(current_user_wallpaper_index_( |
| 102 ash::GetInvalidWallpaperIndex())), | 103 ash::GetInvalidWallpaperIndex())), |
| 103 should_cache_wallpaper_(false), | 104 should_cache_wallpaper_(false), |
| 104 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) { | 105 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) { |
| 105 RestartTimer(); | 106 RestartTimer(); |
| 106 registrar_.Add(this, | 107 registrar_.Add(this, |
| 107 chrome::NOTIFICATION_LOGIN_USER_CHANGED, | 108 chrome::NOTIFICATION_LOGIN_USER_CHANGED, |
| 108 content::NotificationService::AllSources()); | 109 content::NotificationService::AllSources()); |
| 109 registrar_.Add(this, | 110 registrar_.Add(this, |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 } else { | 459 } else { |
| 459 User::WallpaperType type; | 460 User::WallpaperType type; |
| 460 int index; | 461 int index; |
| 461 base::Time date; | 462 base::Time date; |
| 462 GetUserWallpaperProperties(email, &type, &index, &date); | 463 GetUserWallpaperProperties(email, &type, &index, &date); |
| 463 if (type == User::DAILY && date != base::Time::Now().LocalMidnight()) { | 464 if (type == User::DAILY && date != base::Time::Now().LocalMidnight()) { |
| 464 index = ash::GetNextWallpaperIndex(index); | 465 index = ash::GetNextWallpaperIndex(index); |
| 465 SetUserWallpaperProperties(email, User::DAILY, index, | 466 SetUserWallpaperProperties(email, User::DAILY, index, |
| 466 ShouldPersistDataForUser(email)); | 467 ShouldPersistDataForUser(email)); |
| 467 } else if (type == User::CUSTOMIZED) { | 468 } else if (type == User::CUSTOMIZED) { |
| 468 // For security reason, use default wallpaper instead of custom wallpaper | 469 FetchCustomWallpaper(email); |
| 469 // at login screen. The security issue is tracked in issue 143198. Once it | 470 return; |
| 470 // fixed, we should then only use custom wallpaper. | |
| 471 if (!UserManager::Get()->IsUserLoggedIn()) { | |
| 472 index = ash::GetDefaultWallpaperIndex(); | |
| 473 } else { | |
| 474 FetchCustomWallpaper(email); | |
| 475 return; | |
| 476 } | |
| 477 } | 471 } |
| 478 ash::Shell::GetInstance()->desktop_background_controller()-> | 472 ash::Shell::GetInstance()->desktop_background_controller()-> |
| 479 SetDefaultWallpaper(index, false); | 473 SetDefaultWallpaper(index, false); |
| 480 if (new_wallpaper_ui_enabled) | 474 if (new_wallpaper_ui_enabled) |
| 481 MigrateBuiltInWallpaper(email); | 475 MigrateBuiltInWallpaper(email); |
| 482 } | 476 } |
| 483 SetLastSelectedUser(email); | 477 SetLastSelectedUser(email); |
| 484 } | 478 } |
| 485 | 479 |
| 486 void WallpaperManager::SetWallpaperFromImageSkia( | 480 void WallpaperManager::SetWallpaperFromImageSkia( |
| (...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 895 | 889 |
| 896 void WallpaperManager::SystemResumed() { | 890 void WallpaperManager::SystemResumed() { |
| 897 BatchUpdateWallpaper(); | 891 BatchUpdateWallpaper(); |
| 898 } | 892 } |
| 899 | 893 |
| 900 void WallpaperManager::TimezoneChanged(const icu::TimeZone& timezone) { | 894 void WallpaperManager::TimezoneChanged(const icu::TimeZone& timezone) { |
| 901 RestartTimer(); | 895 RestartTimer(); |
| 902 } | 896 } |
| 903 | 897 |
| 904 } // chromeos | 898 } // chromeos |
| OLD | NEW |