| Index: ash/desktop_background/wallpaper_resizer.h
|
| diff --git a/ash/desktop_background/wallpaper_resizer.h b/ash/desktop_background/wallpaper_resizer.h
|
| index 9b47b7c3f735533799d29a55ab2b4f71e095ddda..e39dcd56aa0eed484b4714a9b4acf6d83ca3680c 100644
|
| --- a/ash/desktop_background/wallpaper_resizer.h
|
| +++ b/ash/desktop_background/wallpaper_resizer.h
|
| @@ -10,6 +10,7 @@
|
| #include "base/memory/weak_ptr.h"
|
| #include "base/observer_list.h"
|
| #include "skia/ext/image_operations.h"
|
| +#include "third_party/skia/include/core/SkBitmap.h"
|
| #include "ui/gfx/image/image_skia.h"
|
| #include "ui/gfx/size.h"
|
|
|
| @@ -20,18 +21,21 @@ class WallpaperResizerObserver;
|
| // Stores the current wallpaper data and resize it to |target_size| if needed.
|
| class ASH_EXPORT WallpaperResizer {
|
| public:
|
| - WallpaperResizer(const WallpaperInfo& info, const gfx::Size& target_size);
|
| + WallpaperResizer(int image_resource_id,
|
| + const gfx::Size& target_size,
|
| + WallpaperLayout layout);
|
|
|
| - WallpaperResizer(const WallpaperInfo& info, const gfx::Size& target_size,
|
| - const gfx::ImageSkia& image);
|
| + WallpaperResizer(const gfx::ImageSkia& image,
|
| + const gfx::Size& target_size,
|
| + WallpaperLayout layout);
|
|
|
| - virtual ~WallpaperResizer();
|
| -
|
| - const WallpaperInfo& wallpaper_info() const { return wallpaper_info_; }
|
| + ~WallpaperResizer();
|
|
|
| const gfx::ImageSkia& wallpaper_image() const { return wallpaper_image_; }
|
| + const WallpaperLayout layout() const { return layout_; }
|
|
|
| - // Starts resize task on UI thread. It posts task to worker pool.
|
| + // Called on the UI thread to run Resize() on the worker pool and post an
|
| + // OnResizeFinished() task back to the UI thread on completion.
|
| void StartResize();
|
|
|
| // Add/Remove observers.
|
| @@ -39,16 +43,20 @@ class ASH_EXPORT WallpaperResizer {
|
| void RemoveObserver(WallpaperResizerObserver* observer);
|
|
|
| private:
|
| - // Replaces the orginal uncompressed wallpaper to |resized_wallpaper|.
|
| - void OnResizeFinished(const SkBitmap& resized_wallpaper);
|
| + // Copies |resized_bitmap| to |wallpaper_image_| and notifies observers
|
| + // after Resize() has finished running.
|
| + void OnResizeFinished(SkBitmap* resized_bitmap);
|
|
|
| ObserverList<WallpaperResizerObserver> observers_;
|
|
|
| - const WallpaperInfo wallpaper_info_;
|
| + // Image that should currently be used for wallpaper. It initially
|
| + // contains the original image and is updated to contain the resized
|
| + // image by OnResizeFinished().
|
| + gfx::ImageSkia wallpaper_image_;
|
|
|
| gfx::Size target_size_;
|
|
|
| - gfx::ImageSkia wallpaper_image_;
|
| + WallpaperLayout layout_;
|
|
|
| base::WeakPtrFactory<WallpaperResizer> weak_ptr_factory_;
|
|
|
|
|