OLD | NEW |
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 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_WALLPAPER_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_WALLPAPER_MANAGER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_WALLPAPER_MANAGER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_WALLPAPER_MANAGER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "ash/desktop_background/desktop_background_resources.h" | 10 #include "ash/desktop_background/desktop_background_resources.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 void RestartTimer(); | 84 void RestartTimer(); |
85 | 85 |
86 // Tries to load user image from disk; if successful, sets it for the user, | 86 // Tries to load user image from disk; if successful, sets it for the user, |
87 // and updates Local State. | 87 // and updates Local State. |
88 void SetUserWallpaperFromFile(const std::string& username, | 88 void SetUserWallpaperFromFile(const std::string& username, |
89 const FilePath& path, | 89 const FilePath& path, |
90 ash::WallpaperLayout layout, | 90 ash::WallpaperLayout layout, |
91 base::WeakPtr<WallpaperDelegate> delegate); | 91 base::WeakPtr<WallpaperDelegate> delegate); |
92 | 92 |
93 // Set |email|'s wallpaper |type|, |index| and local date to local state. | 93 // Set |email|'s wallpaper |type|, |index| and local date to local state. |
94 void SaveUserWallpaperProperties(const std::string& email, | 94 // When |is_persistent| is false, changes are kept in memory only. |
95 User::WallpaperType type, | 95 void SetUserWallpaperProperties(const std::string& email, |
96 int index); | 96 User::WallpaperType type, |
| 97 int index, |
| 98 bool is_persistent); |
97 | 99 |
98 // Sets one of the default wallpapers for the specified user and saves this | 100 // Sets one of the default wallpapers for the specified user and saves this |
99 // settings in local state. | 101 // settings in local state. |
100 void SetInitialUserWallpaper(const std::string& username); | 102 void SetInitialUserWallpaper(const std::string& username, bool is_persistent); |
101 | 103 |
102 // Saves |username| selected wallpaper information to local state. | 104 // Saves |username| selected wallpaper information to local state. |
103 void SaveUserWallpaperInfo(const std::string& username, | 105 void SaveUserWallpaperInfo(const std::string& username, |
104 const std::string& file_name, | 106 const std::string& file_name, |
105 ash::WallpaperLayout layout, | 107 ash::WallpaperLayout layout, |
106 User::WallpaperType type); | 108 User::WallpaperType type); |
107 | 109 |
108 // Sets last selected user on user pod row. | 110 // Sets last selected user on user pod row. |
109 void SetLastSelectedUser(const std::string& last_selected_user); | 111 void SetLastSelectedUser(const std::string& last_selected_user); |
110 | 112 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 void SaveWallpaper(const std::string& path, const UserImage& wallpaper); | 180 void SaveWallpaper(const std::string& path, const UserImage& wallpaper); |
179 | 181 |
180 // Saves wallpaper to file, post task to generate thumbnail and updates local | 182 // Saves wallpaper to file, post task to generate thumbnail and updates local |
181 // state preferences. | 183 // state preferences. |
182 void SetWallpaper(const std::string& username, | 184 void SetWallpaper(const std::string& username, |
183 ash::WallpaperLayout layout, | 185 ash::WallpaperLayout layout, |
184 User::WallpaperType type, | 186 User::WallpaperType type, |
185 base::WeakPtr<WallpaperDelegate> delegate, | 187 base::WeakPtr<WallpaperDelegate> delegate, |
186 const UserImage& wallpaper); | 188 const UserImage& wallpaper); |
187 | 189 |
| 190 // Whether wallpaper data should be persisted for user |email|. |
| 191 // Note: this function can not be called in SetUserWallpaperProperties. It |
| 192 // will create a deadlock. (issue 142440) |
| 193 bool ShouldPersistDataForUser(const std::string& email); |
| 194 |
188 // Sets wallpaper to image in |user_image| with |layout|. | 195 // Sets wallpaper to image in |user_image| with |layout|. |
189 void OnWallpaperLoaded(ash::WallpaperLayout layout, | 196 void OnWallpaperLoaded(ash::WallpaperLayout layout, |
190 const UserImage& user_image); | 197 const UserImage& user_image); |
191 | 198 |
192 // Overridden from chromeos::ResumeObserver | 199 // Overridden from chromeos::ResumeObserver |
193 virtual void SystemResumed() OVERRIDE; | 200 virtual void SystemResumed() OVERRIDE; |
194 | 201 |
195 // Overridden from system::TimezoneSettings::Observer. | 202 // Overridden from system::TimezoneSettings::Observer. |
196 virtual void TimezoneChanged(const icu::TimeZone& timezone) OVERRIDE; | 203 virtual void TimezoneChanged(const icu::TimeZone& timezone) OVERRIDE; |
197 | 204 |
(...skipping 21 matching lines...) Expand all Loading... |
219 content::NotificationRegistrar registrar_; | 226 content::NotificationRegistrar registrar_; |
220 | 227 |
221 base::OneShotTimer<WallpaperManager> timer_; | 228 base::OneShotTimer<WallpaperManager> timer_; |
222 | 229 |
223 DISALLOW_COPY_AND_ASSIGN(WallpaperManager); | 230 DISALLOW_COPY_AND_ASSIGN(WallpaperManager); |
224 }; | 231 }; |
225 | 232 |
226 } // namespace chromeos | 233 } // namespace chromeos |
227 | 234 |
228 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_WALLPAPER_MANAGER_H_ | 235 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_WALLPAPER_MANAGER_H_ |
OLD | NEW |