| 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 WallpaperUtil = { | 5 var WallpaperUtil = { |
| 6 strings: null, // Object that contains all the flags | 6 strings: null, // Object that contains all the flags |
| 7 syncFs: null, // syncFileSystem handler | 7 syncFs: null, // syncFileSystem handler |
| 8 webkitFs: null // webkitFileSystem handler | 8 webkitFs: null // webkitFileSystem handler |
| 9 }; | 9 }; |
| 10 | 10 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 /** | 47 /** |
| 48 * Loads a wallpaper from sync file system and saves it and its thumbnail to | 48 * Loads a wallpaper from sync file system and saves it and its thumbnail to |
| 49 * local file system. | 49 * local file system. |
| 50 * @param {string} wallpaperFileEntry File name of wallpaper image. | 50 * @param {string} wallpaperFileEntry File name of wallpaper image. |
| 51 */ | 51 */ |
| 52 WallpaperUtil.storeWallpaperFromSyncFSToLocalFS = function(wallpaperFileEntry) { | 52 WallpaperUtil.storeWallpaperFromSyncFSToLocalFS = function(wallpaperFileEntry) { |
| 53 var filenName = wallpaperFileEntry.name; | 53 var filenName = wallpaperFileEntry.name; |
| 54 var storeDir = Constants.WallpaperDirNameEnum.ORIGINAL; | 54 var storeDir = Constants.WallpaperDirNameEnum.ORIGINAL; |
| 55 if (filenName.indexOf(Constants.CustomWallpaperThumbnailSuffix) != -1) | 55 if (filenName.indexOf(Constants.CustomWallpaperThumbnailSuffix) != -1) |
| 56 storeDir = Constants.WallpaperDirNameEnum.THUMBNAIL; | 56 storeDir = Constants.WallpaperDirNameEnum.THUMBNAIL; |
| 57 filenName = filenName.replace(Constants.CustomWallpaperThumbnailSuffix, ''); |
| 57 wallpaperFileEntry.file(function(file) { | 58 wallpaperFileEntry.file(function(file) { |
| 58 var reader = new FileReader(); | 59 var reader = new FileReader(); |
| 59 reader.onloadend = function() { | 60 reader.onloadend = function() { |
| 60 WallpaperUtil.storeWallpaperToLocalFS(filenName, reader.result, storeDir); | 61 WallpaperUtil.storeWallpaperToLocalFS(filenName, reader.result, storeDir); |
| 61 }; | 62 }; |
| 62 reader.readAsArrayBuffer(file); | 63 reader.readAsArrayBuffer(file); |
| 63 }, WallpaperUtil.onFileSystemError); | 64 }, WallpaperUtil.onFileSystemError); |
| 64 }; | 65 }; |
| 65 | 66 |
| 66 /** | 67 /** |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 * Runs chrome.test.sendMessage in test environment. Does nothing if running | 385 * Runs chrome.test.sendMessage in test environment. Does nothing if running |
| 385 * in production environment. | 386 * in production environment. |
| 386 * | 387 * |
| 387 * @param {string} message Test message to send. | 388 * @param {string} message Test message to send. |
| 388 */ | 389 */ |
| 389 WallpaperUtil.testSendMessage = function(message) { | 390 WallpaperUtil.testSendMessage = function(message) { |
| 390 var test = chrome.test || window.top.chrome.test; | 391 var test = chrome.test || window.top.chrome.test; |
| 391 if (test) | 392 if (test) |
| 392 test.sendMessage(message); | 393 test.sendMessage(message); |
| 393 }; | 394 }; |
| OLD | NEW |