Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/users/wallpaper/wallpaper_manager.h" | 5 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" |
| 6 | 6 |
| 7 #include <numeric> | 7 #include <numeric> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "ash/ash_constants.h" | 10 #include "ash/ash_constants.h" |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 300 chrome::NOTIFICATION_WALLPAPER_ANIMATION_FINISHED, | 300 chrome::NOTIFICATION_WALLPAPER_ANIMATION_FINISHED, |
| 301 content::NotificationService::AllSources()); | 301 content::NotificationService::AllSources()); |
| 302 sequence_token_ = BrowserThread::GetBlockingPool()->GetNamedSequenceToken( | 302 sequence_token_ = BrowserThread::GetBlockingPool()->GetNamedSequenceToken( |
| 303 wallpaper::kWallpaperSequenceTokenName); | 303 wallpaper::kWallpaperSequenceTokenName); |
| 304 task_runner_ = BrowserThread::GetBlockingPool()-> | 304 task_runner_ = BrowserThread::GetBlockingPool()-> |
| 305 GetSequencedTaskRunnerWithShutdownBehavior( | 305 GetSequencedTaskRunnerWithShutdownBehavior( |
| 306 sequence_token_, | 306 sequence_token_, |
| 307 base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN); | 307 base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN); |
| 308 wallpaper_loader_ = new UserImageLoader(ImageDecoder::ROBUST_JPEG_CODEC, | 308 wallpaper_loader_ = new UserImageLoader(ImageDecoder::ROBUST_JPEG_CODEC, |
| 309 task_runner_); | 309 task_runner_); |
| 310 | |
| 311 user_manager::UserManager::Get()->AddSessionStateObserver(this); | |
| 310 } | 312 } |
| 311 | 313 |
| 312 WallpaperManager::~WallpaperManager() { | 314 WallpaperManager::~WallpaperManager() { |
| 313 // TODO(bshe): Lifetime of WallpaperManager needs more consideration. | 315 // TODO(bshe): Lifetime of WallpaperManager needs more consideration. |
| 314 // http://crbug.com/171694 | 316 // http://crbug.com/171694 |
| 315 DCHECK(!show_user_name_on_signin_subscription_); | 317 DCHECK(!show_user_name_on_signin_subscription_); |
| 316 | 318 |
| 319 user_manager::UserManager::Get()->RemoveSessionStateObserver(this); | |
| 320 | |
| 317 ClearObsoleteWallpaperPrefs(); | 321 ClearObsoleteWallpaperPrefs(); |
| 318 weak_factory_.InvalidateWeakPtrs(); | 322 weak_factory_.InvalidateWeakPtrs(); |
| 319 } | 323 } |
| 320 | 324 |
| 321 WallpaperManager::WallpaperResolution | 325 WallpaperManager::WallpaperResolution |
| 322 WallpaperManager::GetAppropriateResolution() { | 326 WallpaperManager::GetAppropriateResolution() { |
| 323 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 327 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 324 gfx::Size size = | 328 gfx::Size size = |
| 325 ash::DesktopBackgroundController::GetMaxDisplaySizeInNative(); | 329 ash::DesktopBackgroundController::GetMaxDisplaySizeInNative(); |
| 326 return (size.width() > wallpaper::kSmallWallpaperMaxWidth || | 330 return (size.width() > wallpaper::kSmallWallpaperMaxWidth || |
| (...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 944 } | 948 } |
| 945 | 949 |
| 946 if (loading_.empty()) | 950 if (loading_.empty()) |
| 947 FOR_EACH_OBSERVER(Observer, observers_, OnPendingListEmptyForTesting()); | 951 FOR_EACH_OBSERVER(Observer, observers_, OnPendingListEmptyForTesting()); |
| 948 } | 952 } |
| 949 | 953 |
| 950 size_t WallpaperManager::GetPendingListSizeForTesting() const { | 954 size_t WallpaperManager::GetPendingListSizeForTesting() const { |
| 951 return loading_.size(); | 955 return loading_.size(); |
| 952 } | 956 } |
| 953 | 957 |
| 958 void WallpaperManager::UserChangedChildStatus(user_manager::User* user) { | |
|
Mr4D (OOO till 08-26)
2015/02/25 15:23:16
This will probably mess up the user animation. If
merkulova
2015/02/25 15:30:14
It's not change between different users. It's a ch
| |
| 959 SetUserWallpaperNow(user->email()); | |
| 960 } | |
| 961 | |
| 954 void WallpaperManager::OnDefaultWallpaperDecoded( | 962 void WallpaperManager::OnDefaultWallpaperDecoded( |
| 955 const base::FilePath& path, | 963 const base::FilePath& path, |
| 956 const wallpaper::WallpaperLayout layout, | 964 const wallpaper::WallpaperLayout layout, |
| 957 scoped_ptr<user_manager::UserImage>* result_out, | 965 scoped_ptr<user_manager::UserImage>* result_out, |
| 958 MovableOnDestroyCallbackHolder on_finish, | 966 MovableOnDestroyCallbackHolder on_finish, |
| 959 const user_manager::UserImage& user_image) { | 967 const user_manager::UserImage& user_image) { |
| 960 result_out->reset(new user_manager::UserImage(user_image)); | 968 result_out->reset(new user_manager::UserImage(user_image)); |
| 961 ash::Shell::GetInstance()->desktop_background_controller()->SetWallpaperImage( | 969 ash::Shell::GetInstance()->desktop_background_controller()->SetWallpaperImage( |
| 962 user_image.image(), layout); | 970 user_image.image(), layout); |
| 963 } | 971 } |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1017 } | 1025 } |
| 1018 } | 1026 } |
| 1019 | 1027 |
| 1020 if (need_update_screen) { | 1028 if (need_update_screen) { |
| 1021 DoSetDefaultWallpaper(std::string(), | 1029 DoSetDefaultWallpaper(std::string(), |
| 1022 MovableOnDestroyCallbackHolder().Pass()); | 1030 MovableOnDestroyCallbackHolder().Pass()); |
| 1023 } | 1031 } |
| 1024 } | 1032 } |
| 1025 | 1033 |
| 1026 } // namespace chromeos | 1034 } // namespace chromeos |
| OLD | NEW |