| 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 // WallpaperManager, public: --------------------------------------------------- | 103 // WallpaperManager, public: --------------------------------------------------- |
| 104 | 104 |
| 105 // static | 105 // static |
| 106 WallpaperManager* WallpaperManager::Get() { | 106 WallpaperManager* WallpaperManager::Get() { |
| 107 if (!g_wallpaper_manager) | 107 if (!g_wallpaper_manager) |
| 108 g_wallpaper_manager = new WallpaperManager(); | 108 g_wallpaper_manager = new WallpaperManager(); |
| 109 return g_wallpaper_manager; | 109 return g_wallpaper_manager; |
| 110 } | 110 } |
| 111 | 111 |
| 112 WallpaperManager::WallpaperManager() | 112 WallpaperManager::WallpaperManager() |
| 113 : ALLOW_THIS_IN_INITIALIZER_LIST(wallpaper_loader_(new UserImageLoader)), | 113 : ALLOW_THIS_IN_INITIALIZER_LIST(wallpaper_loader_( |
| 114 new UserImageLoader(ImageDecoder::ROBUST_JPEG_CODEC))), |
| 114 current_user_wallpaper_type_(User::UNKNOWN), | 115 current_user_wallpaper_type_(User::UNKNOWN), |
| 115 ALLOW_THIS_IN_INITIALIZER_LIST(current_user_wallpaper_index_( | 116 ALLOW_THIS_IN_INITIALIZER_LIST(current_user_wallpaper_index_( |
| 116 ash::GetInvalidWallpaperIndex())), | 117 ash::GetInvalidWallpaperIndex())), |
| 117 should_cache_wallpaper_(false), | 118 should_cache_wallpaper_(false), |
| 118 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) { | 119 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) { |
| 119 RestartTimer(); | 120 RestartTimer(); |
| 120 registrar_.Add(this, | 121 registrar_.Add(this, |
| 121 chrome::NOTIFICATION_LOGIN_USER_CHANGED, | 122 chrome::NOTIFICATION_LOGIN_USER_CHANGED, |
| 122 content::NotificationService::AllSources()); | 123 content::NotificationService::AllSources()); |
| 123 registrar_.Add(this, | 124 registrar_.Add(this, |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 502 } else { | 503 } else { |
| 503 User::WallpaperType type; | 504 User::WallpaperType type; |
| 504 int index; | 505 int index; |
| 505 base::Time date; | 506 base::Time date; |
| 506 GetUserWallpaperProperties(email, &type, &index, &date); | 507 GetUserWallpaperProperties(email, &type, &index, &date); |
| 507 if (type == User::DAILY && date != base::Time::Now().LocalMidnight()) { | 508 if (type == User::DAILY && date != base::Time::Now().LocalMidnight()) { |
| 508 index = ash::GetNextWallpaperIndex(index); | 509 index = ash::GetNextWallpaperIndex(index); |
| 509 SetUserWallpaperProperties(email, User::DAILY, index, | 510 SetUserWallpaperProperties(email, User::DAILY, index, |
| 510 ShouldPersistDataForUser(email)); | 511 ShouldPersistDataForUser(email)); |
| 511 } else if (type == User::CUSTOMIZED) { | 512 } else if (type == User::CUSTOMIZED) { |
| 512 // For security reason, use default wallpaper instead of custom wallpaper | 513 GetCustomWallpaper(email); |
| 513 // at login screen. The security issue is tracked in issue 143198. Once it | 514 return; |
| 514 // fixed, we should then only use custom wallpaper. | |
| 515 if (!UserManager::Get()->IsUserLoggedIn()) { | |
| 516 index = ash::GetDefaultWallpaperIndex(); | |
| 517 } else { | |
| 518 GetCustomWallpaper(email); | |
| 519 return; | |
| 520 } | |
| 521 } | 515 } |
| 522 ash::Shell::GetInstance()->desktop_background_controller()-> | 516 ash::Shell::GetInstance()->desktop_background_controller()-> |
| 523 SetDefaultWallpaper(index, false); | 517 SetDefaultWallpaper(index, false); |
| 524 if (new_wallpaper_ui_enabled) | 518 if (new_wallpaper_ui_enabled) |
| 525 MigrateBuiltInWallpaper(email); | 519 MigrateBuiltInWallpaper(email); |
| 526 } | 520 } |
| 527 SetLastSelectedUser(email); | 521 SetLastSelectedUser(email); |
| 528 } | 522 } |
| 529 | 523 |
| 530 void WallpaperManager::SetWallpaperFromImageSkia( | 524 void WallpaperManager::SetWallpaperFromImageSkia( |
| (...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1048 | 1042 |
| 1049 void WallpaperManager::SystemResumed() { | 1043 void WallpaperManager::SystemResumed() { |
| 1050 BatchUpdateWallpaper(); | 1044 BatchUpdateWallpaper(); |
| 1051 } | 1045 } |
| 1052 | 1046 |
| 1053 void WallpaperManager::TimezoneChanged(const icu::TimeZone& timezone) { | 1047 void WallpaperManager::TimezoneChanged(const icu::TimeZone& timezone) { |
| 1054 RestartTimer(); | 1048 RestartTimer(); |
| 1055 } | 1049 } |
| 1056 | 1050 |
| 1057 } // chromeos | 1051 } // chromeos |
| OLD | NEW |