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

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

Issue 1631923004: Sync 3rd party wallpaper app name (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address tbarzic@'s comments. Created 4 years, 11 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 b1e402d9aa2b314772fabba9ada6cea8b290e01c..a9ca1f1c816cd91803171790dde9c459c31a8808 100644
--- a/chrome/browser/resources/chromeos/wallpaper_manager/js/util.js
+++ b/chrome/browser/resources/chromeos/wallpaper_manager/js/util.js
@@ -233,10 +233,12 @@ WallpaperUtil.storeWallpaperToLocalFS = function(wallpaperFilename,
* Sets wallpaper from synced file system.
* @param {string} wallpaperFilename File name used to set wallpaper.
* @param {string} wallpaperLayout Layout used to set wallpaper.
+ * @param {string} appName If non-empty, the current wallpaper is set by a third
tbarzic 2016/02/04 21:31:24 wdyt about changing method signature to (possibly
+ * party wallpaper. Otherwise, it is set by the built-in wallpaper picker.
* @param {function=} onSuccess Callback if set successfully.
*/
WallpaperUtil.setCustomWallpaperFromSyncFS = function(
- wallpaperFilename, wallpaperLayout, onSuccess) {
+ wallpaperFilename, wallpaperLayout, appName, onSuccess) {
var setWallpaperFromSyncCallback = function(fs) {
if (!wallpaperFilename) {
console.error('wallpaperFilename is not provided.');
@@ -259,10 +261,15 @@ WallpaperUtil.setCustomWallpaperFromSyncFS = function(
console.error(chrome.runtime.lastError.message);
return;
}
- WallpaperUtil.storeWallpaperToLocalFS(wallpaperFilename,
- reader.result, Constants.WallpaperDirNameEnum.ORIGINAL);
- WallpaperUtil.storeWallpaperToLocalFS(wallpaperFilename,
- thumbnailData, Constants.WallpaperDirNameEnum.THUMBNAIL);
+
+ // We only need to store the custom wallpaper that is set by the
+ // built-in wallpaper picker.
+ if (!appName) {
tbarzic 2016/02/04 21:31:24 This can give false positives if the wallpaper was
xdai1 2016/02/05 01:09:52 You're right. Actually on a second thought I thin
+ WallpaperUtil.storeWallpaperToLocalFS(wallpaperFilename,
+ reader.result, Constants.WallpaperDirNameEnum.ORIGINAL);
+ WallpaperUtil.storeWallpaperToLocalFS(wallpaperFilename,
+ thumbnailData, Constants.WallpaperDirNameEnum.THUMBNAIL);
+ }
if (onSuccess)
onSuccess();
});
@@ -310,12 +317,15 @@ WallpaperUtil.saveToSyncStorage = function(key, value, opt_callback) {
* the file name.
* @param {string} layout The wallpaper layout.
* @param {string} source The wallpaper source.
+ * @param {string} appName The third party app name. If the current wallpaper is
+ * set by the built-in wallpaper picker, it is set to an empty string.
*/
-WallpaperUtil.saveWallpaperInfo = function(url, layout, source) {
+WallpaperUtil.saveWallpaperInfo = function(url, layout, source, appName) {
var wallpaperInfo = {
url: url,
layout: layout,
- source: source
+ source: source,
+ appName: appName,
};
WallpaperUtil.saveToLocalStorage(Constants.AccessLocalWallpaperInfoKey,
wallpaperInfo, function() {
@@ -379,8 +389,8 @@ WallpaperUtil.setOnlineWallpaper = function(url, layout, onSuccess, onFailure) {
if (xhr.response != null) {
chrome.wallpaperPrivate.setWallpaper(xhr.response, layout, url,
onSuccess);
- self.saveWallpaperInfo(url, layout,
- Constants.WallpaperSourceEnum.Online);
+ self.saveWallpaperInfo(
+ url, layout, Constants.WallpaperSourceEnum.Online, '');
} else {
onFailure();
}

Powered by Google App Engine
This is Rietveld 408576698