summaryrefslogtreecommitdiffstats
path: root/ash/desktop_background
diff options
context:
space:
mode:
authorbshe@chromium.org <bshe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-24 02:05:55 +0000
committerbshe@chromium.org <bshe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-24 02:05:55 +0000
commit6e8ac9af5c73f256555d2e3b2782ad82e44350c9 (patch)
tree52ac65bea38c7210d52b9966c1a4bd2891d2fe9f /ash/desktop_background
parent3341c653947c5343c74b5f4b3987dffdd11b1532 (diff)
downloadchromium_src-6e8ac9af5c73f256555d2e3b2782ad82e44350c9.zip
chromium_src-6e8ac9af5c73f256555d2e3b2782ad82e44350c9.tar.gz
chromium_src-6e8ac9af5c73f256555d2e3b2782ad82e44350c9.tar.bz2
Replace the index mapping of wallpaper picker UI and hard coded wallpaper index in C++
In this CL, we replace the old index system with a smarter one. Its basically the same index system used for default user profile images. BUG=124035 TEST= Review URL: http://codereview.chromium.org/10021066 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@133602 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/desktop_background')
-rw-r--r--ash/desktop_background/desktop_background_resources.cc11
-rw-r--r--ash/desktop_background/desktop_background_resources.h2
2 files changed, 6 insertions, 7 deletions
diff --git a/ash/desktop_background/desktop_background_resources.cc b/ash/desktop_background/desktop_background_resources.cc
index c6f8b35..f53ac63 100644
--- a/ash/desktop_background/desktop_background_resources.cc
+++ b/ash/desktop_background/desktop_background_resources.cc
@@ -223,6 +223,7 @@ const ash::WallpaperInfo kDefaultWallpapers[] = {
};
const int kDefaultWallpaperCount = arraysize(kDefaultWallpapers);
+const int kInvalidWallpaperIndex = -1;
// TODO(saintlou): These hardcoded indexes, although checked against the size
// of the array are really hacky.
@@ -238,6 +239,10 @@ const int kGuestWallpaperIndex = kDefaultWallpaperIndex;
namespace ash {
+int GetInvalidWallpaperIndex() {
+ return kInvalidWallpaperIndex;
+}
+
int GetDefaultWallpaperIndex() {
DCHECK(kDefaultWallpaperIndex < kDefaultWallpaperCount);
return std::min(kDefaultWallpaperIndex, kDefaultWallpaperCount - 1);
@@ -258,12 +263,6 @@ const SkBitmap& GetWallpaper(int index) {
kDefaultWallpapers[index].id).ToSkBitmap();
}
-const SkBitmap& GetWallpaperThumbnail(int index) {
- DCHECK(index >= 0 && index < kDefaultWallpaperCount);
- return *ui::ResourceBundle::GetSharedInstance().GetImageNamed(
- kDefaultWallpapers[index].thumb_id).ToSkBitmap();
-}
-
const WallpaperInfo& GetWallpaperInfo(int index) {
return kDefaultWallpapers[index];
}
diff --git a/ash/desktop_background/desktop_background_resources.h b/ash/desktop_background/desktop_background_resources.h
index 0fde38e..3812f51 100644
--- a/ash/desktop_background/desktop_background_resources.h
+++ b/ash/desktop_background/desktop_background_resources.h
@@ -28,11 +28,11 @@ struct ASH_EXPORT WallpaperInfo {
const char* website;
};
+ASH_EXPORT int GetInvalidWallpaperIndex();
ASH_EXPORT int GetDefaultWallpaperIndex();
ASH_EXPORT int GetGuestWallpaperIndex();
ASH_EXPORT int GetWallpaperCount();
ASH_EXPORT const SkBitmap& GetWallpaper(int index);
-ASH_EXPORT const SkBitmap& GetWallpaperThumbnail(int index);
ASH_EXPORT const WallpaperInfo& GetWallpaperInfo(int index);
} // namespace ash