Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(232)

Side by Side Diff: chrome/browser/chromeos/login/wallpaper_manager.cc

Issue 10827154: Preload default wallpaper. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/shell.h" 8 #include "ash/shell.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 local_state->RegisterDictionaryPref(prefs::kUsersWallpaperInfo, 95 local_state->RegisterDictionaryPref(prefs::kUsersWallpaperInfo,
96 PrefService::UNSYNCABLE_PREF); 96 PrefService::UNSYNCABLE_PREF);
97 } 97 }
98 98
99 void WallpaperManager::AddObservers() { 99 void WallpaperManager::AddObservers() {
100 if (!DBusThreadManager::Get()->GetPowerManagerClient()->HasObserver(this)) 100 if (!DBusThreadManager::Get()->GetPowerManagerClient()->HasObserver(this))
101 DBusThreadManager::Get()->GetPowerManagerClient()->AddObserver(this); 101 DBusThreadManager::Get()->GetPowerManagerClient()->AddObserver(this);
102 system::TimezoneSettings::GetInstance()->AddObserver(this); 102 system::TimezoneSettings::GetInstance()->AddObserver(this);
103 } 103 }
104 104
105 void WallpaperManager::CacheIfCustomWallpaper(const std::string& email) { 105 void WallpaperManager::CacheUserWallpaper(const std::string& email) {
106 User::WallpaperType type; 106 User::WallpaperType type;
107 int index; 107 int index;
108 base::Time date; 108 base::Time date;
109 GetUserWallpaperProperties(email, &type, &index, &date); 109 GetUserWallpaperProperties(email, &type, &index, &date);
110 if (type == User::CUSTOMIZED) { 110 if (type == User::CUSTOMIZED) {
111 std::string wallpaper_path = GetWallpaperPathForUser(email, false).value(); 111 std::string wallpaper_path = GetWallpaperPathForUser(email, false).value();
112 112
113 // Uses WeakPtr here to make the request cancelable. 113 // Uses WeakPtr here to make the request cancelable.
114 wallpaper_loader_->Start(wallpaper_path, 0, 114 wallpaper_loader_->Start(wallpaper_path, 0,
115 base::Bind(&WallpaperManager::CacheWallpaper, 115 base::Bind(&WallpaperManager::CacheWallpaper,
116 weak_factory_.GetWeakPtr(), email)); 116 weak_factory_.GetWeakPtr(), email));
117 } else {
118 ash::Shell::GetInstance()->desktop_background_controller()->
119 TriggerCacheDefaultWallpaper(index);
117 } 120 }
118 } 121 }
119 122
120 void WallpaperManager::EnsureLoggedInUserWallpaperLoaded() { 123 void WallpaperManager::EnsureLoggedInUserWallpaperLoaded() {
121 User::WallpaperType type; 124 User::WallpaperType type;
122 int index; 125 int index;
123 base::Time last_modification_date; 126 base::Time last_modification_date;
124 GetLoggedInUserWallpaperProperties(&type, &index, &last_modification_date); 127 GetLoggedInUserWallpaperProperties(&type, &index, &last_modification_date);
125 128
126 if (type != current_user_wallpaper_type_ || 129 if (type != current_user_wallpaper_type_ ||
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 581
579 void WallpaperManager::SystemResumed() { 582 void WallpaperManager::SystemResumed() {
580 BatchUpdateWallpaper(); 583 BatchUpdateWallpaper();
581 } 584 }
582 585
583 void WallpaperManager::TimezoneChanged(const icu::TimeZone& timezone) { 586 void WallpaperManager::TimezoneChanged(const icu::TimeZone& timezone) {
584 RestartTimer(); 587 RestartTimer();
585 } 588 }
586 589
587 } // chromeos 590 } // chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698