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
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_WALLPAPER_WALLPAPER_MANAGER_BASE_H_
6 #define COMPONENTS_WALLPAPER_WALLPAPER_MANAGER_BASE_H_
13 #include "base/files/file_path.h"
14 #include "base/gtest_prod_util.h"
15 #include "base/memory/ref_counted_memory.h"
16 #include "base/memory/scoped_ptr.h"
17 #include "base/memory/weak_ptr.h"
18 #include "base/observer_list.h"
19 #include "base/threading/sequenced_worker_pool.h"
20 #include "base/time/time.h"
21 #include "base/timer/timer.h"
22 #include "components/user_manager/user.h"
23 #include "components/user_manager/user_image/user_image.h"
24 #include "components/wallpaper/wallpaper_export.h"
25 #include "components/wallpaper/wallpaper_layout.h"
26 #include "content/public/browser/notification_observer.h"
27 #include "content/public/browser/notification_registrar.h"
28 #include "third_party/icu/source/i18n/unicode/timezone.h"
29 #include "ui/gfx/image/image_skia.h"
31 class PrefRegistrySimple
;
35 class SequencedTaskRunner
;
38 namespace user_manager
{
45 // This object is passed between several threads while wallpaper is being
46 // loaded. It will notify callback when last reference to it is removed
47 // (thus indicating that the last load action has finished).
48 class WALLPAPER_EXPORT MovableOnDestroyCallback
{
50 explicit MovableOnDestroyCallback(const base::Closure
& callback
);
52 ~MovableOnDestroyCallback();
55 base::Closure callback_
;
58 typedef scoped_ptr
<MovableOnDestroyCallback
> MovableOnDestroyCallbackHolder
;
60 struct WALLPAPER_EXPORT WallpaperInfo
{
62 WallpaperInfo(const std::string
& in_location
,
63 WallpaperLayout in_layout
,
64 user_manager::User::WallpaperType in_type
,
65 const base::Time
& in_date
);
68 // Either file name of migrated wallpaper including first directory level
69 // (corresponding to user id hash) or online wallpaper URL.
71 WallpaperLayout layout
;
72 user_manager::User::WallpaperType type
;
74 bool operator==(const WallpaperInfo
& other
) {
75 return (location
== other
.location
) && (layout
== other
.layout
) &&
80 class WallpaperManagerBrowserTest
;
82 // Name of wallpaper sequence token.
83 WALLPAPER_EXPORT
extern const char kWallpaperSequenceTokenName
[];
85 // File path suffices of resized small or large wallpaper.
86 // TODO(bshe): Use the same sub folder system as custom wallpapers use.
88 WALLPAPER_EXPORT
extern const char kSmallWallpaperSuffix
[];
89 WALLPAPER_EXPORT
extern const char kLargeWallpaperSuffix
[];
91 // Directory names of custom wallpapers.
92 WALLPAPER_EXPORT
extern const char kSmallWallpaperSubDir
[];
93 WALLPAPER_EXPORT
extern const char kLargeWallpaperSubDir
[];
94 WALLPAPER_EXPORT
extern const char kOriginalWallpaperSubDir
[];
95 WALLPAPER_EXPORT
extern const char kThumbnailWallpaperSubDir
[];
97 // The width and height of small/large resolution wallpaper. When screen size is
98 // smaller than |kSmallWallpaperMaxWidth| and |kSmallWallpaperMaxHeight|, the
99 // small resolution wallpaper should be used. Otherwise, use the large
100 // resolution wallpaper.
101 WALLPAPER_EXPORT
extern const int kSmallWallpaperMaxWidth
;
102 WALLPAPER_EXPORT
extern const int kSmallWallpaperMaxHeight
;
103 WALLPAPER_EXPORT
extern const int kLargeWallpaperMaxWidth
;
104 WALLPAPER_EXPORT
extern const int kLargeWallpaperMaxHeight
;
106 // The width and height of wallpaper thumbnails.
107 WALLPAPER_EXPORT
extern const int kWallpaperThumbnailWidth
;
108 WALLPAPER_EXPORT
extern const int kWallpaperThumbnailHeight
;
110 // A dictionary that maps usernames to wallpaper properties.
111 WALLPAPER_EXPORT
extern const char kUsersWallpaperInfo
[];
113 // A dictionary pref that maps usernames to file paths to their wallpapers.
114 // Deprecated. Will remove this const char after done migration.
115 WALLPAPER_EXPORT
extern const char kUserWallpapers
[];
117 // A dictionary pref that maps usernames to wallpaper properties.
118 WALLPAPER_EXPORT
extern const char kUserWallpapersProperties
[];
120 // This singleton class maintains wallpapers for users who have logged into this
122 class WALLPAPER_EXPORT WallpaperManagerBase
123 : public content::NotificationObserver
{
125 enum WallpaperResolution
{
126 WALLPAPER_RESOLUTION_LARGE
,
127 WALLPAPER_RESOLUTION_SMALL
129 class CustomizedWallpaperRescaledFiles
{
131 CustomizedWallpaperRescaledFiles(const base::FilePath
& path_downloaded
,
132 const base::FilePath
& path_rescaled_small
,
133 const base::FilePath
& path_rescaled_large
);
134 bool AllSizesExist() const;
136 // Closure will hold unretained pointer to this object. So caller must
137 // make sure that the closure will be destoyed before this object.
138 // Closure must be called on BlockingPool.
139 base::Closure
CreateCheckerClosure();
141 const base::FilePath
& path_downloaded() const;
142 const base::FilePath
& path_rescaled_small() const;
143 const base::FilePath
& path_rescaled_large() const;
145 bool downloaded_exists() const;
146 bool rescaled_small_exists() const;
147 bool rescaled_large_exists() const;
150 // Must be called on BlockingPool.
151 void CheckCustomizedWallpaperFilesExist();
153 const base::FilePath path_downloaded_
;
154 const base::FilePath path_rescaled_small_
;
155 const base::FilePath path_rescaled_large_
;
157 bool downloaded_exists_
;
158 bool rescaled_small_exists_
;
159 bool rescaled_large_exists_
;
161 DISALLOW_COPY_AND_ASSIGN(CustomizedWallpaperRescaledFiles
);
167 explicit TestApi(WallpaperManagerBase
* wallpaper_manager
);
170 bool GetWallpaperFromCache(const std::string
& user_id
,
171 gfx::ImageSkia
* image
);
173 bool GetPathFromCache(const std::string
& user_id
,
174 base::FilePath
* path
);
176 void SetWallpaperCache(const std::string
& user_id
,
177 const base::FilePath
& path
,
178 const gfx::ImageSkia
& image
);
180 void ClearDisposableWallpaperCache();
183 WallpaperManagerBase
* wallpaper_manager_
; // not owned
185 DISALLOW_COPY_AND_ASSIGN(TestApi
);
190 virtual ~Observer() {}
191 virtual void OnWallpaperAnimationFinished(const std::string
& user_id
) = 0;
192 virtual void OnUpdateWallpaperForTesting() {}
193 virtual void OnPendingListEmptyForTesting() {}
196 // set path IDs for used directories
197 static void SetPathIds(int dir_user_data_enum
,
198 int dir_chromeos_wallpapers_enum
,
199 int dir_chromeos_custom_wallpapers_enum
);
201 // Returns custom wallpaper directory by appending corresponding |sub_dir|.
202 static base::FilePath
GetCustomWallpaperDir(const char* sub_dir
);
204 // Registers wallpaper manager preferences.
205 static void RegisterPrefs(PrefRegistrySimple
* registry
);
207 // Resizes |image| to a resolution which is nearest to |preferred_width| and
208 // |preferred_height| while respecting the |layout| choice. |output_skia| is
209 // optional (may be NULL). Returns true on success.
210 static bool ResizeImage(const gfx::ImageSkia
& image
,
211 WallpaperLayout layout
,
213 int preferred_height
,
214 scoped_refptr
<base::RefCountedBytes
>* output
,
215 gfx::ImageSkia
* output_skia
);
217 // Resizes |image| to a resolution which is nearest to |preferred_width| and
218 // |preferred_height| while respecting the |layout| choice and saves the
219 // resized wallpaper to |path|. |output_skia| is optional (may be
220 // NULL). Returns true on success.
221 static bool ResizeAndSaveWallpaper(const gfx::ImageSkia
& image
,
222 const base::FilePath
& path
,
223 WallpaperLayout layout
,
225 int preferred_height
,
226 gfx::ImageSkia
* output_skia
);
228 // Returns custom wallpaper path. Append |sub_dir|, |user_id_hash| and |file|
229 // to custom wallpaper directory.
230 static base::FilePath
GetCustomWallpaperPath(const char* sub_dir
,
231 const std::string
& user_id_hash
,
232 const std::string
& file
);
234 WallpaperManagerBase();
235 ~WallpaperManagerBase() override
;
237 // Returns the appropriate wallpaper resolution for all root windows.
238 virtual WallpaperResolution
GetAppropriateResolution() = 0;
240 virtual void SetCommandLineForTesting(base::CommandLine
* command_line
);
242 // Indicates imminent shutdown, allowing the WallpaperManager to remove any
243 // observers it has registered.
244 virtual void Shutdown() = 0;
246 // Adds PowerManagerClient, TimeZoneSettings and CrosSettings observers.
247 virtual void AddObservers() = 0;
249 // Loads wallpaper asynchronously if the current wallpaper is not the
250 // wallpaper of logged in user.
251 virtual void EnsureLoggedInUserWallpaperLoaded();
253 // Gets wallpaper information of logged in user.
254 virtual bool GetLoggedInUserWallpaperInfo(WallpaperInfo
* info
);
256 // Initializes wallpaper. If logged in, loads user's wallpaper. If not logged
257 // in, uses a solid color wallpaper. If logged in as a stub user, uses an
259 virtual void InitializeWallpaper() = 0;
261 // NotificationObserver overrides:
262 void Observe(int type
,
263 const content::NotificationSource
& source
,
264 const content::NotificationDetails
& details
) override
= 0;
266 // Removes all |user_id| related wallpaper info and saved wallpapers.
267 virtual void RemoveUserWallpaperInfo(const std::string
& user_id
) = 0;
269 // Calls SetCustomWallpaper() with |user_id_hash| received from cryptohome.
270 virtual void SetCustomWallpaperOnSanitizedUsername(
271 const std::string
& user_id
,
272 const gfx::ImageSkia
& image
,
273 bool update_wallpaper
,
274 bool cryptohome_success
,
275 const std::string
& user_id_hash
);
277 // Saves custom wallpaper to file, post task to generate thumbnail and updates
278 // local state preferences. If |update_wallpaper| is false, don't change
279 // wallpaper but only update cache.
280 virtual void SetCustomWallpaper(const std::string
& user_id
,
281 const std::string
& user_id_hash
,
282 const std::string
& file
,
283 WallpaperLayout layout
,
284 user_manager::User::WallpaperType type
,
285 const gfx::ImageSkia
& image
,
286 bool update_wallpaper
) = 0;
288 // Use given files as new default wallpaper.
289 // Reloads current wallpaper, if old default was loaded.
290 // Current value of default_wallpaper_image_ is destroyed.
291 // Sets default_wallpaper_image_ either to |small_wallpaper_image| or
292 // |large_wallpaper_image| depending on GetAppropriateResolution().
293 virtual void SetDefaultWallpaperPath(
294 const base::FilePath
& customized_default_wallpaper_file_small
,
295 scoped_ptr
<gfx::ImageSkia
> small_wallpaper_image
,
296 const base::FilePath
& customized_default_wallpaper_file_large
,
297 scoped_ptr
<gfx::ImageSkia
> large_wallpaper_image
) = 0;
299 // Sets wallpaper to default wallpaper (asynchronously with zero delay).
300 virtual void SetDefaultWallpaperNow(const std::string
& user_id
) = 0;
302 // Sets wallpaper to default wallpaper (asynchronously with default delay).
303 virtual void SetDefaultWallpaperDelayed(const std::string
& user_id
) = 0;
305 // Sets selected wallpaper information for |user_id| and saves it to Local
306 // State if |is_persistent| is true.
307 virtual void SetUserWallpaperInfo(const std::string
& user_id
,
308 const WallpaperInfo
& info
,
309 bool is_persistent
) = 0;
311 // Sets |user_id|'s wallpaper (asynchronously with zero delay).
312 virtual void SetUserWallpaperNow(const std::string
& user_id
);
314 // Sets |user_id|'s wallpaper (asynchronously with default delay).
315 virtual void SetUserWallpaperDelayed(const std::string
& user_id
);
317 // Sets wallpaper to |image| (asynchronously with zero delay). If
318 // |update_wallpaper| is false, skip change wallpaper but only update cache.
319 virtual void SetWallpaperFromImageSkia(const std::string
& user_id
,
320 const gfx::ImageSkia
& image
,
321 WallpaperLayout layout
,
322 bool update_wallpaper
) = 0;
324 // Updates current wallpaper. It may switch the size of wallpaper based on the
325 // current display's resolution. (asynchronously with zero delay)
326 virtual void UpdateWallpaper(bool clear_cache
);
328 // Adds given observer to the list.
329 virtual void AddObserver(Observer
* observer
);
331 // Removes given observer from the list.
332 virtual void RemoveObserver(Observer
* observer
);
334 // Returns whether a wallpaper policy is enforced for |user_id|.
335 virtual bool IsPolicyControlled(const std::string
& user_id
) const;
337 // Called when a wallpaper policy has been set for |user_id|. Blocks user
338 // from changing the wallpaper.
339 virtual void OnPolicySet(const std::string
& policy
,
340 const std::string
& user_id
);
342 // Called when the wallpaper policy has been cleared for |user_id|.
343 virtual void OnPolicyCleared(const std::string
& policy
,
344 const std::string
& user_id
);
346 // Called when the policy-set wallpaper has been fetched. Initiates decoding
347 // of the JPEG |data| with a callback to SetPolicyControlledWallpaper().
348 virtual void OnPolicyFetched(const std::string
& policy
,
349 const std::string
& user_id
,
350 scoped_ptr
<std::string
> data
) = 0;
352 // This is called from CustomizationDocument.
353 // |resized_directory| is the directory where resized versions are stored and
355 virtual void SetCustomizedDefaultWallpaper(
356 const GURL
& wallpaper_url
,
357 const base::FilePath
& downloaded_file
,
358 const base::FilePath
& resized_directory
);
360 // Returns queue size.
361 virtual size_t GetPendingListSizeForTesting() const = 0;
364 friend class TestApi
;
365 friend class WallpaperManagerBrowserTest
;
366 friend class WallpaperManagerBrowserTestDefaultWallpaper
;
367 friend class WallpaperManagerPolicyTest
;
369 // The |CustomWallpaperElement| contains |first| the path of the image which
370 // is currently being loaded and or in progress of being loaded and |second|
372 typedef std::pair
<base::FilePath
, gfx::ImageSkia
> CustomWallpaperElement
;
373 typedef std::map
<std::string
, CustomWallpaperElement
> CustomWallpaperMap
;
375 // Saves original custom wallpaper to |path| (absolute path) on filesystem
376 // and starts resizing operation of the custom wallpaper if necessary.
377 static void SaveCustomWallpaper(const std::string
& user_id_hash
,
378 const base::FilePath
& path
,
379 WallpaperLayout layout
,
380 scoped_ptr
<gfx::ImageSkia
> image
);
382 // Moves custom wallpapers from |user_id| directory to |user_id_hash|
384 static void MoveCustomWallpapersOnWorker(
385 const std::string
& user_id
,
386 const std::string
& user_id_hash
,
387 base::WeakPtr
<WallpaperManagerBase
> weak_ptr
);
389 // Gets |user_id|'s custom wallpaper at |wallpaper_path|. Falls back on
390 // original custom wallpaper. When |update_wallpaper| is true, sets wallpaper
391 // to the loaded wallpaper. Must run on wallpaper sequenced worker thread.
392 static void GetCustomWallpaperInternal(
393 const std::string
& user_id
,
394 const WallpaperInfo
& info
,
395 const base::FilePath
& wallpaper_path
,
396 bool update_wallpaper
,
397 MovableOnDestroyCallbackHolder on_finish
,
398 base::WeakPtr
<WallpaperManagerBase
> weak_ptr
);
400 // Resize and save customized default wallpaper.
401 static void ResizeCustomizedDefaultWallpaper(
402 scoped_ptr
<gfx::ImageSkia
> image
,
403 const user_manager::UserImage::RawImage
& raw_image
,
404 const CustomizedWallpaperRescaledFiles
* rescaled_files
,
406 gfx::ImageSkia
* small_wallpaper_image
,
407 gfx::ImageSkia
* large_wallpaper_image
);
409 // Initialize wallpaper for the specified user to default and saves this
410 // settings in local state.
411 virtual void InitInitialUserWallpaper(const std::string
& user_id
,
414 // Set wallpaper to |user_image| controlled by policy. (Takes a UserImage
415 // because that's the callback interface provided by UserImageLoader.)
416 virtual void SetPolicyControlledWallpaper(
417 const std::string
& user_id
,
418 const user_manager::UserImage
& user_image
);
420 // Gets encoded wallpaper from cache. Returns true if success.
421 virtual bool GetWallpaperFromCache(const std::string
& user_id
,
422 gfx::ImageSkia
* image
);
424 // Gets path of encoded wallpaper from cache. Returns true if success.
425 virtual bool GetPathFromCache(const std::string
& user_id
,
426 base::FilePath
* path
);
428 // The number of wallpapers have loaded. For test only.
429 virtual int loaded_wallpapers_for_test() const;
431 // Cache some (or all) logged in users' wallpapers to memory at login
432 // screen. It should not compete with first wallpaper loading when boot
433 // up/initialize login WebUI page.
434 // There are two ways the first wallpaper might be loaded:
435 // 1. Loaded on boot. Login WebUI waits for it.
436 // 2. When flag --disable-boot-animation is passed. Login WebUI is loaded
437 // right away and in 500ms after. Wallpaper started to load.
438 // For case 2, should_cache_wallpaper_ is used to indicate if we need to
439 // cache wallpapers on wallpaper animation finished. The cache operation
440 // should be only executed once.
441 virtual void CacheUsersWallpapers();
443 // Caches |user_id|'s wallpaper to memory.
444 virtual void CacheUserWallpaper(const std::string
& user_id
);
446 // Clears disposable ONLINE and CUSTOM wallpaper cache. At multi profile
447 // world, logged in users' wallpaper cache is not disposable.
448 virtual void ClearDisposableWallpaperCache();
450 // Clears all obsolete wallpaper prefs from old version wallpaper pickers.
451 virtual void ClearObsoleteWallpaperPrefs() = 0;
453 // Deletes all |user_id| related custom wallpapers and directories.
454 virtual void DeleteUserWallpapers(const std::string
& user_id
,
455 const std::string
& path_to_file
);
457 // Gets the CommandLine representing the current process's command line.
458 virtual base::CommandLine
* GetCommandLine();
460 // Initialize wallpaper of registered device after device policy is trusted.
461 // Note that before device is enrolled, it proceeds with untrusted setting.
462 virtual void InitializeRegisteredDeviceWallpaper() = 0;
464 // Loads |user_id|'s wallpaper. When |update_wallpaper| is true, sets
465 // wallpaper to the loaded wallpaper.
466 virtual void LoadWallpaper(const std::string
& user_id
,
467 const WallpaperInfo
& info
,
468 bool update_wallpaper
,
469 MovableOnDestroyCallbackHolder on_finish
);
471 // Called when the original custom wallpaper is moved to the new place.
472 // Updates the corresponding user wallpaper info.
473 virtual void MoveCustomWallpapersSuccess(const std::string
& user_id
,
474 const std::string
& user_id_hash
);
476 // Moves custom wallpaper to a new place. Email address was used as directory
477 // name in the old system, this is not safe. New directory system uses
478 // user_id_hash instead of user_id. This must be called after user_id_hash is
480 virtual void MoveLoggedInUserCustomWallpaper();
482 // Gets wallpaper information of |user_id| from Local State or memory. Returns
483 // false if wallpaper information is not found.
484 virtual bool GetUserWallpaperInfo(const std::string
& user_id
,
485 WallpaperInfo
* info
) const = 0;
487 // Sets wallpaper to the decoded wallpaper if |update_wallpaper| is true.
488 // Otherwise, cache wallpaper to memory if not logged in. (Takes a UserImage
489 // because that's the callback interface provided by UserImageLoader.)
490 virtual void OnWallpaperDecoded(
491 const std::string
& user_id
,
492 WallpaperLayout layout
,
493 bool update_wallpaper
,
494 MovableOnDestroyCallbackHolder on_finish
,
495 const user_manager::UserImage
& user_image
) = 0;
497 // Creates new PendingWallpaper request (or updates currently pending).
498 virtual void ScheduleSetUserWallpaper(const std::string
& user_id
,
501 // Sets wallpaper to default.
502 virtual void DoSetDefaultWallpaper(
503 const std::string
& user_id
,
504 MovableOnDestroyCallbackHolder on_finish
) = 0;
506 // Starts to load wallpaper at |wallpaper_path|. If |wallpaper_path| is
507 // already loaded for that user, do nothing. Must be called on UI thread.
508 virtual void StartLoad(const std::string
& user_id
,
509 const WallpaperInfo
& info
,
510 bool update_wallpaper
,
511 const base::FilePath
& wallpaper_path
,
512 MovableOnDestroyCallbackHolder on_finish
) = 0;
514 // After completed load operation, update average load time.
515 virtual void SaveLastLoadTime(const base::TimeDelta elapsed
);
517 // Notify all registered observers.
518 virtual void NotifyAnimationFinished();
520 // Calculate delay for next wallpaper load.
521 // It is usually average wallpaper load time.
522 // If last wallpaper load happened long ago, timeout should be reduced by
523 // the time passed after last wallpaper load. So usual user experience results
525 virtual base::TimeDelta
GetWallpaperLoadDelay() const;
527 // This is called after we check that supplied default wallpaper files exist.
528 virtual void SetCustomizedDefaultWallpaperAfterCheck(
529 const GURL
& wallpaper_url
,
530 const base::FilePath
& downloaded_file
,
531 scoped_ptr
<CustomizedWallpaperRescaledFiles
> rescaled_files
) = 0;
533 // Starts rescaling of customized wallpaper.
534 virtual void OnCustomizedDefaultWallpaperDecoded(
535 const GURL
& wallpaper_url
,
536 scoped_ptr
<CustomizedWallpaperRescaledFiles
> rescaled_files
,
537 const user_manager::UserImage
& user_image
);
539 // Check the result of ResizeCustomizedDefaultWallpaper and finally
540 // apply Customized Default Wallpaper.
541 virtual void OnCustomizedDefaultWallpaperResized(
542 const GURL
& wallpaper_url
,
543 scoped_ptr
<CustomizedWallpaperRescaledFiles
> rescaled_files
,
544 scoped_ptr
<bool> success
,
545 scoped_ptr
<gfx::ImageSkia
> small_wallpaper_image
,
546 scoped_ptr
<gfx::ImageSkia
> large_wallpaper_image
) = 0;
548 // Init |*default_*_wallpaper_file_| from given command line and
549 // clear |default_wallpaper_image_|.
550 virtual void SetDefaultWallpaperPathsFromCommandLine(
551 base::CommandLine
* command_line
);
553 // Sets wallpaper to decoded default.
554 virtual void OnDefaultWallpaperDecoded(
555 const base::FilePath
& path
,
556 const WallpaperLayout layout
,
557 scoped_ptr
<user_manager::UserImage
>* result
,
558 MovableOnDestroyCallbackHolder on_finish
,
559 const user_manager::UserImage
& user_image
) = 0;
561 // Start decoding given default wallpaper.
562 virtual void StartLoadAndSetDefaultWallpaper(
563 const base::FilePath
& path
,
564 const WallpaperLayout layout
,
565 MovableOnDestroyCallbackHolder on_finish
,
566 scoped_ptr
<user_manager::UserImage
>* result_out
) = 0;
568 // Returns wallpaper subdirectory name for current resolution.
569 virtual const char* GetCustomWallpaperSubdirForCurrentResolution();
571 // Init default_wallpaper_image_ with 1x1 image of default color.
572 virtual void CreateSolidDefaultWallpaper();
574 // The number of loaded wallpapers.
575 int loaded_wallpapers_for_test_
;
577 // Sequence token associated with wallpaper operations.
578 base::SequencedWorkerPool::SequenceToken sequence_token_
;
580 // Wallpaper sequenced task runner.
581 scoped_refptr
<base::SequencedTaskRunner
> task_runner_
;
583 // Logged-in user wallpaper information.
584 WallpaperInfo current_user_wallpaper_info_
;
586 // If non-NULL, used in place of the real command line.
587 base::CommandLine
* command_line_for_testing_
;
589 // Caches wallpapers of users. Accessed only on UI thread.
590 CustomWallpaperMap wallpaper_cache_
;
592 // The last selected user on user pod row.
593 std::string last_selected_user_
;
595 bool should_cache_wallpaper_
;
597 content::NotificationRegistrar registrar_
;
599 ObserverList
<Observer
> observers_
;
601 // These members are for the scheduler:
603 // When last load attempt finished.
604 base::Time last_load_finished_at_
;
606 // last N wallpaper loads times.
607 std::deque
<base::TimeDelta
> last_load_times_
;
609 base::FilePath default_small_wallpaper_file_
;
610 base::FilePath default_large_wallpaper_file_
;
612 base::FilePath guest_small_wallpaper_file_
;
613 base::FilePath guest_large_wallpaper_file_
;
615 base::FilePath child_small_wallpaper_file_
;
616 base::FilePath child_large_wallpaper_file_
;
618 // Current decoded default image is stored in cache.
619 scoped_ptr
<user_manager::UserImage
> default_wallpaper_image_
;
621 base::WeakPtrFactory
<WallpaperManagerBase
> weak_factory_
;
624 DISALLOW_COPY_AND_ASSIGN(WallpaperManagerBase
);
627 } // namespace chromeos
629 #endif // COMPONENTS_WALLPAPER_WALLPAPER_MANAGER_BASE_H_