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 64392e5a2cce00dba41d44f70b0bb701bbbcc5f8..f6d6a96d1e03077dcb0adf3bdc3ce429a95c677e 100644 |
--- a/ash/desktop_background/desktop_background_resources.cc |
+++ b/ash/desktop_background/desktop_background_resources.cc |
@@ -12,6 +12,14 @@ |
namespace { |
+// Keeps in sync (same order) with WallpaperLayout enum in header file. |
+const char* kWallpaperLayoutArrays[] = { |
+ "CENTER", |
+ "CENTER_CROPPED", |
+ "STRETCH", |
+ "TILE" |
+}; |
+ |
const ash::WallpaperInfo kDefaultWallpapers[] = { |
#if !defined(GOOGLE_CHROME_BUILD) |
{ |
@@ -221,6 +229,7 @@ const ash::WallpaperInfo kDefaultWallpapers[] = { |
}, |
}; |
+const int kWallpaperLayoutCount = arraysize(kWallpaperLayoutArrays); |
const int kDefaultWallpaperCount = arraysize(kDefaultWallpapers); |
const int kInvalidWallpaperIndex = -1; |
const int kSolidColorIndex = -2; |
@@ -258,6 +267,15 @@ int GetInvalidWallpaperIndex() { |
return kInvalidWallpaperIndex; |
} |
+WallpaperLayout GetLayoutEnum(const char* layout) { |
+ for (int i = 0; i < kWallpaperLayoutCount; i++) { |
+ if (strcmp(layout, kWallpaperLayoutArrays[i]) == 0) |
+ return static_cast<WallpaperLayout>(i); |
+ } |
+ // Default to use CENTER layout. |
+ return CENTER; |
+} |
+ |
int GetNextWallpaperIndex(int index) { |
DCHECK(kLastRandomWallpaperIndex < kDefaultWallpaperCount); |
return (index + 1) % (kLastRandomWallpaperIndex + 1); |