| 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 809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 820 WallpaperManager::GetAppropriateResolution() { | 820 WallpaperManager::GetAppropriateResolution() { |
| 821 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 821 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 822 gfx::Size size = | 822 gfx::Size size = |
| 823 ash::DesktopBackgroundController::GetMaxDisplaySizeInNative(); | 823 ash::DesktopBackgroundController::GetMaxDisplaySizeInNative(); |
| 824 return (size.width() > kSmallWallpaperMaxWidth || | 824 return (size.width() > kSmallWallpaperMaxWidth || |
| 825 size.height() > kSmallWallpaperMaxHeight) | 825 size.height() > kSmallWallpaperMaxHeight) |
| 826 ? WALLPAPER_RESOLUTION_LARGE | 826 ? WALLPAPER_RESOLUTION_LARGE |
| 827 : WALLPAPER_RESOLUTION_SMALL; | 827 : WALLPAPER_RESOLUTION_SMALL; |
| 828 } | 828 } |
| 829 | 829 |
| 830 WallpaperManager::WallpaperResolution | |
| 831 WallpaperManager::GetAppropriateResolutionForTesting() { | |
| 832 gfx::Size size = | |
| 833 ash::DesktopBackgroundController::GetMaxDisplaySizeInNative(); | |
| 834 const WallpaperResolution result = (size.width() > kSmallWallpaperMaxWidth || | |
| 835 size.height() > kSmallWallpaperMaxHeight) | |
| 836 ? WALLPAPER_RESOLUTION_LARGE | |
| 837 : WALLPAPER_RESOLUTION_SMALL; | |
| 838 | |
| 839 LOG(ERROR) << "WallpaperManager::GetAppropriateResolution(): width()=" | |
| 840 << size.width() | |
| 841 << " vs kSmallWallpaperMaxWidth=" << kSmallWallpaperMaxWidth | |
| 842 << ", height()=" << size.height() | |
| 843 << " vs kSmallWallpaperMaxHeight=" << kSmallWallpaperMaxHeight | |
| 844 << ", result = " << (result == WALLPAPER_RESOLUTION_LARGE | |
| 845 ? "WALLPAPER_RESOLUTION_LARGE" | |
| 846 : "WALLPAPER_RESOLUTION_SMALL"); | |
| 847 return result; | |
| 848 } | |
| 849 | |
| 850 void WallpaperManager::SetPolicyControlledWallpaper( | 830 void WallpaperManager::SetPolicyControlledWallpaper( |
| 851 const std::string& user_id, | 831 const std::string& user_id, |
| 852 const UserImage& user_image) { | 832 const UserImage& user_image) { |
| 853 const User *user = chromeos::UserManager::Get()->FindUser(user_id); | 833 const User *user = chromeos::UserManager::Get()->FindUser(user_id); |
| 854 if (!user) { | 834 if (!user) { |
| 855 NOTREACHED() << "Unknown user."; | 835 NOTREACHED() << "Unknown user."; |
| 856 return; | 836 return; |
| 857 } | 837 } |
| 858 SetCustomWallpaper(user_id, | 838 SetCustomWallpaper(user_id, |
| 859 user->username_hash(), | 839 user->username_hash(), |
| (...skipping 1043 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1903 } | 1883 } |
| 1904 } | 1884 } |
| 1905 | 1885 |
| 1906 if (need_update_screen) { | 1886 if (need_update_screen) { |
| 1907 DoSetDefaultWallpaper(std::string(), | 1887 DoSetDefaultWallpaper(std::string(), |
| 1908 MovableOnDestroyCallbackHolder().Pass()); | 1888 MovableOnDestroyCallbackHolder().Pass()); |
| 1909 } | 1889 } |
| 1910 } | 1890 } |
| 1911 | 1891 |
| 1912 } // namespace chromeos | 1892 } // namespace chromeos |
| OLD | NEW |