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

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

Issue 682463002: Revert "Sync wallpaper based on sync themes setting" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 d083d3f0f9126b7e7c2e7f333ed9b710c365db58..f4f50ec4c60373f328088eb56c19b405714a979a 100644
--- a/chrome/browser/resources/chromeos/wallpaper_manager/js/util.js
+++ b/chrome/browser/resources/chromeos/wallpaper_manager/js/util.js
@@ -54,6 +54,7 @@ WallpaperUtil.storeWallpaperFromSyncFSToLocalFS = function(wallpaperFileEntry) {
var storeDir = Constants.WallpaperDirNameEnum.ORIGINAL;
if (filenName.indexOf(Constants.CustomWallpaperThumbnailSuffix) != -1)
storeDir = Constants.WallpaperDirNameEnum.THUMBNAIL;
+ filenName = filenName.replace(Constants.CustomWallpaperThumbnailSuffix, '');
wallpaperFileEntry.file(function(file) {
var reader = new FileReader();
reader.onloadend = function() {
@@ -88,7 +89,7 @@ WallpaperUtil.deleteWallpaperFromSyncFS = function(wallpaperFilename) {
};
/**
- * Executes callback if experimental flag is set to true.
+ * Run experimental features.
* @param {function} callback The callback will be executed if 'isExperimental'
* flag is set to true.
*/
@@ -106,33 +107,19 @@ WallpaperUtil.enabledExperimentalFeatureCallback = function(callback) {
};
/**
- * Executes callback if sync theme is enabled.
- * @param {function} callback The callback will be executed if sync themes is
- * enabled.
- */
-WallpaperUtil.enabledSyncThemesCallback = function(callback) {
- chrome.wallpaperPrivate.getSyncSetting(function(setting) {
- if (setting.syncThemes)
- callback();
- });
-};
-
-/**
* Request a syncFileSystem handle and run callback on it.
* @param {function} callback The callback to execute after syncFileSystem
* handler is available.
*/
WallpaperUtil.requestSyncFS = function(callback) {
- WallpaperUtil.enabledSyncThemesCallback(function() {
- if (WallpaperUtil.syncFs) {
+ if (WallpaperUtil.syncFs) {
+ callback(WallpaperUtil.syncFs);
+ } else {
+ chrome.syncFileSystem.requestFileSystem(function(fs) {
+ WallpaperUtil.syncFs = fs;
callback(WallpaperUtil.syncFs);
- } else {
- chrome.syncFileSystem.requestFileSystem(function(fs) {
- WallpaperUtil.syncFs = fs;
- callback(WallpaperUtil.syncFs);
- });
- }
- });
+ });
+ }
};
/**
@@ -169,6 +156,7 @@ WallpaperUtil.onFileSystemError = function(e) {
* writing data.
*/
WallpaperUtil.writeFile = function(fileEntry, wallpaperData, writeCallback) {
+ var uint8arr = new Uint8Array(wallpaperData);
fileEntry.createWriter(function(fileWriter) {
var blob = new Blob([new Int8Array(wallpaperData)]);
fileWriter.write(blob);
@@ -288,9 +276,7 @@ WallpaperUtil.saveToStorage = function(key, value, sync, opt_callback) {
var items = {};
items[key] = value;
if (sync)
- WallpaperUtil.enabledSyncThemesCallback(function() {
- Constants.WallpaperSyncStorage.set(items, opt_callback);
- });
+ Constants.WallpaperSyncStorage.set(items, opt_callback);
else
Constants.WallpaperLocalStorage.set(items, opt_callback);
};

Powered by Google App Engine
This is Rietveld 408576698