summaryrefslogtreecommitdiffstats
path: root/ash/desktop_background
diff options
context:
space:
mode:
authorbshe@chromium.org <bshe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-25 20:23:59 +0000
committerbshe@chromium.org <bshe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-25 20:23:59 +0000
commit3dca75f77445eb146a501b4fd3d10f5129910c59 (patch)
treeb5d983573b56d3aa05dd2ba9555f009ab51fe86d /ash/desktop_background
parent4d453457efc53ae1e92c84fd10f17ee09012cff9 (diff)
downloadchromium_src-3dca75f77445eb146a501b4fd3d10f5129910c59.zip
chromium_src-3dca75f77445eb146a501b4fd3d10f5129910c59.tar.gz
chromium_src-3dca75f77445eb146a501b4fd3d10f5129910c59.tar.bz2
Wallpaper manager backend APIs
BUG=118684 TEST=none Review URL: https://chromiumcodereview.appspot.com/10754014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@148400 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/desktop_background')
-rw-r--r--ash/desktop_background/desktop_background_resources.cc18
-rw-r--r--ash/desktop_background/desktop_background_resources.h3
2 files changed, 21 insertions, 0 deletions
diff --git a/ash/desktop_background/desktop_background_resources.cc b/ash/desktop_background/desktop_background_resources.cc
index 64392e5..01f7f46 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 std::string& layout) {
+ for (int i = 0; i < kWallpaperLayoutCount; i++) {
+ if (layout.compare(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);
diff --git a/ash/desktop_background/desktop_background_resources.h b/ash/desktop_background/desktop_background_resources.h
index 7c14ce6..54cdf55 100644
--- a/ash/desktop_background/desktop_background_resources.h
+++ b/ash/desktop_background/desktop_background_resources.h
@@ -5,6 +5,8 @@
#ifndef ASH_DESKTOP_BACKGROUND_DESKTOP_BACKGROUND_RESOURCES_H_
#define ASH_DESKTOP_BACKGROUND_DESKTOP_BACKGROUND_RESOURCES_H_
+#include <string>
+
#include "ash/ash_export.h"
#include "third_party/skia/include/core/SkColor.h"
@@ -32,6 +34,7 @@ const SkColor kLoginWallpaperColor = 0xFEFEFE;
ASH_EXPORT int GetDefaultWallpaperIndex();
ASH_EXPORT int GetGuestWallpaperIndex();
ASH_EXPORT int GetInvalidWallpaperIndex();
+ASH_EXPORT WallpaperLayout GetLayoutEnum(const std::string& layout);
ASH_EXPORT int GetNextWallpaperIndex(int index);
ASH_EXPORT int GetSolidColorIndex();
ASH_EXPORT int GetWallpaperCount();