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

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: Fix thread violation 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..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);

Powered by Google App Engine
This is Rietveld 408576698