Index: chrome/browser/resources/chromeos/wallpaper_manager/js/event_page.js |
diff --git a/chrome/browser/resources/chromeos/wallpaper_manager/js/event_page.js b/chrome/browser/resources/chromeos/wallpaper_manager/js/event_page.js |
index 62e7c59decd49a8e536d74c9435b7c28e839680a..ba513f9c820f921ecc0d332dfbac7dfc7ec11ffc 100644 |
--- a/chrome/browser/resources/chromeos/wallpaper_manager/js/event_page.js |
+++ b/chrome/browser/resources/chromeos/wallpaper_manager/js/event_page.js |
@@ -235,7 +235,29 @@ chrome.app.runtime.onLaunched.addListener(function() { |
}); |
}); |
+chrome.syncFileSystem.onFileStatusChanged.addListener(function(detail) { |
+ WallpaperUtil.enabledExperimentalFeatureCallback(function() { |
+ if (detail.status == 'synced' && |
+ detail.direction == 'remote_to_local') { |
+ if (detail.action == 'added') { |
+ Constants.WallpaperLocalStorage.get( |
+ Constants.AccessLocalWallpaperInfoKey, |
+ function(items) { |
+ var localData = items[Constants.AccessLocalWallpaperInfoKey]; |
+ if (localData && localData.url == detail.fileEntry.name && |
+ localData.source == Constants.WallpaperSourceEnum.Custom) |
+ WallpaperUtil.setSyncCustomWallpaper(localData.url, |
+ localData.layout); |
+ }); |
+ } |
+ } |
+ }); |
+}); |
+ |
chrome.storage.onChanged.addListener(function(changes, namespace) { |
+ WallpaperUtil.enabledExperimentalFeatureCallback(function() { |
+ WallpaperUtil.requestSyncFs(function() {}); |
+ }); |
if (changes[Constants.AccessSurpriseMeEnabledKey]) { |
if (changes[Constants.AccessSurpriseMeEnabledKey].newValue) { |
SurpriseWallpaper.getInstance().next(); |
@@ -263,6 +285,8 @@ chrome.storage.onChanged.addListener(function(changes, namespace) { |
// set another wallpaper before retry alarm invoked. |
WallpaperUtil.setOnlineWallpaper(newValue.url, newValue.layout, |
function() {}, function() {}); |
+ } else if (newValue.source == Constants.WallpaperSourceEnum.Custom) { |
+ WallpaperUtil.setSyncCustomWallpaper(newValue.url, newValue.layout); |
} |
WallpaperUtil.saveToStorage(Constants.AccessLocalWallpaperInfoKey, |
newValue, false); |