OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 <deque> | 8 #include <deque> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "ash/desktop_background/desktop_background_controller.h" | 12 #include "ash/desktop_background/desktop_background_controller.h" |
13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
14 #include "base/memory/ref_counted_memory.h" | 14 #include "base/memory/ref_counted_memory.h" |
15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
17 #include "base/observer_list.h" | 17 #include "base/observer_list.h" |
18 #include "base/threading/sequenced_worker_pool.h" | 18 #include "base/threading/sequenced_worker_pool.h" |
19 #include "base/time/time.h" | 19 #include "base/time/time.h" |
20 #include "chrome/browser/chromeos/login/user.h" | 20 #include "chrome/browser/chromeos/login/user.h" |
21 #include "chrome/browser/chromeos/login/user_image.h" | 21 #include "chrome/browser/chromeos/login/user_image.h" |
22 #include "chrome/browser/chromeos/login/user_image_loader.h" | 22 #include "chrome/browser/chromeos/login/user_image_loader.h" |
23 #include "chrome/browser/chromeos/settings/cros_settings.h" | 23 #include "chrome/browser/chromeos/settings/cros_settings.h" |
24 #include "content/public/browser/notification_observer.h" | 24 #include "content/public/browser/notification_observer.h" |
25 #include "content/public/browser/notification_registrar.h" | 25 #include "content/public/browser/notification_registrar.h" |
26 #include "third_party/icu/source/i18n/unicode/timezone.h" | 26 #include "third_party/icu/source/i18n/unicode/timezone.h" |
27 #include "ui/gfx/image/image_skia.h" | 27 #include "ui/gfx/image/image_skia.h" |
28 | 28 |
29 class CommandLine; | |
30 class PrefRegistrySimple; | 29 class PrefRegistrySimple; |
31 | 30 |
32 namespace base { | 31 namespace base { |
| 32 class CommandLine; |
33 class SequencedTaskRunner; | 33 class SequencedTaskRunner; |
34 } | 34 } |
35 | 35 |
36 namespace chromeos { | 36 namespace chromeos { |
37 | 37 |
38 struct WallpaperInfo { | 38 struct WallpaperInfo { |
39 // Online wallpaper URL or file name of migrated wallpaper. | 39 // Online wallpaper URL or file name of migrated wallpaper. |
40 std::string file; | 40 std::string file; |
41 ash::WallpaperLayout layout; | 41 ash::WallpaperLayout layout; |
42 User::WallpaperType type; | 42 User::WallpaperType type; |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 base::Time started_load_at_; | 164 base::Time started_load_at_; |
165 | 165 |
166 DISALLOW_COPY_AND_ASSIGN(PendingWallpaper); | 166 DISALLOW_COPY_AND_ASSIGN(PendingWallpaper); |
167 }; | 167 }; |
168 | 168 |
169 static WallpaperManager* Get(); | 169 static WallpaperManager* Get(); |
170 | 170 |
171 WallpaperManager(); | 171 WallpaperManager(); |
172 virtual ~WallpaperManager(); | 172 virtual ~WallpaperManager(); |
173 | 173 |
174 void set_command_line_for_testing(CommandLine* command_line) { | 174 void set_command_line_for_testing(base::CommandLine* command_line) { |
175 command_line_for_testing_ = command_line; | 175 command_line_for_testing_ = command_line; |
176 } | 176 } |
177 | 177 |
178 // Indicates imminent shutdown, allowing the WallpaperManager to remove any | 178 // Indicates imminent shutdown, allowing the WallpaperManager to remove any |
179 // observers it has registered. | 179 // observers it has registered. |
180 void Shutdown(); | 180 void Shutdown(); |
181 | 181 |
182 // Registers wallpaper manager preferences. | 182 // Registers wallpaper manager preferences. |
183 static void RegisterPrefs(PrefRegistrySimple* registry); | 183 static void RegisterPrefs(PrefRegistrySimple* registry); |
184 | 184 |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 | 347 |
348 // Deletes all |user_id| related custom wallpapers and directories. | 348 // Deletes all |user_id| related custom wallpapers and directories. |
349 void DeleteUserWallpapers(const std::string& user_id, | 349 void DeleteUserWallpapers(const std::string& user_id, |
350 const std::string& path_to_file); | 350 const std::string& path_to_file); |
351 | 351 |
352 // Creates all new custom wallpaper directories for |user_id_hash| if not | 352 // Creates all new custom wallpaper directories for |user_id_hash| if not |
353 // exist. | 353 // exist. |
354 void EnsureCustomWallpaperDirectories(const std::string& user_id_hash); | 354 void EnsureCustomWallpaperDirectories(const std::string& user_id_hash); |
355 | 355 |
356 // Gets the CommandLine representing the current process's command line. | 356 // Gets the CommandLine representing the current process's command line. |
357 CommandLine* GetComandLine(); | 357 base::CommandLine* GetComandLine(); |
358 | 358 |
359 // Initialize wallpaper of registered device after device policy is trusted. | 359 // Initialize wallpaper of registered device after device policy is trusted. |
360 // Note that before device is enrolled, it proceeds with untrusted setting. | 360 // Note that before device is enrolled, it proceeds with untrusted setting. |
361 void InitializeRegisteredDeviceWallpaper(); | 361 void InitializeRegisteredDeviceWallpaper(); |
362 | 362 |
363 // Loads |user_id|'s wallpaper. When |update_wallpaper| is true, sets | 363 // Loads |user_id|'s wallpaper. When |update_wallpaper| is true, sets |
364 // wallpaper to the loaded wallpaper. | 364 // wallpaper to the loaded wallpaper. |
365 void LoadWallpaper(const std::string& user_id, | 365 void LoadWallpaper(const std::string& user_id, |
366 const WallpaperInfo& info, | 366 const WallpaperInfo& info, |
367 bool update_wallpaper, | 367 bool update_wallpaper, |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 // The file path of current loaded/loading custom/online wallpaper. | 474 // The file path of current loaded/loading custom/online wallpaper. |
475 base::FilePath current_wallpaper_path_; | 475 base::FilePath current_wallpaper_path_; |
476 | 476 |
477 // Loads user wallpaper from its file. | 477 // Loads user wallpaper from its file. |
478 scoped_refptr<UserImageLoader> wallpaper_loader_; | 478 scoped_refptr<UserImageLoader> wallpaper_loader_; |
479 | 479 |
480 // Logged-in user wallpaper information. | 480 // Logged-in user wallpaper information. |
481 WallpaperInfo current_user_wallpaper_info_; | 481 WallpaperInfo current_user_wallpaper_info_; |
482 | 482 |
483 // If non-NULL, used in place of the real command line. | 483 // If non-NULL, used in place of the real command line. |
484 CommandLine* command_line_for_testing_; | 484 base::CommandLine* command_line_for_testing_; |
485 | 485 |
486 // Caches wallpapers of users. Accessed only on UI thread. | 486 // Caches wallpapers of users. Accessed only on UI thread. |
487 CustomWallpaperMap wallpaper_cache_; | 487 CustomWallpaperMap wallpaper_cache_; |
488 | 488 |
489 // The last selected user on user pod row. | 489 // The last selected user on user pod row. |
490 std::string last_selected_user_; | 490 std::string last_selected_user_; |
491 | 491 |
492 bool should_cache_wallpaper_; | 492 bool should_cache_wallpaper_; |
493 | 493 |
494 scoped_ptr<CrosSettings::ObserverSubscription> | 494 scoped_ptr<CrosSettings::ObserverSubscription> |
(...skipping 22 matching lines...) Expand all Loading... |
517 // All pending will be finally deleted on destroy. | 517 // All pending will be finally deleted on destroy. |
518 typedef std::vector<scoped_refptr<PendingWallpaper> > PendingList; | 518 typedef std::vector<scoped_refptr<PendingWallpaper> > PendingList; |
519 PendingList loading_; | 519 PendingList loading_; |
520 | 520 |
521 DISALLOW_COPY_AND_ASSIGN(WallpaperManager); | 521 DISALLOW_COPY_AND_ASSIGN(WallpaperManager); |
522 }; | 522 }; |
523 | 523 |
524 } // namespace chromeos | 524 } // namespace chromeos |
525 | 525 |
526 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_WALLPAPER_MANAGER_H_ | 526 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_WALLPAPER_MANAGER_H_ |
OLD | NEW |