Add a --use-angle flag for selecting the ANGLE renderer.
[chromium-blink-merge.git] / components / wallpaper / wallpaper_manager_base.h
blobae1ddd6ed697d83f48d2b24f606466dfa25f5509
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_
8 #include <deque>
9 #include <map>
10 #include <string>
11 #include <vector>
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;
33 namespace base {
34 class CommandLine;
35 class SequencedTaskRunner;
38 namespace user_manager {
39 class User;
40 class UserImage;
43 namespace wallpaper {
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 {
49 public:
50 explicit MovableOnDestroyCallback(const base::Closure& callback);
52 ~MovableOnDestroyCallback();
54 private:
55 base::Closure callback_;
58 typedef scoped_ptr<MovableOnDestroyCallback> MovableOnDestroyCallbackHolder;
60 struct WALLPAPER_EXPORT WallpaperInfo {
61 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);
66 ~WallpaperInfo();
68 // Either file name of migrated wallpaper including first directory level
69 // (corresponding to user id hash) or online wallpaper URL.
70 std::string location;
71 WallpaperLayout layout;
72 user_manager::User::WallpaperType type;
73 base::Time date;
74 bool operator==(const WallpaperInfo& other) {
75 return (location == other.location) && (layout == other.layout) &&
76 (type == other.type);
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.
87 // crbug.com/174928
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
121 // Chrome OS device.
122 class WALLPAPER_EXPORT WallpaperManagerBase
123 : public content::NotificationObserver {
124 public:
125 enum WallpaperResolution {
126 WALLPAPER_RESOLUTION_LARGE,
127 WALLPAPER_RESOLUTION_SMALL
129 class CustomizedWallpaperRescaledFiles {
130 public:
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;
149 private:
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);
164 // For testing.
165 class TestApi {
166 public:
167 explicit TestApi(WallpaperManagerBase* wallpaper_manager);
168 virtual ~TestApi();
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();
182 private:
183 WallpaperManagerBase* wallpaper_manager_; // not owned
185 DISALLOW_COPY_AND_ASSIGN(TestApi);
188 class Observer {
189 public:
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,
212 int preferred_width,
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,
224 int preferred_width,
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 // Adds PowerManagerClient, TimeZoneSettings and CrosSettings observers.
243 virtual void AddObservers() = 0;
245 // Loads wallpaper asynchronously if the current wallpaper is not the
246 // wallpaper of logged in user.
247 virtual void EnsureLoggedInUserWallpaperLoaded();
249 // Gets wallpaper information of logged in user.
250 virtual bool GetLoggedInUserWallpaperInfo(WallpaperInfo* info);
252 // Initializes wallpaper. If logged in, loads user's wallpaper. If not logged
253 // in, uses a solid color wallpaper. If logged in as a stub user, uses an
254 // empty wallpaper.
255 virtual void InitializeWallpaper() = 0;
257 // NotificationObserver overrides:
258 void Observe(int type,
259 const content::NotificationSource& source,
260 const content::NotificationDetails& details) override = 0;
262 // Removes all |user_id| related wallpaper info and saved wallpapers.
263 virtual void RemoveUserWallpaperInfo(const std::string& user_id) = 0;
265 // Calls SetCustomWallpaper() with |user_id_hash| received from cryptohome.
266 virtual void SetCustomWallpaperOnSanitizedUsername(
267 const std::string& user_id,
268 const gfx::ImageSkia& image,
269 bool update_wallpaper,
270 bool cryptohome_success,
271 const std::string& user_id_hash);
273 // Saves custom wallpaper to file, post task to generate thumbnail and updates
274 // local state preferences. If |update_wallpaper| is false, don't change
275 // wallpaper but only update cache.
276 virtual void SetCustomWallpaper(const std::string& user_id,
277 const std::string& user_id_hash,
278 const std::string& file,
279 WallpaperLayout layout,
280 user_manager::User::WallpaperType type,
281 const gfx::ImageSkia& image,
282 bool update_wallpaper) = 0;
284 // Use given files as new default wallpaper.
285 // Reloads current wallpaper, if old default was loaded.
286 // Current value of default_wallpaper_image_ is destroyed.
287 // Sets default_wallpaper_image_ either to |small_wallpaper_image| or
288 // |large_wallpaper_image| depending on GetAppropriateResolution().
289 virtual void SetDefaultWallpaperPath(
290 const base::FilePath& customized_default_wallpaper_file_small,
291 scoped_ptr<gfx::ImageSkia> small_wallpaper_image,
292 const base::FilePath& customized_default_wallpaper_file_large,
293 scoped_ptr<gfx::ImageSkia> large_wallpaper_image) = 0;
295 // Sets wallpaper to default wallpaper (asynchronously with zero delay).
296 virtual void SetDefaultWallpaperNow(const std::string& user_id) = 0;
298 // Sets wallpaper to default wallpaper (asynchronously with default delay).
299 virtual void SetDefaultWallpaperDelayed(const std::string& user_id) = 0;
301 // Sets selected wallpaper information for |user_id| and saves it to Local
302 // State if |is_persistent| is true.
303 virtual void SetUserWallpaperInfo(const std::string& user_id,
304 const WallpaperInfo& info,
305 bool is_persistent) = 0;
307 // Sets |user_id|'s wallpaper (asynchronously with zero delay).
308 virtual void SetUserWallpaperNow(const std::string& user_id);
310 // Sets |user_id|'s wallpaper (asynchronously with default delay).
311 virtual void SetUserWallpaperDelayed(const std::string& user_id);
313 // Sets wallpaper to |image| (asynchronously with zero delay). If
314 // |update_wallpaper| is false, skip change wallpaper but only update cache.
315 virtual void SetWallpaperFromImageSkia(const std::string& user_id,
316 const gfx::ImageSkia& image,
317 WallpaperLayout layout,
318 bool update_wallpaper) = 0;
320 // Updates current wallpaper. It may switch the size of wallpaper based on the
321 // current display's resolution. (asynchronously with zero delay)
322 virtual void UpdateWallpaper(bool clear_cache);
324 // Adds given observer to the list.
325 virtual void AddObserver(Observer* observer);
327 // Removes given observer from the list.
328 virtual void RemoveObserver(Observer* observer);
330 // Returns whether a wallpaper policy is enforced for |user_id|.
331 virtual bool IsPolicyControlled(const std::string& user_id) const;
333 // Called when a wallpaper policy has been set for |user_id|. Blocks user
334 // from changing the wallpaper.
335 virtual void OnPolicySet(const std::string& policy,
336 const std::string& user_id);
338 // Called when the wallpaper policy has been cleared for |user_id|.
339 virtual void OnPolicyCleared(const std::string& policy,
340 const std::string& user_id);
342 // Called when the policy-set wallpaper has been fetched. Initiates decoding
343 // of the JPEG |data| with a callback to SetPolicyControlledWallpaper().
344 virtual void OnPolicyFetched(const std::string& policy,
345 const std::string& user_id,
346 scoped_ptr<std::string> data) = 0;
348 // This is called from CustomizationDocument.
349 // |resized_directory| is the directory where resized versions are stored and
350 // must be writable.
351 virtual void SetCustomizedDefaultWallpaper(
352 const GURL& wallpaper_url,
353 const base::FilePath& downloaded_file,
354 const base::FilePath& resized_directory);
356 // Returns queue size.
357 virtual size_t GetPendingListSizeForTesting() const = 0;
359 protected:
360 friend class TestApi;
361 friend class WallpaperManagerBrowserTest;
362 friend class WallpaperManagerBrowserTestDefaultWallpaper;
363 friend class WallpaperManagerPolicyTest;
365 // The |CustomWallpaperElement| contains |first| the path of the image which
366 // is currently being loaded and or in progress of being loaded and |second|
367 // the image itself.
368 typedef std::pair<base::FilePath, gfx::ImageSkia> CustomWallpaperElement;
369 typedef std::map<std::string, CustomWallpaperElement> CustomWallpaperMap;
371 // Saves original custom wallpaper to |path| (absolute path) on filesystem
372 // and starts resizing operation of the custom wallpaper if necessary.
373 static void SaveCustomWallpaper(const std::string& user_id_hash,
374 const base::FilePath& path,
375 WallpaperLayout layout,
376 scoped_ptr<gfx::ImageSkia> image);
378 // Moves custom wallpapers from |user_id| directory to |user_id_hash|
379 // directory.
380 static void MoveCustomWallpapersOnWorker(
381 const std::string& user_id,
382 const std::string& user_id_hash,
383 base::WeakPtr<WallpaperManagerBase> weak_ptr);
385 // Gets |user_id|'s custom wallpaper at |wallpaper_path|. Falls back on
386 // original custom wallpaper. When |update_wallpaper| is true, sets wallpaper
387 // to the loaded wallpaper. Must run on wallpaper sequenced worker thread.
388 static void GetCustomWallpaperInternal(
389 const std::string& user_id,
390 const WallpaperInfo& info,
391 const base::FilePath& wallpaper_path,
392 bool update_wallpaper,
393 MovableOnDestroyCallbackHolder on_finish,
394 base::WeakPtr<WallpaperManagerBase> weak_ptr);
396 // Resize and save customized default wallpaper.
397 static void ResizeCustomizedDefaultWallpaper(
398 scoped_ptr<gfx::ImageSkia> image,
399 const user_manager::UserImage::RawImage& raw_image,
400 const CustomizedWallpaperRescaledFiles* rescaled_files,
401 bool* success,
402 gfx::ImageSkia* small_wallpaper_image,
403 gfx::ImageSkia* large_wallpaper_image);
405 // Initialize wallpaper for the specified user to default and saves this
406 // settings in local state.
407 virtual void InitInitialUserWallpaper(const std::string& user_id,
408 bool is_persistent);
410 // Set wallpaper to |user_image| controlled by policy. (Takes a UserImage
411 // because that's the callback interface provided by UserImageLoader.)
412 virtual void SetPolicyControlledWallpaper(
413 const std::string& user_id,
414 const user_manager::UserImage& user_image);
416 // Gets encoded wallpaper from cache. Returns true if success.
417 virtual bool GetWallpaperFromCache(const std::string& user_id,
418 gfx::ImageSkia* image);
420 // Gets path of encoded wallpaper from cache. Returns true if success.
421 virtual bool GetPathFromCache(const std::string& user_id,
422 base::FilePath* path);
424 // The number of wallpapers have loaded. For test only.
425 virtual int loaded_wallpapers_for_test() const;
427 // Cache some (or all) logged in users' wallpapers to memory at login
428 // screen. It should not compete with first wallpaper loading when boot
429 // up/initialize login WebUI page.
430 // There are two ways the first wallpaper might be loaded:
431 // 1. Loaded on boot. Login WebUI waits for it.
432 // 2. When flag --disable-boot-animation is passed. Login WebUI is loaded
433 // right away and in 500ms after. Wallpaper started to load.
434 // For case 2, should_cache_wallpaper_ is used to indicate if we need to
435 // cache wallpapers on wallpaper animation finished. The cache operation
436 // should be only executed once.
437 virtual void CacheUsersWallpapers();
439 // Caches |user_id|'s wallpaper to memory.
440 virtual void CacheUserWallpaper(const std::string& user_id);
442 // Clears disposable ONLINE and CUSTOM wallpaper cache. At multi profile
443 // world, logged in users' wallpaper cache is not disposable.
444 virtual void ClearDisposableWallpaperCache();
446 // Deletes all |user_id| related custom wallpapers and directories.
447 virtual void DeleteUserWallpapers(const std::string& user_id,
448 const std::string& path_to_file);
450 // Gets the CommandLine representing the current process's command line.
451 virtual base::CommandLine* GetCommandLine();
453 // Initialize wallpaper of registered device after device policy is trusted.
454 // Note that before device is enrolled, it proceeds with untrusted setting.
455 virtual void InitializeRegisteredDeviceWallpaper() = 0;
457 // Loads |user_id|'s wallpaper. When |update_wallpaper| is true, sets
458 // wallpaper to the loaded wallpaper.
459 virtual void LoadWallpaper(const std::string& user_id,
460 const WallpaperInfo& info,
461 bool update_wallpaper,
462 MovableOnDestroyCallbackHolder on_finish);
464 // Called when the original custom wallpaper is moved to the new place.
465 // Updates the corresponding user wallpaper info.
466 virtual void MoveCustomWallpapersSuccess(const std::string& user_id,
467 const std::string& user_id_hash);
469 // Moves custom wallpaper to a new place. Email address was used as directory
470 // name in the old system, this is not safe. New directory system uses
471 // user_id_hash instead of user_id. This must be called after user_id_hash is
472 // ready.
473 virtual void MoveLoggedInUserCustomWallpaper();
475 // Gets wallpaper information of |user_id| from Local State or memory. Returns
476 // false if wallpaper information is not found.
477 virtual bool GetUserWallpaperInfo(const std::string& user_id,
478 WallpaperInfo* info) const = 0;
480 // Sets wallpaper to the decoded wallpaper if |update_wallpaper| is true.
481 // Otherwise, cache wallpaper to memory if not logged in. (Takes a UserImage
482 // because that's the callback interface provided by UserImageLoader.)
483 virtual void OnWallpaperDecoded(
484 const std::string& user_id,
485 WallpaperLayout layout,
486 bool update_wallpaper,
487 MovableOnDestroyCallbackHolder on_finish,
488 const user_manager::UserImage& user_image) = 0;
490 // Creates new PendingWallpaper request (or updates currently pending).
491 virtual void ScheduleSetUserWallpaper(const std::string& user_id,
492 bool delayed) = 0;
494 // Sets wallpaper to default.
495 virtual void DoSetDefaultWallpaper(
496 const std::string& user_id,
497 MovableOnDestroyCallbackHolder on_finish) = 0;
499 // Starts to load wallpaper at |wallpaper_path|. If |wallpaper_path| is
500 // already loaded for that user, do nothing. Must be called on UI thread.
501 virtual void StartLoad(const std::string& user_id,
502 const WallpaperInfo& info,
503 bool update_wallpaper,
504 const base::FilePath& wallpaper_path,
505 MovableOnDestroyCallbackHolder on_finish) = 0;
507 // After completed load operation, update average load time.
508 virtual void SaveLastLoadTime(const base::TimeDelta elapsed);
510 // Notify all registered observers.
511 virtual void NotifyAnimationFinished();
513 // Calculate delay for next wallpaper load.
514 // It is usually average wallpaper load time.
515 // If last wallpaper load happened long ago, timeout should be reduced by
516 // the time passed after last wallpaper load. So usual user experience results
517 // in zero delay.
518 virtual base::TimeDelta GetWallpaperLoadDelay() const;
520 // This is called after we check that supplied default wallpaper files exist.
521 virtual void SetCustomizedDefaultWallpaperAfterCheck(
522 const GURL& wallpaper_url,
523 const base::FilePath& downloaded_file,
524 scoped_ptr<CustomizedWallpaperRescaledFiles> rescaled_files) = 0;
526 // Starts rescaling of customized wallpaper.
527 virtual void OnCustomizedDefaultWallpaperDecoded(
528 const GURL& wallpaper_url,
529 scoped_ptr<CustomizedWallpaperRescaledFiles> rescaled_files,
530 const user_manager::UserImage& user_image);
532 // Check the result of ResizeCustomizedDefaultWallpaper and finally
533 // apply Customized Default Wallpaper.
534 virtual void OnCustomizedDefaultWallpaperResized(
535 const GURL& wallpaper_url,
536 scoped_ptr<CustomizedWallpaperRescaledFiles> rescaled_files,
537 scoped_ptr<bool> success,
538 scoped_ptr<gfx::ImageSkia> small_wallpaper_image,
539 scoped_ptr<gfx::ImageSkia> large_wallpaper_image) = 0;
541 // Init |*default_*_wallpaper_file_| from given command line and
542 // clear |default_wallpaper_image_|.
543 virtual void SetDefaultWallpaperPathsFromCommandLine(
544 base::CommandLine* command_line);
546 // Sets wallpaper to decoded default.
547 virtual void OnDefaultWallpaperDecoded(
548 const base::FilePath& path,
549 const WallpaperLayout layout,
550 scoped_ptr<user_manager::UserImage>* result,
551 MovableOnDestroyCallbackHolder on_finish,
552 const user_manager::UserImage& user_image) = 0;
554 // Start decoding given default wallpaper.
555 virtual void StartLoadAndSetDefaultWallpaper(
556 const base::FilePath& path,
557 const WallpaperLayout layout,
558 MovableOnDestroyCallbackHolder on_finish,
559 scoped_ptr<user_manager::UserImage>* result_out) = 0;
561 // Returns wallpaper subdirectory name for current resolution.
562 virtual const char* GetCustomWallpaperSubdirForCurrentResolution();
564 // Init default_wallpaper_image_ with 1x1 image of default color.
565 virtual void CreateSolidDefaultWallpaper();
567 // The number of loaded wallpapers.
568 int loaded_wallpapers_for_test_;
570 // Sequence token associated with wallpaper operations.
571 base::SequencedWorkerPool::SequenceToken sequence_token_;
573 // Wallpaper sequenced task runner.
574 scoped_refptr<base::SequencedTaskRunner> task_runner_;
576 // Logged-in user wallpaper information.
577 WallpaperInfo current_user_wallpaper_info_;
579 // If non-NULL, used in place of the real command line.
580 base::CommandLine* command_line_for_testing_;
582 // Caches wallpapers of users. Accessed only on UI thread.
583 CustomWallpaperMap wallpaper_cache_;
585 // The last selected user on user pod row.
586 std::string last_selected_user_;
588 bool should_cache_wallpaper_;
590 content::NotificationRegistrar registrar_;
592 ObserverList<Observer> observers_;
594 // These members are for the scheduler:
596 // When last load attempt finished.
597 base::Time last_load_finished_at_;
599 // last N wallpaper loads times.
600 std::deque<base::TimeDelta> last_load_times_;
602 base::FilePath default_small_wallpaper_file_;
603 base::FilePath default_large_wallpaper_file_;
605 base::FilePath guest_small_wallpaper_file_;
606 base::FilePath guest_large_wallpaper_file_;
608 base::FilePath child_small_wallpaper_file_;
609 base::FilePath child_large_wallpaper_file_;
611 // Current decoded default image is stored in cache.
612 scoped_ptr<user_manager::UserImage> default_wallpaper_image_;
614 base::WeakPtrFactory<WallpaperManagerBase> weak_factory_;
616 private:
617 DISALLOW_COPY_AND_ASSIGN(WallpaperManagerBase);
620 } // namespace chromeos
622 #endif // COMPONENTS_WALLPAPER_WALLPAPER_MANAGER_BASE_H_