Index: chrome/browser/chromeos/extensions/wallpaper_private_api.cc |
diff --git a/chrome/browser/chromeos/extensions/wallpaper_private_api.cc b/chrome/browser/chromeos/extensions/wallpaper_private_api.cc |
index 4d5f8f970ba217a1632622d81ad99701700243a7..d55d6092a878c8fb9eb617f52113a54e0c8d29b6 100644 |
--- a/chrome/browser/chromeos/extensions/wallpaper_private_api.cc |
+++ b/chrome/browser/chromeos/extensions/wallpaper_private_api.cc |
@@ -6,7 +6,6 @@ |
#include <vector> |
-#include "ash/desktop_background/desktop_background_controller.h" |
#include "ash/shell.h" |
#include "ash/wm/window_cycle_controller.h" |
#include "ash/wm/window_util.h" |
@@ -39,6 +38,25 @@ using content::BrowserThread; |
namespace { |
+// Keeps in sync (same order) with WallpaperLayout enum in header file. |
+const char* kWallpaperLayoutArrays[] = { |
+ "CENTER", |
+ "CENTER_CROPPED", |
+ "STRETCH", |
+ "TILE" |
+}; |
+ |
+const int kWallpaperLayoutCount = arraysize(kWallpaperLayoutArrays); |
+ |
+ash::WallpaperLayout GetLayoutEnum(const std::string& layout) { |
+ for (int i = 0; i < kWallpaperLayoutCount; i++) { |
+ if (layout.compare(kWallpaperLayoutArrays[i]) == 0) |
+ return static_cast<ash::WallpaperLayout>(i); |
+ } |
+ // Default to use CENTER layout. |
+ return ash::CENTER; |
+} |
+ |
class WindowStateManager; |
// static |
@@ -242,7 +260,7 @@ bool WallpaperSetWallpaperFunction::RunImpl() { |
if (!args_->GetString(1, &layout_string) || layout_string.empty()) { |
return false; |
} |
- layout_ = ash::GetLayoutEnum(layout_string); |
+ layout_ = GetLayoutEnum(layout_string); |
if (!args_->GetString(2, &url_) || url_.empty()) |
return false; |
@@ -346,7 +364,7 @@ bool WallpaperSetCustomWallpaperFunction::RunImpl() { |
if (!args_->GetString(1, &layout_string) || layout_string.empty()) { |
return false; |
} |
- layout_ = ash::GetLayoutEnum(layout_string); |
+ layout_ = GetLayoutEnum(layout_string); |
// Gets email address while at UI thread. |
email_ = chromeos::UserManager::Get()->GetLoggedInUser()->email(); |