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 1043 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1054 DCHECK(BrowserThread::GetBlockingPool()-> | 1054 DCHECK(BrowserThread::GetBlockingPool()-> |
1055 IsRunningSequenceOnCurrentThread(sequence_token_)); | 1055 IsRunningSequenceOnCurrentThread(sequence_token_)); |
1056 EnsureCustomWallpaperDirectories(email); | 1056 EnsureCustomWallpaperDirectories(email); |
1057 std::string file_name = original_path.BaseName().value(); | 1057 std::string file_name = original_path.BaseName().value(); |
1058 base::FilePath small_wallpaper_path = | 1058 base::FilePath small_wallpaper_path = |
1059 GetCustomWallpaperPath(kSmallWallpaperSubDir, email, file_name); | 1059 GetCustomWallpaperPath(kSmallWallpaperSubDir, email, file_name); |
1060 base::FilePath large_wallpaper_path = | 1060 base::FilePath large_wallpaper_path = |
1061 GetCustomWallpaperPath(kLargeWallpaperSubDir, email, file_name); | 1061 GetCustomWallpaperPath(kLargeWallpaperSubDir, email, file_name); |
1062 | 1062 |
1063 std::vector<unsigned char> image_data = wallpaper.raw_image(); | 1063 std::vector<unsigned char> image_data = wallpaper.raw_image(); |
1064 // Saves the original file in case that resized wallpaper is not generated | 1064 // Re-encode orginal file to jpeg format and saves the result in case that |
1065 // (i.e. chrome shutdown before resized wallpaper is saved). | 1065 // resized wallpaper is not generated (i.e. chrome shutdown before resized |
1066 SaveWallpaperInternal(original_path, | 1066 // wallpaper is saved). |
1067 reinterpret_cast<char*>(&*image_data.begin()), | 1067 ResizeAndSaveWallpaper(wallpaper, original_path, |
1068 image_data.size()); | 1068 ash::WALLPAPER_LAYOUT_STRETCH, |
| 1069 wallpaper.image().width(), |
| 1070 wallpaper.image().height()); |
1069 DeleteAllExcept(original_path); | 1071 DeleteAllExcept(original_path); |
1070 | 1072 |
1071 ResizeAndSaveWallpaper(wallpaper, small_wallpaper_path, layout, | 1073 ResizeAndSaveWallpaper(wallpaper, small_wallpaper_path, layout, |
1072 ash::kSmallWallpaperMaxWidth, | 1074 ash::kSmallWallpaperMaxWidth, |
1073 ash::kSmallWallpaperMaxHeight); | 1075 ash::kSmallWallpaperMaxHeight); |
1074 DeleteAllExcept(small_wallpaper_path); | 1076 DeleteAllExcept(small_wallpaper_path); |
1075 ResizeAndSaveWallpaper(wallpaper, large_wallpaper_path, layout, | 1077 ResizeAndSaveWallpaper(wallpaper, large_wallpaper_path, layout, |
1076 ash::kLargeWallpaperMaxWidth, | 1078 ash::kLargeWallpaperMaxWidth, |
1077 ash::kLargeWallpaperMaxHeight); | 1079 ash::kLargeWallpaperMaxHeight); |
1078 DeleteAllExcept(large_wallpaper_path); | 1080 DeleteAllExcept(large_wallpaper_path); |
(...skipping 28 matching lines...) Expand all Loading... |
1107 } | 1109 } |
1108 | 1110 |
1109 void WallpaperManager::SystemResumed(const base::TimeDelta& sleep_duration) { | 1111 void WallpaperManager::SystemResumed(const base::TimeDelta& sleep_duration) { |
1110 BatchUpdateWallpaper(); | 1112 BatchUpdateWallpaper(); |
1111 } | 1113 } |
1112 | 1114 |
1113 void WallpaperManager::TimezoneChanged(const icu::TimeZone& timezone) { | 1115 void WallpaperManager::TimezoneChanged(const icu::TimeZone& timezone) { |
1114 RestartTimer(); | 1116 RestartTimer(); |
1115 } | 1117 } |
1116 | 1118 |
1117 } // chromeos | 1119 } // namespace chromeos |
OLD | NEW |