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

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

Issue 597503007: Sync current wallpaper (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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/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);

Powered by Google App Engine
This is Rietveld 408576698