Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(233)

Unified Diff: chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h

Issue 2572793003: [Chrome OS] Implement the device wallpaper policy. (Closed)
Patch Set: Rebase. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h
diff --git a/chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h b/chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h
index 206bcfef59cdcdbc00b4f32743db763bd0f3e87e..f4c1a9523d2f96cc2f00b667069fab56c9046928 100644
--- a/chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h
+++ b/chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h
@@ -13,6 +13,7 @@
#include "base/macros.h"
#include "base/memory/ref_counted_memory.h"
#include "base/memory/weak_ptr.h"
+#include "chrome/browser/chromeos/customization/customization_wallpaper_downloader.h"
#include "chrome/browser/chromeos/settings/cros_settings.h"
#include "components/user_manager/user.h"
#include "components/user_manager/user_image/user_image.h"
@@ -81,6 +82,7 @@ class WallpaperManager
size_t GetPendingListSizeForTesting() const override;
wallpaper::WallpaperFilesId GetFilesId(
const AccountId& account_id) const override;
+ bool SetDeviceWallpaperIfApplicable(const AccountId& account_id) override;
// ash::mojom::WallpaperPicker:
void Open() override;
@@ -115,10 +117,40 @@ class WallpaperManager
const AccountId& account_id,
std::unique_ptr<user_manager::UserImage> user_image);
+ // This is called when the device wallpaper policy changes.
+ void OnDeviceWallpaperPolicyChanged();
+ // This is call after checking if the device wallpaper exists.
+ void OnDeviceWallpaperExists(const AccountId& account_id,
+ const std::string& url,
+ const std::string& hash,
+ bool exist);
+ // This is called after the device wallpaper is download (either successful or
+ // failed).
+ void OnDeviceWallpaperDownloaded(const AccountId& account_id,
+ const std::string& hash,
+ bool success,
+ const GURL& url);
+ // Check if the device wallpaper matches the hash that's provided in the
+ // device wallpaper policy setting.
+ void OnCheckDeviceWallpaperMatchHash(const AccountId& account_id,
+ const std::string& url,
+ const std::string& hash,
+ bool match);
+ // This is called when the device wallpaper is decoded successfully.
+ void OnDeviceWallpaperDecoded(
+ const AccountId& account_id,
+ std::unique_ptr<user_manager::UserImage> user_image);
+
// wallpaper::WallpaperManagerBase:
void InitializeRegisteredDeviceWallpaper() override;
bool GetUserWallpaperInfo(const AccountId& account_id,
wallpaper::WallpaperInfo* info) const override;
+ // Returns true if the device wallpaper should be set for the account.
+ bool ShouldSetDeviceWallpaper(const AccountId& account_id,
+ std::string* url,
+ std::string* hash) override;
+ base::FilePath GetDeviceWallpaperDir() override;
+ base::FilePath GetDeviceWallpaperFilePath() override;
void OnWallpaperDecoded(
const AccountId& account_id,
wallpaper::WallpaperLayout layout,
@@ -165,6 +197,12 @@ class WallpaperManager
std::unique_ptr<CrosSettings::ObserverSubscription>
show_user_name_on_signin_subscription_;
+ std::unique_ptr<CrosSettings::ObserverSubscription>
+ device_wallpaper_image_subscription_;
+ std::unique_ptr<CustomizationWallpaperDownloader>
+ device_wallpaper_downloader_;
+ bool retry_download_if_failed_ = true;
+
// Pointer to last inactive (waiting) entry of 'loading_' list.
// NULL when there is no inactive request.
PendingWallpaper* pending_inactive_;

Powered by Google App Engine
This is Rietveld 408576698