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

Unified Diff: components/wallpaper/wallpaper_manager_base.h

Issue 1165323004: We should use UserID object to identify users instead of username. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 months 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: components/wallpaper/wallpaper_manager_base.h
diff --git a/components/wallpaper/wallpaper_manager_base.h b/components/wallpaper/wallpaper_manager_base.h
index ae1ddd6ed697d83f48d2b24f606466dfa25f5509..dd26e8eb6634842a4c40bc5f4c59d29a1c63a0a8 100644
--- a/components/wallpaper/wallpaper_manager_base.h
+++ b/components/wallpaper/wallpaper_manager_base.h
@@ -167,13 +167,13 @@ class WALLPAPER_EXPORT WallpaperManagerBase
explicit TestApi(WallpaperManagerBase* wallpaper_manager);
virtual ~TestApi();
- bool GetWallpaperFromCache(const std::string& user_id,
+ bool GetWallpaperFromCache(const user_manager::UserID& user_id,
gfx::ImageSkia* image);
- bool GetPathFromCache(const std::string& user_id,
+ bool GetPathFromCache(const user_manager::UserID& user_id,
base::FilePath* path);
- void SetWallpaperCache(const std::string& user_id,
+ void SetWallpaperCache(const user_manager::UserID& user_id,
const base::FilePath& path,
const gfx::ImageSkia& image);
@@ -188,7 +188,7 @@ class WALLPAPER_EXPORT WallpaperManagerBase
class Observer {
public:
virtual ~Observer() {}
- virtual void OnWallpaperAnimationFinished(const std::string& user_id) = 0;
+ virtual void OnWallpaperAnimationFinished(const user_manager::UserID& user_id) = 0;
virtual void OnUpdateWallpaperForTesting() {}
virtual void OnPendingListEmptyForTesting() {}
};
@@ -260,11 +260,11 @@ class WALLPAPER_EXPORT WallpaperManagerBase
const content::NotificationDetails& details) override = 0;
// Removes all |user_id| related wallpaper info and saved wallpapers.
- virtual void RemoveUserWallpaperInfo(const std::string& user_id) = 0;
+ virtual void RemoveUserWallpaperInfo(const user_manager::UserID& user_id) = 0;
// Calls SetCustomWallpaper() with |user_id_hash| received from cryptohome.
virtual void SetCustomWallpaperOnSanitizedUsername(
- const std::string& user_id,
+ const user_manager::UserID& user_id,
const gfx::ImageSkia& image,
bool update_wallpaper,
bool cryptohome_success,
@@ -273,7 +273,7 @@ class WALLPAPER_EXPORT WallpaperManagerBase
// 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.
- virtual void SetCustomWallpaper(const std::string& user_id,
+ virtual void SetCustomWallpaper(const user_manager::UserID& user_id,
const std::string& user_id_hash,
const std::string& file,
WallpaperLayout layout,
@@ -293,26 +293,26 @@ class WALLPAPER_EXPORT WallpaperManagerBase
scoped_ptr<gfx::ImageSkia> large_wallpaper_image) = 0;
// Sets wallpaper to default wallpaper (asynchronously with zero delay).
- virtual void SetDefaultWallpaperNow(const std::string& user_id) = 0;
+ virtual void SetDefaultWallpaperNow(const user_manager::UserID& user_id) = 0;
// Sets wallpaper to default wallpaper (asynchronously with default delay).
- virtual void SetDefaultWallpaperDelayed(const std::string& user_id) = 0;
+ virtual void SetDefaultWallpaperDelayed(const user_manager::UserID& user_id) = 0;
// Sets selected wallpaper information for |user_id| and saves it to Local
// State if |is_persistent| is true.
- virtual void SetUserWallpaperInfo(const std::string& user_id,
+ virtual void SetUserWallpaperInfo(const user_manager::UserID& user_id,
const WallpaperInfo& info,
bool is_persistent) = 0;
// Sets |user_id|'s wallpaper (asynchronously with zero delay).
- virtual void SetUserWallpaperNow(const std::string& user_id);
+ virtual void SetUserWallpaperNow(const user_manager::UserID& user_id);
// Sets |user_id|'s wallpaper (asynchronously with default delay).
- virtual void SetUserWallpaperDelayed(const std::string& user_id);
+ virtual void SetUserWallpaperDelayed(const user_manager::UserID& user_id);
// Sets wallpaper to |image| (asynchronously with zero delay). If
// |update_wallpaper| is false, skip change wallpaper but only update cache.
- virtual void SetWallpaperFromImageSkia(const std::string& user_id,
+ virtual void SetWallpaperFromImageSkia(const user_manager::UserID& user_id,
const gfx::ImageSkia& image,
WallpaperLayout layout,
bool update_wallpaper) = 0;
@@ -328,21 +328,21 @@ class WALLPAPER_EXPORT WallpaperManagerBase
virtual void RemoveObserver(Observer* observer);
// Returns whether a wallpaper policy is enforced for |user_id|.
- virtual bool IsPolicyControlled(const std::string& user_id) const;
+ virtual bool IsPolicyControlled(const user_manager::UserID& user_id) const;
// Called when a wallpaper policy has been set for |user_id|. Blocks user
// from changing the wallpaper.
virtual void OnPolicySet(const std::string& policy,
- const std::string& user_id);
+ const user_manager::UserID& user_id);
// Called when the wallpaper policy has been cleared for |user_id|.
virtual void OnPolicyCleared(const std::string& policy,
- const std::string& user_id);
+ const user_manager::UserID& user_id);
// Called when the policy-set wallpaper has been fetched. Initiates decoding
// of the JPEG |data| with a callback to SetPolicyControlledWallpaper().
virtual void OnPolicyFetched(const std::string& policy,
- const std::string& user_id,
+ const user_manager::UserID& user_id,
scoped_ptr<std::string> data) = 0;
// This is called from CustomizationDocument.
@@ -366,7 +366,7 @@ class WALLPAPER_EXPORT WallpaperManagerBase
// is currently being loaded and or in progress of being loaded and |second|
// the image itself.
typedef std::pair<base::FilePath, gfx::ImageSkia> CustomWallpaperElement;
- typedef std::map<std::string, CustomWallpaperElement> CustomWallpaperMap;
+ typedef std::map<user_manager::UserID, CustomWallpaperElement> CustomWallpaperMap;
// Saves original custom wallpaper to |path| (absolute path) on filesystem
// and starts resizing operation of the custom wallpaper if necessary.
@@ -378,7 +378,7 @@ class WALLPAPER_EXPORT WallpaperManagerBase
// Moves custom wallpapers from |user_id| directory to |user_id_hash|
// directory.
static void MoveCustomWallpapersOnWorker(
- const std::string& user_id,
+ const user_manager::UserID& user_id,
const std::string& user_id_hash,
base::WeakPtr<WallpaperManagerBase> weak_ptr);
@@ -386,7 +386,7 @@ class WALLPAPER_EXPORT WallpaperManagerBase
// original custom wallpaper. When |update_wallpaper| is true, sets wallpaper
// to the loaded wallpaper. Must run on wallpaper sequenced worker thread.
static void GetCustomWallpaperInternal(
- const std::string& user_id,
+ const user_manager::UserID& user_id,
const WallpaperInfo& info,
const base::FilePath& wallpaper_path,
bool update_wallpaper,
@@ -404,21 +404,21 @@ class WALLPAPER_EXPORT WallpaperManagerBase
// Initialize wallpaper for the specified user to default and saves this
// settings in local state.
- virtual void InitInitialUserWallpaper(const std::string& user_id,
+ virtual void InitInitialUserWallpaper(const user_manager::UserID& user_id,
bool is_persistent);
// Set wallpaper to |user_image| controlled by policy. (Takes a UserImage
// because that's the callback interface provided by UserImageLoader.)
virtual void SetPolicyControlledWallpaper(
- const std::string& user_id,
+ const user_manager::UserID& user_id,
const user_manager::UserImage& user_image);
// Gets encoded wallpaper from cache. Returns true if success.
- virtual bool GetWallpaperFromCache(const std::string& user_id,
+ virtual bool GetWallpaperFromCache(const user_manager::UserID& user_id,
gfx::ImageSkia* image);
// Gets path of encoded wallpaper from cache. Returns true if success.
- virtual bool GetPathFromCache(const std::string& user_id,
+ virtual bool GetPathFromCache(const user_manager::UserID& user_id,
base::FilePath* path);
// The number of wallpapers have loaded. For test only.
@@ -437,14 +437,14 @@ class WALLPAPER_EXPORT WallpaperManagerBase
virtual void CacheUsersWallpapers();
// Caches |user_id|'s wallpaper to memory.
- virtual void CacheUserWallpaper(const std::string& user_id);
+ virtual void CacheUserWallpaper(const user_manager::UserID& user_id);
// Clears disposable ONLINE and CUSTOM wallpaper cache. At multi profile
// world, logged in users' wallpaper cache is not disposable.
virtual void ClearDisposableWallpaperCache();
// Deletes all |user_id| related custom wallpapers and directories.
- virtual void DeleteUserWallpapers(const std::string& user_id,
+ virtual void DeleteUserWallpapers(const user_manager::UserID& user_id,
const std::string& path_to_file);
// Gets the CommandLine representing the current process's command line.
@@ -456,14 +456,14 @@ class WALLPAPER_EXPORT WallpaperManagerBase
// Loads |user_id|'s wallpaper. When |update_wallpaper| is true, sets
// wallpaper to the loaded wallpaper.
- virtual void LoadWallpaper(const std::string& user_id,
+ virtual void LoadWallpaper(const user_manager::UserID& user_id,
const WallpaperInfo& info,
bool update_wallpaper,
MovableOnDestroyCallbackHolder on_finish);
// Called when the original custom wallpaper is moved to the new place.
// Updates the corresponding user wallpaper info.
- virtual void MoveCustomWallpapersSuccess(const std::string& user_id,
+ virtual void MoveCustomWallpapersSuccess(const user_manager::UserID& user_id,
const std::string& user_id_hash);
// Moves custom wallpaper to a new place. Email address was used as directory
@@ -474,31 +474,31 @@ class WALLPAPER_EXPORT WallpaperManagerBase
// Gets wallpaper information of |user_id| from Local State or memory. Returns
// false if wallpaper information is not found.
- virtual bool GetUserWallpaperInfo(const std::string& user_id,
+ virtual bool GetUserWallpaperInfo(const user_manager::UserID& user_id,
WallpaperInfo* info) const = 0;
// Sets wallpaper to the decoded wallpaper if |update_wallpaper| is true.
// Otherwise, cache wallpaper to memory if not logged in. (Takes a UserImage
// because that's the callback interface provided by UserImageLoader.)
virtual void OnWallpaperDecoded(
- const std::string& user_id,
+ const user_manager::UserID& user_id,
WallpaperLayout layout,
bool update_wallpaper,
MovableOnDestroyCallbackHolder on_finish,
const user_manager::UserImage& user_image) = 0;
// Creates new PendingWallpaper request (or updates currently pending).
- virtual void ScheduleSetUserWallpaper(const std::string& user_id,
+ virtual void ScheduleSetUserWallpaper(const user_manager::UserID& user_id,
bool delayed) = 0;
// Sets wallpaper to default.
virtual void DoSetDefaultWallpaper(
- const std::string& user_id,
+ const user_manager::UserID& user_id,
MovableOnDestroyCallbackHolder on_finish) = 0;
// Starts to load wallpaper at |wallpaper_path|. If |wallpaper_path| is
// already loaded for that user, do nothing. Must be called on UI thread.
- virtual void StartLoad(const std::string& user_id,
+ virtual void StartLoad(const user_manager::UserID& user_id,
const WallpaperInfo& info,
bool update_wallpaper,
const base::FilePath& wallpaper_path,
@@ -583,7 +583,7 @@ class WALLPAPER_EXPORT WallpaperManagerBase
CustomWallpaperMap wallpaper_cache_;
// The last selected user on user pod row.
- std::string last_selected_user_;
+ user_manager::UserID last_selected_user_;
bool should_cache_wallpaper_;

Powered by Google App Engine
This is Rietveld 408576698