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

Unified Diff: ash/desktop_background/desktop_background_resources.cc

Issue 10384079: Reland "Implement random wallpaper feature" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 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
« no previous file with comments | « ash/desktop_background/desktop_background_resources.h ('k') | chrome/app/generated_resources.grd » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 5b7d07fb2aead40447dc17815c752472ddb336fe..e5cf675f504c622dfa13eb0b9294e581961a68e0 100644
--- a/ash/desktop_background/desktop_background_resources.cc
+++ b/ash/desktop_background/desktop_background_resources.cc
@@ -229,12 +229,14 @@ const int kInvalidWallpaperIndex = -1;
// of the array are really hacky.
#if defined(GOOGLE_CHROME_BUILD)
const int kDefaultWallpaperIndex = 16; // IDR_AURA_WALLPAPERS_3_URBAN0
+const int kLastRandomWallpaperIndex = 19; // The first 20 are random.
const int kGuestWallpaperIndex = 26; // IDR_AURA_WALLPAPERS_5_GRADIENT6
#else
// Set default wallpaper to the grey background for faster wallpaper loading
// time in browser tests. Otherwise, some of the tests will finish before
// wallpaper loaded and cause crashes.
const int kDefaultWallpaperIndex = 6; // IDR_AURA_WALLPAPERS_5_GRADIENT5
+const int kLastRandomWallpaperIndex = 8;
const int kGuestWallpaperIndex = kDefaultWallpaperIndex;
#endif
@@ -256,6 +258,12 @@ int GetGuestWallpaperIndex() {
return std::min(kGuestWallpaperIndex, kDefaultWallpaperCount - 1);
}
+int GetRandomWallpaperIndex() {
+ DCHECK(kLastRandomWallpaperIndex < kDefaultWallpaperCount);
+ return base::RandInt(0,
+ std::min(kLastRandomWallpaperIndex, kDefaultWallpaperCount - 1));
+}
+
int GetWallpaperCount() {
return kDefaultWallpaperCount;
}
« no previous file with comments | « ash/desktop_background/desktop_background_resources.h ('k') | chrome/app/generated_resources.grd » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698