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

Unified Diff: chrome/browser/resources/chromeos/wallpaper_manager/js/util.js

Issue 14416017: Sync online wallpaper (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync wallpaper Created 7 years, 8 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: chrome/browser/resources/chromeos/wallpaper_manager/js/util.js
diff --git a/chrome/browser/resources/chromeos/wallpaper_manager/js/util.js b/chrome/browser/resources/chromeos/wallpaper_manager/js/util.js
index cb37cd0c857110256ba8d3c10f09bbd43d462102..3b4daee26e9a41b8d0df655f7f7c4dfa66a0e852 100644
--- a/chrome/browser/resources/chromeos/wallpaper_manager/js/util.js
+++ b/chrome/browser/resources/chromeos/wallpaper_manager/js/util.js
@@ -8,12 +8,16 @@ var WallpaperUtil = {};
* Saves value to local storage that associates with key.
* @param {string} key The key that associates with value.
* @param {string} value The value to save to local storage.
+ * @param {boolen} sync True if the value is saved to sync storage.
* @param {function=} opt_callback The callback on success, or on failure.
*/
-WallpaperUtil.saveToLocalStorage = function(key, value, opt_callback) {
+WallpaperUtil.saveToStorage = function(key, value, sync, opt_callback) {
var items = {};
items[key] = value;
- Constants.WallpaperLocalStorage.set(items, opt_callback);
+ if (sync)
+ Constants.WallpaperSyncStorage.set(items, opt_callback);
+ else
+ Constants.WallpaperLocalStorage.set(items, opt_callback);
};
/**
@@ -68,6 +72,13 @@ WallpaperUtil.setOnlineWallpaper = function(url, layout, onSuccess, onFailure) {
if (xhr.response != null) {
chrome.wallpaperPrivate.setWallpaper(xhr.response, layout, url,
onSuccess);
+ var wallpaperInfo = {
+ url: url,
+ layout: layout,
+ source: Constants.WallpaperSourceEnum.Online
+ };
+ WallpaperUtil.saveToStorage(Constants.AccessWallpaperInfoKey,
+ wallpaperInfo, true);
} else {
onFailure();
}

Powered by Google App Engine
This is Rietveld 408576698