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

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..12f3b72b049d637f3fa9a88a2ac15eb4c6312eba 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,25 @@ chrome.app.runtime.onLaunched.addListener(function() {
});
});
+enableSync(
+ function() {
+ chrome.syncFileSystem.onFileStatusChanged.addListener(function(detail) {
+ Constants.WallpaperLocalStorage.get(Constants.AccessLocalWallpaperInfoKey,
+ function(items) {
+ var localData = items[Constants.AccessLocalWallpaperInfoKey];
+ if (localData &&
+ localData.source == Constants.WallpaperSourceEnum.Custom)
+ setWallpaperByName(localData.url, localData.layout);
bshe 2014/09/24 17:07:05 I think we should only set wallpaper if detail.st
Ran 2014/09/26 17:34:53 Done.
+ });
+ });
+});
+
+var globalSyncFs;
chrome.storage.onChanged.addListener(function(changes, namespace) {
+ enableSync(function() {
+ //active syncFileSystem
+ chrome.syncFileSystem.requestFileSystem(function(fs) {globalSyncFs = fs;});
bshe 2014/09/24 17:07:05 We dont want to requestFileSystem each time storag
Ran 2014/09/26 17:34:53 Done.
+ });
if (changes[Constants.AccessSurpriseMeEnabledKey]) {
if (changes[Constants.AccessSurpriseMeEnabledKey].newValue) {
SurpriseWallpaper.getInstance().next();
@@ -264,6 +282,9 @@ chrome.storage.onChanged.addListener(function(changes, namespace) {
WallpaperUtil.setOnlineWallpaper(newValue.url, newValue.layout,
function() {}, function() {});
}
+ if (newValue.source == Constants.WallpaperSourceEnum.Custom) {
bshe 2014/09/24 17:07:05 nit: use "else if" and move this line to previous
Ran 2014/09/26 17:34:53 Done.
+ setWallpaperByName(newValue.url, newValue.layout);
+ }
WallpaperUtil.saveToStorage(Constants.AccessLocalWallpaperInfoKey,
newValue, false);
}

Powered by Google App Engine
This is Rietveld 408576698