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..cdae1ff27728e172f0f75133bfa8944e98182fe3 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 with WallpaperLayout enum in header file. |
+const std::string kWallpaperLayoutStrings[] = { |
+ "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(kWallpaperLayoutStrings); |
const int kDefaultWallpaperCount = arraysize(kDefaultWallpapers); |
const int kInvalidWallpaperIndex = -1; |
const int kSolidColorIndex = -2; |
@@ -244,6 +253,16 @@ const int kGuestWallpaperIndex = kDefaultWallpaperIndex; |
namespace ash { |
+WallpaperLayout GetLayoutFromString(std::string layout) { |
+ |
+ for (int i = 0; i < kWallpaperLayoutCount; i++) { |
+ if (layout == kWallpaperLayoutStrings[i]) |
+ return static_cast<WallpaperLayout>(i); |
+ } |
+ // Default to use CENTER layout. |
+ return CENTER; |
+} |
+ |
int GetDefaultWallpaperIndex() { |
DCHECK(kDefaultWallpaperIndex < kDefaultWallpaperCount); |
return std::min(kDefaultWallpaperIndex, kDefaultWallpaperCount - 1); |