Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 ASH_DESKTOP_BACKGROUND_DESKTOP_BACKGROUND_CONTROLLER_H_ | 5 #ifndef ASH_DESKTOP_BACKGROUND_DESKTOP_BACKGROUND_CONTROLLER_H_ |
| 6 #define ASH_DESKTOP_BACKGROUND_DESKTOP_BACKGROUND_CONTROLLER_H_ | 6 #define ASH_DESKTOP_BACKGROUND_DESKTOP_BACKGROUND_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
| 9 #include "ash/desktop_background/desktop_background_resources.h" | |
| 10 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 11 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
| 13 #include "base/observer_list.h" | 12 #include "base/observer_list.h" |
| 14 #include "ui/aura/window.h" | 13 #include "ui/aura/window.h" |
| 15 #include "ui/aura/window_observer.h" | 14 #include "ui/aura/window_observer.h" |
| 16 #include "ui/compositor/layer.h" | 15 #include "ui/compositor/layer.h" |
| 17 #include "ui/gfx/image/image_skia.h" | 16 #include "ui/gfx/image/image_skia.h" |
| 18 | 17 |
| 19 typedef unsigned int SkColor; | 18 typedef unsigned int SkColor; |
| 20 | 19 |
| 21 namespace aura { | 20 namespace aura { |
| 22 class RootWindow; | 21 class RootWindow; |
| 23 } | 22 } |
| 24 | 23 |
| 25 namespace ash { | 24 namespace ash { |
| 26 | 25 |
| 26 enum WallpaperLayout { | |
| 27 CENTER, | |
|
sky
2012/11/19 22:21:19
For enums that exist in the ash namespace they nee
bshe
2012/11/20 00:33:59
Done.
| |
| 28 CENTER_CROPPED, | |
| 29 STRETCH, | |
| 30 TILE, | |
| 31 }; | |
| 32 | |
| 33 enum WallpaperResolution { | |
| 34 LARGE, | |
| 35 SMALL | |
| 36 }; | |
| 37 | |
| 38 const SkColor kLoginWallpaperColor = 0xFEFEFE; | |
| 39 | |
| 40 // Encapsulates wallpaper infomation needed by desktop background controller. | |
| 41 struct ASH_EXPORT WallpaperInfo { | |
| 42 int idr; | |
| 43 WallpaperLayout layout; | |
| 44 }; | |
| 45 | |
| 46 ASH_EXPORT extern const WallpaperInfo kDefaultLargeWallpaper; | |
| 47 ASH_EXPORT extern const WallpaperInfo kDefaultSmallWallpaper; | |
| 48 ASH_EXPORT extern const WallpaperInfo kGuestLargeWallpaper; | |
| 49 ASH_EXPORT extern const WallpaperInfo kGuestSmallWallpaper; | |
| 50 | |
| 27 // The width and height of small/large resolution wallpaper. When screen size is | 51 // The width and height of small/large resolution wallpaper. When screen size is |
| 28 // smaller than |kSmallWallpaperMaxWidth| and |kSmallWallpaperMaxHeight|, the | 52 // smaller than |kSmallWallpaperMaxWidth| and |kSmallWallpaperMaxHeight|, the |
| 29 // small resolution wallpaper should be used. Otherwise, uses the large | 53 // small resolution wallpaper should be used. Otherwise, uses the large |
| 30 // resolution wallpaper. | 54 // resolution wallpaper. |
| 31 ASH_EXPORT extern const int kSmallWallpaperMaxWidth; | 55 ASH_EXPORT extern const int kSmallWallpaperMaxWidth; |
| 32 ASH_EXPORT extern const int kSmallWallpaperMaxHeight; | 56 ASH_EXPORT extern const int kSmallWallpaperMaxHeight; |
| 33 ASH_EXPORT extern const int kLargeWallpaperMaxWidth; | 57 ASH_EXPORT extern const int kLargeWallpaperMaxWidth; |
| 34 ASH_EXPORT extern const int kLargeWallpaperMaxHeight; | 58 ASH_EXPORT extern const int kLargeWallpaperMaxHeight; |
| 35 | 59 |
| 36 class DesktopBackgroundControllerObserver; | 60 class DesktopBackgroundControllerObserver; |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 57 void RemoveObserver(DesktopBackgroundControllerObserver* observer); | 81 void RemoveObserver(DesktopBackgroundControllerObserver* observer); |
| 58 | 82 |
| 59 gfx::ImageSkia GetWallpaper() const; | 83 gfx::ImageSkia GetWallpaper() const; |
| 60 | 84 |
| 61 WallpaperLayout GetWallpaperLayout() const; | 85 WallpaperLayout GetWallpaperLayout() const; |
| 62 | 86 |
| 63 // Provides current image on the background, or empty gfx::ImageSkia if there | 87 // Provides current image on the background, or empty gfx::ImageSkia if there |
| 64 // is no image, e.g. background is solid color. | 88 // is no image, e.g. background is solid color. |
| 65 gfx::ImageSkia GetCurrentWallpaperImage(); | 89 gfx::ImageSkia GetCurrentWallpaperImage(); |
| 66 | 90 |
| 91 // Gets the IDR of current wallpaper. Returns -1 if current wallpaper is not | |
| 92 // a builtin wallpaper. | |
| 93 int GetWallpaperIDR() const; | |
| 94 | |
| 67 // Initialize root window's background. | 95 // Initialize root window's background. |
| 68 void OnRootWindowAdded(aura::RootWindow* root_window); | 96 void OnRootWindowAdded(aura::RootWindow* root_window); |
| 69 | 97 |
| 70 // Loads default wallpaper at |index| asynchronously but does not set the | 98 // Loads builtin wallpaper asynchronously and sets to current wallpaper after |
| 71 // loaded image to current wallpaper. Resource bundle will cache the loaded | 99 // loaded. |
| 72 // image. | 100 void SetDefaultWallpaper(WallpaperInfo info); |
|
sky
2012/11/19 22:21:19
const WallpaperInfo&
bshe
2012/11/20 00:33:59
Done.
| |
| 73 void CacheDefaultWallpaper(int index); | |
| 74 | |
| 75 // Loads default wallpaper at |index| asynchronously and sets to current | |
| 76 // wallpaper after loaded. | |
| 77 void SetDefaultWallpaper(int index); | |
| 78 | |
| 79 // Forces to reload the current default wallpaper. A different resolution | |
| 80 // wallpaper maybe loaded. | |
| 81 void ReloadDefaultWallpaper(); | |
| 82 | 101 |
| 83 // Sets the user selected custom wallpaper. Called when user selected a file | 102 // Sets the user selected custom wallpaper. Called when user selected a file |
| 84 // from file system or changed the layout of wallpaper. | 103 // from file system or changed the layout of wallpaper. |
| 85 void SetCustomWallpaper(const gfx::ImageSkia& wallpaper, | 104 void SetCustomWallpaper(const gfx::ImageSkia& wallpaper, |
| 86 WallpaperLayout layout); | 105 WallpaperLayout layout); |
| 87 | 106 |
| 88 // Cancels the current wallpaper loading operation. | 107 // Cancels the current wallpaper loading operation. |
| 89 void CancelPendingWallpaperOperation(); | 108 void CancelPendingWallpaperOperation(); |
| 90 | 109 |
| 91 // Sets the desktop background to solid color mode and creates a solid | 110 // Sets the desktop background to solid color mode and creates a solid |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 166 scoped_refptr<WallpaperOperation> wallpaper_op_; | 185 scoped_refptr<WallpaperOperation> wallpaper_op_; |
| 167 | 186 |
| 168 base::WeakPtrFactory<DesktopBackgroundController> weak_ptr_factory_; | 187 base::WeakPtrFactory<DesktopBackgroundController> weak_ptr_factory_; |
| 169 | 188 |
| 170 DISALLOW_COPY_AND_ASSIGN(DesktopBackgroundController); | 189 DISALLOW_COPY_AND_ASSIGN(DesktopBackgroundController); |
| 171 }; | 190 }; |
| 172 | 191 |
| 173 } // namespace ash | 192 } // namespace ash |
| 174 | 193 |
| 175 #endif // ASH_DESKTOP_BACKGROUND_DESKTOP_BACKGROUND_CONTROLLER_H_ | 194 #endif // ASH_DESKTOP_BACKGROUND_DESKTOP_BACKGROUND_CONTROLLER_H_ |
| OLD | NEW |