| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 COMPONENTS_WALLPAPER_WALLPAPER_MANAGER_BASE_H_ | 5 #ifndef COMPONENTS_WALLPAPER_WALLPAPER_MANAGER_BASE_H_ |
| 6 #define COMPONENTS_WALLPAPER_WALLPAPER_MANAGER_BASE_H_ | 6 #define COMPONENTS_WALLPAPER_WALLPAPER_MANAGER_BASE_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <deque> | 10 #include <deque> |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 const GURL& wallpaper_url, | 347 const GURL& wallpaper_url, |
| 348 const base::FilePath& downloaded_file, | 348 const base::FilePath& downloaded_file, |
| 349 const base::FilePath& resized_directory); | 349 const base::FilePath& resized_directory); |
| 350 | 350 |
| 351 // Returns queue size. | 351 // Returns queue size. |
| 352 virtual size_t GetPendingListSizeForTesting() const = 0; | 352 virtual size_t GetPendingListSizeForTesting() const = 0; |
| 353 | 353 |
| 354 // Ruturns files identifier for the |account_id|. | 354 // Ruturns files identifier for the |account_id|. |
| 355 virtual WallpaperFilesId GetFilesId(const AccountId& account_id) const = 0; | 355 virtual WallpaperFilesId GetFilesId(const AccountId& account_id) const = 0; |
| 356 | 356 |
| 357 // If the device is enterprise managed and we're at the login screen, set the |
| 358 // device wallpaper as the login screen wallpaper. If the device is enterprise |
| 359 // managed and we're in a user session, only set the device wallpaper if there |
| 360 // is no user policy wallpaper and the user hasn't changed the default or the |
| 361 // device wallpaper. Returns true if the device wallpaper should be set as the |
| 362 // wallpaper, otherwise returns false. |
| 363 virtual bool SetDeviceWallpaperIfApplicable(const AccountId& account_id) = 0; |
| 364 |
| 357 protected: | 365 protected: |
| 358 friend class TestApi; | 366 friend class TestApi; |
| 359 friend class WallpaperManagerBrowserTest; | 367 friend class WallpaperManagerBrowserTest; |
| 360 friend class WallpaperManagerBrowserTestDefaultWallpaper; | 368 friend class WallpaperManagerBrowserTestDefaultWallpaper; |
| 361 friend class WallpaperManagerPolicyTest; | 369 friend class WallpaperManagerPolicyTest; |
| 362 | 370 |
| 363 // The |CustomWallpaperElement| contains |first| the path of the image which | 371 // The |CustomWallpaperElement| contains |first| the path of the image which |
| 364 // is currently being loaded and or in progress of being loaded and |second| | 372 // is currently being loaded and or in progress of being loaded and |second| |
| 365 // the image itself. | 373 // the image itself. |
| 366 typedef std::pair<base::FilePath, gfx::ImageSkia> CustomWallpaperElement; | 374 typedef std::pair<base::FilePath, gfx::ImageSkia> CustomWallpaperElement; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 395 | 403 |
| 396 // Resize and save customized default wallpaper. | 404 // Resize and save customized default wallpaper. |
| 397 static void ResizeCustomizedDefaultWallpaper( | 405 static void ResizeCustomizedDefaultWallpaper( |
| 398 std::unique_ptr<gfx::ImageSkia> image, | 406 std::unique_ptr<gfx::ImageSkia> image, |
| 399 const CustomizedWallpaperRescaledFiles* rescaled_files, | 407 const CustomizedWallpaperRescaledFiles* rescaled_files, |
| 400 bool* success, | 408 bool* success, |
| 401 gfx::ImageSkia* small_wallpaper_image, | 409 gfx::ImageSkia* small_wallpaper_image, |
| 402 gfx::ImageSkia* large_wallpaper_image); | 410 gfx::ImageSkia* large_wallpaper_image); |
| 403 | 411 |
| 404 // Initialize wallpaper for the specified user to default and saves this | 412 // Initialize wallpaper for the specified user to default and saves this |
| 405 // settings in local state. | 413 // settings in local state. Note if the device policy controlled wallpaper |
| 414 // exists, use the device wallpaper as the default wallpaper. |
| 406 virtual void InitInitialUserWallpaper(const AccountId& account_id, | 415 virtual void InitInitialUserWallpaper(const AccountId& account_id, |
| 407 bool is_persistent); | 416 bool is_persistent); |
| 408 | 417 |
| 409 // Gets encoded wallpaper from cache. Returns true if success. | 418 // Gets encoded wallpaper from cache. Returns true if success. |
| 410 virtual bool GetWallpaperFromCache(const AccountId& account_id, | 419 virtual bool GetWallpaperFromCache(const AccountId& account_id, |
| 411 gfx::ImageSkia* image); | 420 gfx::ImageSkia* image); |
| 412 | 421 |
| 413 // Gets path of encoded wallpaper from cache. Returns true if success. | 422 // Gets path of encoded wallpaper from cache. Returns true if success. |
| 414 virtual bool GetPathFromCache(const AccountId& account_id, | 423 virtual bool GetPathFromCache(const AccountId& account_id, |
| 415 base::FilePath* path); | 424 base::FilePath* path); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 // wallpaper_files_id instead of e-mail. This must be called after | 474 // wallpaper_files_id instead of e-mail. This must be called after |
| 466 // wallpaper_files_id is ready. | 475 // wallpaper_files_id is ready. |
| 467 virtual void MoveLoggedInUserCustomWallpaper(); | 476 virtual void MoveLoggedInUserCustomWallpaper(); |
| 468 | 477 |
| 469 // Gets wallpaper information of |account_id| from Local State or memory. | 478 // Gets wallpaper information of |account_id| from Local State or memory. |
| 470 // Returns | 479 // Returns |
| 471 // false if wallpaper information is not found. | 480 // false if wallpaper information is not found. |
| 472 virtual bool GetUserWallpaperInfo(const AccountId& account_id, | 481 virtual bool GetUserWallpaperInfo(const AccountId& account_id, |
| 473 WallpaperInfo* info) const = 0; | 482 WallpaperInfo* info) const = 0; |
| 474 | 483 |
| 484 // Returns true if the device wallpaper should be set for the account. |
| 485 virtual bool ShouldSetDeviceWallpaper(const AccountId& account_id, |
| 486 std::string* url, |
| 487 std::string* hash) = 0; |
| 488 |
| 489 // Returns the file directory where the downloaded device wallpaper is saved. |
| 490 virtual base::FilePath GetDeviceWallpaperDir() = 0; |
| 491 |
| 492 // Returns the full path for the downloaded device wallpaper. |
| 493 virtual base::FilePath GetDeviceWallpaperFilePath() = 0; |
| 494 |
| 475 // Sets wallpaper to the decoded wallpaper if |update_wallpaper| is true. | 495 // Sets wallpaper to the decoded wallpaper if |update_wallpaper| is true. |
| 476 // Otherwise, cache wallpaper to memory if not logged in. (Takes a UserImage | 496 // Otherwise, cache wallpaper to memory if not logged in. (Takes a UserImage |
| 477 // because that's the callback interface provided by UserImageLoader.) | 497 // because that's the callback interface provided by UserImageLoader.) |
| 478 virtual void OnWallpaperDecoded( | 498 virtual void OnWallpaperDecoded( |
| 479 const AccountId& account_id, | 499 const AccountId& account_id, |
| 480 WallpaperLayout layout, | 500 WallpaperLayout layout, |
| 481 bool update_wallpaper, | 501 bool update_wallpaper, |
| 482 MovableOnDestroyCallbackHolder on_finish, | 502 MovableOnDestroyCallbackHolder on_finish, |
| 483 std::unique_ptr<user_manager::UserImage> user_image) = 0; | 503 std::unique_ptr<user_manager::UserImage> user_image) = 0; |
| 484 | 504 |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 608 | 628 |
| 609 base::WeakPtrFactory<WallpaperManagerBase> weak_factory_; | 629 base::WeakPtrFactory<WallpaperManagerBase> weak_factory_; |
| 610 | 630 |
| 611 private: | 631 private: |
| 612 DISALLOW_COPY_AND_ASSIGN(WallpaperManagerBase); | 632 DISALLOW_COPY_AND_ASSIGN(WallpaperManagerBase); |
| 613 }; | 633 }; |
| 614 | 634 |
| 615 } // namespace wallpaper | 635 } // namespace wallpaper |
| 616 | 636 |
| 617 #endif // COMPONENTS_WALLPAPER_WALLPAPER_MANAGER_BASE_H_ | 637 #endif // COMPONENTS_WALLPAPER_WALLPAPER_MANAGER_BASE_H_ |
| OLD | NEW |