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 369892bc5a1225039ab0b30dd21f615b5a650598..2a6d7cb4fb81d689e55da7e9fc9fc370573cf1ec 100644 |
--- a/chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h |
+++ b/chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h |
@@ -5,21 +5,14 @@ |
#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_USERS_WALLPAPER_WALLPAPER_MANAGER_H_ |
#define CHROME_BROWSER_CHROMEOS_LOGIN_USERS_WALLPAPER_WALLPAPER_MANAGER_H_ |
-#include <stddef.h> |
- |
-#include <deque> |
#include <memory> |
#include <string> |
#include <vector> |
-#include "base/files/file_path.h" |
+#include "ash/public/interfaces/wallpaper.mojom.h" |
#include "base/macros.h" |
#include "base/memory/ref_counted_memory.h" |
#include "base/memory/weak_ptr.h" |
-#include "base/observer_list.h" |
-#include "base/threading/sequenced_worker_pool.h" |
-#include "base/time/time.h" |
-#include "chrome/browser/chromeos/login/users/avatar/user_image_loader.h" |
#include "chrome/browser/chromeos/settings/cros_settings.h" |
#include "components/user_manager/user.h" |
#include "components/user_manager/user_image/user_image.h" |
@@ -28,12 +21,14 @@ |
#include "components/wallpaper/wallpaper_manager_base.h" |
#include "content/public/browser/notification_observer.h" |
#include "content/public/browser/notification_registrar.h" |
+#include "mojo/public/cpp/bindings/binding_set.h" |
#include "ui/gfx/image/image_skia.h" |
namespace chromeos { |
class WallpaperManager |
: public wallpaper::WallpaperManagerBase, |
+ public ash::mojom::WallpaperManager, |
public content::NotificationObserver, |
public user_manager::UserManager::UserSessionStateObserver { |
public: |
@@ -52,38 +47,18 @@ class WallpaperManager |
// WallpaperManager to remove any observers it has registered. |
static void Shutdown(); |
- // Returns the appropriate wallpaper resolution for all root windows. |
- WallpaperResolution GetAppropriateResolution() override; |
+ // Binds the mojom::WallpaperManager interface request to this object. |
+ void BindRequest(ash::mojom::WallpaperManagerRequest request); |
- // Adds PowerManagerClient, TimeZoneSettings and CrosSettings observers. |
+ // wallpaper::WallpaperManagerBase: |
+ WallpaperResolution GetAppropriateResolution() override; |
void AddObservers() override; |
- |
- // Loads wallpaper asynchronously if the current wallpaper is not the |
- // wallpaper of logged in user. |
void EnsureLoggedInUserWallpaperLoaded() override; |
- |
- // Initializes wallpaper. If logged in, loads user's wallpaper. If not logged |
- // in, uses a solid color wallpaper. If logged in as a stub user, uses an |
- // empty wallpaper. |
void InitializeWallpaper() override; |
- |
- // NotificationObserver overrides: |
- void Observe(int type, |
- const content::NotificationSource& source, |
- const content::NotificationDetails& details) override; |
- |
- // Removes all |account_id| related wallpaper info and saved wallpapers. |
void RemoveUserWallpaperInfo(const AccountId& account_id) override; |
- |
- // Called when the policy-set wallpaper has been fetched. Initiates decoding |
- // of the JPEG |data| with a callback to SetPolicyControlledWallpaper(). |
void OnPolicyFetched(const std::string& policy, |
const AccountId& account_id, |
std::unique_ptr<std::string> data) override; |
- |
- // Saves custom wallpaper to file, post task to generate thumbnail and updates |
- // local state preferences. If |update_wallpaper| is false, don't change |
- // wallpaper but only update cache. |
void SetCustomWallpaper(const AccountId& account_id, |
const wallpaper::WallpaperFilesId& wallpaper_files_id, |
const std::string& file, |
@@ -91,47 +66,34 @@ class WallpaperManager |
user_manager::User::WallpaperType type, |
const gfx::ImageSkia& image, |
bool update_wallpaper) override; |
- |
- // Sets wallpaper to default wallpaper (asynchronously with zero delay). |
void SetDefaultWallpaperNow(const AccountId& account_id) override; |
- |
- // Sets wallpaper to default wallpaper (asynchronously with default delay). |
void SetDefaultWallpaperDelayed(const AccountId& account_id) override; |
- |
- // Sets wallpaper to default. |
void DoSetDefaultWallpaper( |
const AccountId& account_id, |
wallpaper::MovableOnDestroyCallbackHolder on_finish) override; |
- |
- // Sets selected wallpaper information for |account_id| and saves it to Local |
- // State if |is_persistent| is true. |
void SetUserWallpaperInfo(const AccountId& account_id, |
const wallpaper::WallpaperInfo& info, |
bool is_persistent) override; |
- |
- // Creates new PendingWallpaper request (or updates currently pending). |
void ScheduleSetUserWallpaper(const AccountId& account_id, |
bool delayed) override; |
- |
- // Sets wallpaper to |image| (asynchronously with zero delay). If |
- // |update_wallpaper| is false, skip change wallpaper but only update cache. |
void SetWallpaperFromImageSkia(const AccountId& account_id, |
const gfx::ImageSkia& image, |
wallpaper::WallpaperLayout layout, |
bool update_wallpaper) override; |
- |
- // Updates current wallpaper. It may switch the size of wallpaper based on the |
- // current display's resolution. (asynchronously with zero delay) |
void UpdateWallpaper(bool clear_cache) override; |
- |
- // Returns queue size. |
size_t GetPendingListSizeForTesting() const override; |
- |
- // Returns wallpaper files id for the |account_id|. |
wallpaper::WallpaperFilesId GetFilesId( |
const AccountId& account_id) const override; |
- // Overridden from user_manager::UserManager::UserSessionStateObserver: |
+ // ash::mojom::WallpaperManager: |
+ void Open() override; |
+ |
+ // content::NotificationObserver: |
+ void Observe(int type, |
+ const content::NotificationSource& source, |
+ const content::NotificationDetails& details) override; |
+ |
+ // user_manager::UserManager::UserSessionStateObserver: |
void UserChangedChildStatus(user_manager::User* user) override; |
private: |
@@ -156,7 +118,7 @@ class WallpaperManager |
const AccountId& account_id, |
std::unique_ptr<user_manager::UserImage> user_image); |
- // WallpaperManagerBase overrides: |
+ // wallpaper::WallpaperManagerBase: |
void InitializeRegisteredDeviceWallpaper() override; |
bool GetUserWallpaperInfo(const AccountId& account_id, |
wallpaper::WallpaperInfo* info) const override; |
@@ -201,6 +163,8 @@ class WallpaperManager |
const base::FilePath& customized_default_wallpaper_file_large, |
std::unique_ptr<gfx::ImageSkia> large_wallpaper_image) override; |
+ mojo::BindingSet<ash::mojom::WallpaperManager> bindings_; |
+ |
std::unique_ptr<CrosSettings::ObserverSubscription> |
show_user_name_on_signin_subscription_; |
@@ -211,12 +175,13 @@ class WallpaperManager |
// Owns PendingWallpaper. |
// PendingWallpaper deletes itself from here on load complete. |
// All pending will be finally deleted on destroy. |
- typedef std::vector<scoped_refptr<PendingWallpaper> > PendingList; |
+ typedef std::vector<scoped_refptr<PendingWallpaper>> PendingList; |
PendingList loading_; |
content::NotificationRegistrar registrar_; |
base::WeakPtrFactory<WallpaperManager> weak_factory_; |
+ |
DISALLOW_COPY_AND_ASSIGN(WallpaperManager); |
}; |