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

Side by Side Diff: chrome/browser/resources/file_manager/common/js/util.js

Issue 163083002: Files.app: Show error messages for the case the source file is not exists. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed. Created 6 years, 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 'use strict'; 5 'use strict';
6 6
7 /** 7 /**
8 * Namespace for utility functions. 8 * Namespace for utility functions.
9 */ 9 */
10 var util = {}; 10 var util = {};
(...skipping 1130 matching lines...) Expand 10 before | Expand all | Expand 10 after
1141 console.warn('Converting entries to URLs is deprecated.'); 1141 console.warn('Converting entries to URLs is deprecated.');
1142 return entries.map(function(entry) { 1142 return entries.map(function(entry) {
1143 return entry.toURL(); 1143 return entry.toURL();
1144 }); 1144 });
1145 }; 1145 };
1146 1146
1147 /** 1147 /**
1148 * Converts array of URLs to an array of corresponding Entries. 1148 * Converts array of URLs to an array of corresponding Entries.
1149 * 1149 *
1150 * @param {Array.<string>} urls Input array of URLs. 1150 * @param {Array.<string>} urls Input array of URLs.
1151 * @param {function(Array.<Entry>)} callback Completion callback with array of 1151 * @param {function(Array.<Entry>, Array.<URL>)} callback Completion callback
1152 * Entries. 1152 * with array of success Entries and failure URLs.
1153 */ 1153 */
1154 util.URLsToEntries = function(urls, callback) { 1154 util.URLsToEntries = function(urls, callback) {
1155 var result = []; 1155 var result = [];
1156 var failureUrl = [];
1156 AsyncUtil.forEach( 1157 AsyncUtil.forEach(
1157 urls, 1158 urls,
1158 function(forEachCallback, url) { 1159 function(forEachCallback, url) {
1159 webkitResolveLocalFileSystemURL(url, function(entry) { 1160 webkitResolveLocalFileSystemURL(url, function(entry) {
1160 result.push(entry); 1161 result.push(entry);
1161 forEachCallback(); 1162 forEachCallback();
1162 }, function() { 1163 }, function() {
1163 // Not an error. Possibly, the file is not accessible anymore. 1164 // Not an error. Possibly, the file is not accessible anymore.
1164 console.warn('Failed to resolve the file with url: ' + url + '.'); 1165 console.warn('Failed to resolve the file with url: ' + url + '.');
1166 failureUrl.push(url);
1165 forEachCallback(); 1167 forEachCallback();
1166 }); 1168 });
1167 }, 1169 },
1168 function() { 1170 callback.bind(null, result, failureUrl));
1169 callback(result);
1170 });
1171 }; 1171 };
1172 1172
1173 /** 1173 /**
1174 * Returns whether the window is teleported or not. 1174 * Returns whether the window is teleported or not.
1175 * @param {DOMWindow} window Window. 1175 * @param {DOMWindow} window Window.
1176 * @return {Promise.<boolean>} Whether the window is teleported or not. 1176 * @return {Promise.<boolean>} Whether the window is teleported or not.
1177 */ 1177 */
1178 util.isTeleported = function(window) { 1178 util.isTeleported = function(window) {
1179 return new Promise(function(onFulfilled) { 1179 return new Promise(function(onFulfilled) {
1180 window.chrome.fileBrowserPrivate.getProfiles(function(profiles, 1180 window.chrome.fileBrowserPrivate.getProfiles(function(profiles,
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
1240 * @enum {string} 1240 * @enum {string}
1241 * @const 1241 * @const
1242 */ 1242 */
1243 util.VolumeType = Object.freeze({ 1243 util.VolumeType = Object.freeze({
1244 DRIVE: 'drive', 1244 DRIVE: 'drive',
1245 DOWNLOADS: 'downloads', 1245 DOWNLOADS: 'downloads',
1246 REMOVABLE: 'removable', 1246 REMOVABLE: 'removable',
1247 ARCHIVE: 'archive', 1247 ARCHIVE: 'archive',
1248 CLOUD_DEVICE: 'cloud_device' 1248 CLOUD_DEVICE: 'cloud_device'
1249 }); 1249 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698