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

Unified Diff: ash/desktop_background/desktop_background_resources.cc

Issue 10021066: Replace the index mapping of wallpaper picker UI and hard coded wallpaper index in C++ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add todo Created 8 years, 8 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: ash/desktop_background/desktop_background_resources.cc
diff --git a/ash/desktop_background/desktop_background_resources.cc b/ash/desktop_background/desktop_background_resources.cc
index c6f8b35deecc9cbe86b880aa2ca4448038ab69f8..9a180ff7ba997a5f77081d82b18ef3e9823548d1 100644
--- a/ash/desktop_background/desktop_background_resources.cc
+++ b/ash/desktop_background/desktop_background_resources.cc
@@ -223,6 +223,8 @@ const ash::WallpaperInfo kDefaultWallpapers[] = {
};
const int kDefaultWallpaperCount = arraysize(kDefaultWallpapers);
+// -1 reserved for random wallpaper and -2 for customized wallpaper.
+const int kInvalidWallpaperIndex = -3;
// TODO(saintlou): These hardcoded indexes, although checked against the size
// of the array are really hacky.
@@ -238,6 +240,10 @@ const int kGuestWallpaperIndex = kDefaultWallpaperIndex;
namespace ash {
+int GetInvalidWallpaperIndex() {
+ return kInvalidWallpaperIndex;
+}
+
int GetDefaultWallpaperIndex() {
DCHECK(kDefaultWallpaperIndex < kDefaultWallpaperCount);
return std::min(kDefaultWallpaperIndex, kDefaultWallpaperCount - 1);
@@ -258,12 +264,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];
}

Powered by Google App Engine
This is Rietveld 408576698