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

Unified Diff: ash/desktop_background/desktop_background_resources.cc

Issue 10754014: Wallpaper manager backend APIs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nits Created 8 years, 5 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 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);

Powered by Google App Engine
This is Rietveld 408576698