| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 var WALLPAPER_PICKER_WIDTH = 574; | 5 var WALLPAPER_PICKER_WIDTH = 574; |
| 6 var WALLPAPER_PICKER_HEIGHT = 420; | 6 var WALLPAPER_PICKER_HEIGHT = 420; |
| 7 | 7 |
| 8 var wallpaperPickerWindow; | 8 var wallpaperPickerWindow; |
| 9 | 9 |
| 10 var surpriseWallpaper = null; | 10 var surpriseWallpaper = null; |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 // localData might be null on a powerwashed device. | 289 // localData might be null on a powerwashed device. |
| 290 WallpaperUtil.storeWallpaperFromSyncFSToLocalFS( | 290 WallpaperUtil.storeWallpaperFromSyncFSToLocalFS( |
| 291 detail.fileEntry); | 291 detail.fileEntry); |
| 292 } | 292 } |
| 293 }); | 293 }); |
| 294 } else if (detail.action == 'deleted') { | 294 } else if (detail.action == 'deleted') { |
| 295 var fileName = detail.fileEntry.name.replace( | 295 var fileName = detail.fileEntry.name.replace( |
| 296 Constants.CustomWallpaperThumbnailSuffix, ''); | 296 Constants.CustomWallpaperThumbnailSuffix, ''); |
| 297 WallpaperUtil.deleteWallpaperFromLocalFS(fileName); | 297 WallpaperUtil.deleteWallpaperFromLocalFS(fileName); |
| 298 } | 298 } |
| 299 } else { // detail.direction == 'local_to_remote' | |
| 300 if (detail.action == 'deleted') { | |
| 301 WallpaperUtil.deleteWallpaperFromSyncFS(detail.fileEntry.name); | |
| 302 WallpaperUtil.deleteWallpaperFromLocalFS(detail.fileEntry.name); | |
| 303 } | |
| 304 } | 299 } |
| 305 } | 300 } |
| 306 }); | 301 }); |
| 307 }); | 302 }); |
| 308 | 303 |
| 309 chrome.storage.onChanged.addListener(function(changes, namespace) { | 304 chrome.storage.onChanged.addListener(function(changes, namespace) { |
| 310 WallpaperUtil.enabledSyncThemesCallback(function(syncEnabled) { | 305 WallpaperUtil.enabledSyncThemesCallback(function(syncEnabled) { |
| 311 if (syncEnabled) { | 306 if (syncEnabled) { |
| 312 // If sync theme is enabled, use values from chrome.storage.sync to sync | 307 // If sync theme is enabled, use values from chrome.storage.sync to sync |
| 313 // wallpaper changes. | 308 // wallpaper changes. |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 424 | 419 |
| 425 // Make third party wallpaper syncable through different devices. | 420 // Make third party wallpaper syncable through different devices. |
| 426 // TODO(xdai): also sync the third party app name. | 421 // TODO(xdai): also sync the third party app name. |
| 427 var filename = Constants.ThirdPartyWallpaperPrefix + new Date().getTime(); | 422 var filename = Constants.ThirdPartyWallpaperPrefix + new Date().getTime(); |
| 428 var thumbnailFilename = filename + Constants.CustomWallpaperThumbnailSuffix; | 423 var thumbnailFilename = filename + Constants.CustomWallpaperThumbnailSuffix; |
| 429 WallpaperUtil.storeWallpaperToSyncFS(filename, wallpaper); | 424 WallpaperUtil.storeWallpaperToSyncFS(filename, wallpaper); |
| 430 WallpaperUtil.storeWallpaperToSyncFS(thumbnailFilename, thumbnail); | 425 WallpaperUtil.storeWallpaperToSyncFS(thumbnailFilename, thumbnail); |
| 431 WallpaperUtil.saveWallpaperInfo(filename, layout, | 426 WallpaperUtil.saveWallpaperInfo(filename, layout, |
| 432 Constants.WallpaperSourceEnum.Custom); | 427 Constants.WallpaperSourceEnum.Custom); |
| 433 }); | 428 }); |
| OLD | NEW |