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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/workspace/IsolatedFileSystem.js

Issue 2563763003: DevTools: roll closure compiler to 20161201. (Closed)
Patch Set: rebaselined Created 4 years 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 return Common.UIString('File system error: %s', error.message); 100 return Common.UIString('File system error: %s', error.message);
101 } 101 }
102 102
103 /** 103 /**
104 * @param {string} path 104 * @param {string} path
105 * @return {!Promise<?{modificationTime: !Date, size: number}>} 105 * @return {!Promise<?{modificationTime: !Date, size: number}>}
106 */ 106 */
107 getMetadata(path) { 107 getMetadata(path) {
108 var fulfill; 108 var fulfill;
109 var promise = new Promise(f => fulfill = f); 109 var promise = new Promise(f => fulfill = f);
110 this._domFileSystem.root.getFile(path, null, fileEntryLoaded, errorHandler); 110 this._domFileSystem.root.getFile(path, undefined, fileEntryLoaded, errorHand ler);
111 return promise; 111 return promise;
112 112
113 /** 113 /**
114 * @param {!FileEntry} entry 114 * @param {!FileEntry} entry
115 */ 115 */
116 function fileEntryLoaded(entry) { 116 function fileEntryLoaded(entry) {
117 entry.getMetadata(fulfill, errorHandler); 117 entry.getMetadata(fulfill, errorHandler);
118 } 118 }
119 119
120 /** 120 /**
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 * @param {string} path 221 * @param {string} path
222 * @param {?string} name 222 * @param {?string} name
223 * @param {function(?string)} callback 223 * @param {function(?string)} callback
224 */ 224 */
225 createFile(path, name, callback) { 225 createFile(path, name, callback) {
226 var newFileIndex = 1; 226 var newFileIndex = 1;
227 if (!name) 227 if (!name)
228 name = 'NewFile'; 228 name = 'NewFile';
229 var nameCandidate; 229 var nameCandidate;
230 230
231 this._domFileSystem.root.getDirectory(path, null, dirEntryLoaded.bind(this), errorHandler.bind(this)); 231 this._domFileSystem.root.getDirectory(path, undefined, dirEntryLoaded.bind(t his), errorHandler.bind(this));
232 232
233 /** 233 /**
234 * @param {!DirectoryEntry} dirEntry 234 * @param {!DirectoryEntry} dirEntry
235 * @this {Workspace.IsolatedFileSystem} 235 * @this {Workspace.IsolatedFileSystem}
236 */ 236 */
237 function dirEntryLoaded(dirEntry) { 237 function dirEntryLoaded(dirEntry) {
238 var nameCandidate = name; 238 var nameCandidate = name;
239 if (newFileIndex > 1) 239 if (newFileIndex > 1)
240 nameCandidate += newFileIndex; 240 nameCandidate += newFileIndex;
241 ++newFileIndex; 241 ++newFileIndex;
(...skipping 29 matching lines...) Expand all
271 filePath += '/' + nameCandidate; 271 filePath += '/' + nameCandidate;
272 console.error(errorMessage + ' when getting content for file \'' + (filePa th) + '\''); 272 console.error(errorMessage + ' when getting content for file \'' + (filePa th) + '\'');
273 callback(null); 273 callback(null);
274 } 274 }
275 } 275 }
276 276
277 /** 277 /**
278 * @param {string} path 278 * @param {string} path
279 */ 279 */
280 deleteFile(path) { 280 deleteFile(path) {
281 this._domFileSystem.root.getFile(path, null, fileEntryLoaded.bind(this), err orHandler.bind(this)); 281 this._domFileSystem.root.getFile(path, undefined, fileEntryLoaded.bind(this) , errorHandler.bind(this));
282 282
283 /** 283 /**
284 * @param {!FileEntry} fileEntry 284 * @param {!FileEntry} fileEntry
285 * @this {Workspace.IsolatedFileSystem} 285 * @this {Workspace.IsolatedFileSystem}
286 */ 286 */
287 function fileEntryLoaded(fileEntry) { 287 function fileEntryLoaded(fileEntry) {
288 fileEntry.remove(fileEntryRemoved, errorHandler.bind(this)); 288 fileEntry.remove(fileEntryRemoved, errorHandler.bind(this));
289 } 289 }
290 290
291 function fileEntryRemoved() { 291 function fileEntryRemoved() {
(...skipping 20 matching lines...) Expand all
312 var promise = new Promise(x => fulfill = x); 312 var promise = new Promise(x => fulfill = x);
313 this.requestFileContent(path, fulfill); 313 this.requestFileContent(path, fulfill);
314 return promise; 314 return promise;
315 } 315 }
316 316
317 /** 317 /**
318 * @param {string} path 318 * @param {string} path
319 * @param {function(?string)} callback 319 * @param {function(?string)} callback
320 */ 320 */
321 requestFileContent(path, callback) { 321 requestFileContent(path, callback) {
322 this._domFileSystem.root.getFile(path, null, fileEntryLoaded.bind(this), err orHandler.bind(this)); 322 this._domFileSystem.root.getFile(path, undefined, fileEntryLoaded.bind(this) , errorHandler.bind(this));
323 323
324 /** 324 /**
325 * @param {!FileEntry} entry 325 * @param {!FileEntry} entry
326 * @this {Workspace.IsolatedFileSystem} 326 * @this {Workspace.IsolatedFileSystem}
327 */ 327 */
328 function fileEntryLoaded(entry) { 328 function fileEntryLoaded(entry) {
329 entry.file(fileLoaded, errorHandler.bind(this)); 329 entry.file(fileLoaded, errorHandler.bind(this));
330 } 330 }
331 331
332 /** 332 /**
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 */ 420 */
421 renameFile(path, newName, callback) { 421 renameFile(path, newName, callback) {
422 newName = newName ? newName.trim() : newName; 422 newName = newName ? newName.trim() : newName;
423 if (!newName || newName.indexOf('/') !== -1) { 423 if (!newName || newName.indexOf('/') !== -1) {
424 callback(false); 424 callback(false);
425 return; 425 return;
426 } 426 }
427 var fileEntry; 427 var fileEntry;
428 var dirEntry; 428 var dirEntry;
429 429
430 this._domFileSystem.root.getFile(path, null, fileEntryLoaded.bind(this), err orHandler.bind(this)); 430 this._domFileSystem.root.getFile(path, undefined, fileEntryLoaded.bind(this) , errorHandler.bind(this));
431 431
432 /** 432 /**
433 * @param {!FileEntry} entry 433 * @param {!FileEntry} entry
434 * @this {Workspace.IsolatedFileSystem} 434 * @this {Workspace.IsolatedFileSystem}
435 */ 435 */
436 function fileEntryLoaded(entry) { 436 function fileEntryLoaded(entry) {
437 if (entry.name === newName) { 437 if (entry.name === newName) {
438 callback(false); 438 callback(false);
439 return; 439 return;
440 } 440 }
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 console.error(errorMessage + ' when reading directory \'' + dirEntry.fullP ath + '\''); 515 console.error(errorMessage + ' when reading directory \'' + dirEntry.fullP ath + '\'');
516 callback([]); 516 callback([]);
517 } 517 }
518 } 518 }
519 519
520 /** 520 /**
521 * @param {string} path 521 * @param {string} path
522 * @param {function(!Array.<!FileEntry>)} callback 522 * @param {function(!Array.<!FileEntry>)} callback
523 */ 523 */
524 _requestEntries(path, callback) { 524 _requestEntries(path, callback) {
525 this._domFileSystem.root.getDirectory(path, null, innerCallback.bind(this), errorHandler); 525 this._domFileSystem.root.getDirectory(path, undefined, innerCallback.bind(th is), errorHandler);
526 526
527 /** 527 /**
528 * @param {!DirectoryEntry} dirEntry 528 * @param {!DirectoryEntry} dirEntry
529 * @this {Workspace.IsolatedFileSystem} 529 * @this {Workspace.IsolatedFileSystem}
530 */ 530 */
531 function innerCallback(dirEntry) { 531 function innerCallback(dirEntry) {
532 this._readDirectory(dirEntry, callback); 532 this._readDirectory(dirEntry, callback);
533 } 533 }
534 534
535 function errorHandler(error) { 535 function errorHandler(error) {
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
618 */ 618 */
619 indexContent(progress) { 619 indexContent(progress) {
620 progress.setTotalWork(1); 620 progress.setTotalWork(1);
621 var requestId = this._manager.registerProgress(progress); 621 var requestId = this._manager.registerProgress(progress);
622 InspectorFrontendHost.indexPath(requestId, this._embedderPath); 622 InspectorFrontendHost.indexPath(requestId, this._embedderPath);
623 } 623 }
624 }; 624 };
625 625
626 Workspace.IsolatedFileSystem.ImageExtensions = 626 Workspace.IsolatedFileSystem.ImageExtensions =
627 new Set(['jpeg', 'jpg', 'svg', 'gif', 'webp', 'png', 'ico', 'tiff', 'tif', ' bmp']); 627 new Set(['jpeg', 'jpg', 'svg', 'gif', 'webp', 'png', 'ico', 'tiff', 'tif', ' bmp']);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698