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 <numeric> | 7 #include <numeric> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "ash/ash_switches.h" | 10 #include "ash/ash_switches.h" |
(...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
818 WallpaperManager::GetAppropriateResolution() { | 818 WallpaperManager::GetAppropriateResolution() { |
819 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 819 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
820 gfx::Size size = | 820 gfx::Size size = |
821 ash::DesktopBackgroundController::GetMaxDisplaySizeInNative(); | 821 ash::DesktopBackgroundController::GetMaxDisplaySizeInNative(); |
822 return (size.width() > kSmallWallpaperMaxWidth || | 822 return (size.width() > kSmallWallpaperMaxWidth || |
823 size.height() > kSmallWallpaperMaxHeight) | 823 size.height() > kSmallWallpaperMaxHeight) |
824 ? WALLPAPER_RESOLUTION_LARGE | 824 ? WALLPAPER_RESOLUTION_LARGE |
825 : WALLPAPER_RESOLUTION_SMALL; | 825 : WALLPAPER_RESOLUTION_SMALL; |
826 } | 826 } |
827 | 827 |
| 828 WallpaperManager::WallpaperResolution |
| 829 WallpaperManager::GetAppropriateResolutionForTesting() { |
| 830 gfx::Size size = |
| 831 ash::DesktopBackgroundController::GetMaxDisplaySizeInNative(); |
| 832 const WallpaperResolution result = (size.width() > kSmallWallpaperMaxWidth || |
| 833 size.height() > kSmallWallpaperMaxHeight) |
| 834 ? WALLPAPER_RESOLUTION_LARGE |
| 835 : WALLPAPER_RESOLUTION_SMALL; |
| 836 |
| 837 LOG(ERROR) << "WallpaperManager::GetAppropriateResolution(): width()=" |
| 838 << size.width() |
| 839 << " vs kSmallWallpaperMaxWidth=" << kSmallWallpaperMaxWidth |
| 840 << ", height()=" << size.height() |
| 841 << " vs kSmallWallpaperMaxHeight=" << kSmallWallpaperMaxHeight |
| 842 << ", result = " << (result == WALLPAPER_RESOLUTION_LARGE |
| 843 ? "WALLPAPER_RESOLUTION_LARGE" |
| 844 : "WALLPAPER_RESOLUTION_SMALL"); |
| 845 return result; |
| 846 } |
| 847 |
828 void WallpaperManager::SetPolicyControlledWallpaper( | 848 void WallpaperManager::SetPolicyControlledWallpaper( |
829 const std::string& user_id, | 849 const std::string& user_id, |
830 const UserImage& user_image) { | 850 const UserImage& user_image) { |
831 const User *user = chromeos::UserManager::Get()->FindUser(user_id); | 851 const User *user = chromeos::UserManager::Get()->FindUser(user_id); |
832 if (!user) { | 852 if (!user) { |
833 NOTREACHED() << "Unknown user."; | 853 NOTREACHED() << "Unknown user."; |
834 return; | 854 return; |
835 } | 855 } |
836 SetCustomWallpaper(user_id, | 856 SetCustomWallpaper(user_id, |
837 user->username_hash(), | 857 user->username_hash(), |
(...skipping 1035 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1873 } | 1893 } |
1874 } | 1894 } |
1875 | 1895 |
1876 if (need_update_screen) { | 1896 if (need_update_screen) { |
1877 DoSetDefaultWallpaper(std::string(), | 1897 DoSetDefaultWallpaper(std::string(), |
1878 MovableOnDestroyCallbackHolder().Pass()); | 1898 MovableOnDestroyCallbackHolder().Pass()); |
1879 } | 1899 } |
1880 } | 1900 } |
1881 | 1901 |
1882 } // namespace chromeos | 1902 } // namespace chromeos |
OLD | NEW |