OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 'use strict'; | 5 'use strict'; |
6 | 6 |
7 /** | 7 /** |
8 * Utilities for FileOperationManager. | 8 * Utilities for FileOperationManager. |
9 */ | 9 */ |
10 var fileOperationUtil = {}; | 10 var fileOperationUtil = {}; |
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
629 if (this.cancelRequested_) { | 629 if (this.cancelRequested_) { |
630 errorCallback(new FileOperationManager.Error( | 630 errorCallback(new FileOperationManager.Error( |
631 util.FileOperationErrorType.FILESYSTEM_ERROR, | 631 util.FileOperationErrorType.FILESYSTEM_ERROR, |
632 util.createDOMError(util.FileError.ABORT_ERR))); | 632 util.createDOMError(util.FileError.ABORT_ERR))); |
633 return; | 633 return; |
634 } | 634 } |
635 progressCallback(); | 635 progressCallback(); |
636 this.processEntry_( | 636 this.processEntry_( |
637 entry, this.targetDirEntry, | 637 entry, this.targetDirEntry, |
638 function(sourceEntry, destinationEntry) { | 638 function(sourceEntry, destinationEntry) { |
639 // Finalize the entry's progress state. | 639 // Finalize the entry's progress state. |
hirono
2014/02/14 10:56:39
Could you please remove line 639 ~ 642 while you a
kinaba
2014/02/19 00:34:35
Done.
| |
640 var sourceEntryURL = sourceEntry.toURL(); | 640 var sourceEntryURL = sourceEntry.toURL(); |
641 var processedEntry = | 641 var processedEntry = |
642 this.processingEntries[index][sourceEntryURL]; | 642 this.processingEntries[index][sourceEntryURL]; |
643 | 643 |
644 // Update current source index. | 644 // Update processing bytes |
645 this.processingSourceIndex_ = index + 1; | |
646 this.processedBytes = this.calcProcessedBytes_(); | 645 this.processedBytes = this.calcProcessedBytes_(); |
hirono
2014/02/14 10:56:39
Could you please also move the line to the complet
kinaba
2014/02/19 00:34:35
Done.
| |
647 | 646 |
648 // The destination entry may be null, if the copied file got | 647 // The destination entry may be null, if the copied file got |
649 // deleted just after copying. | 648 // deleted just after copying. |
650 if (destinationEntry) { | 649 if (destinationEntry) { |
651 entryChangedCallback( | 650 entryChangedCallback( |
652 util.EntryChangedKind.CREATED, destinationEntry); | 651 util.EntryChangedKind.CREATED, destinationEntry); |
653 } | 652 } |
654 }.bind(this), | 653 }.bind(this), |
655 function(sourceEntry, size) { | 654 function(sourceEntry, size) { |
656 var sourceEntryURL = sourceEntry.toURL(); | 655 var sourceEntryURL = sourceEntry.toURL(); |
657 var processedEntry = | 656 var processedEntry = |
658 this.processingEntries[index][sourceEntryURL]; | 657 this.processingEntries[index][sourceEntryURL]; |
659 if (processedEntry) { | 658 if (processedEntry) { |
660 this.processedBytes += size - processedEntry.processedBytes; | 659 this.processedBytes += size - processedEntry.processedBytes; |
661 processedEntry.processedBytes = size; | 660 processedEntry.processedBytes = size; |
662 progressCallback(); | 661 progressCallback(); |
663 } | 662 } |
664 }.bind(this), | 663 }.bind(this), |
665 callback, | 664 function() { |
665 // Update current source index. | |
666 this.processingSourceIndex_ = index + 1; | |
667 callback(); | |
668 }.bind(this), | |
666 errorCallback); | 669 errorCallback); |
667 }, | 670 }, |
668 function() { | 671 function() { |
669 if (this.deleteAfterCopy) { | 672 if (this.deleteAfterCopy) { |
670 deleteOriginals(); | 673 deleteOriginals(); |
671 } else { | 674 } else { |
672 successCallback(); | 675 successCallback(); |
673 } | 676 } |
674 }.bind(this), | 677 }.bind(this), |
675 this); | 678 this); |
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1345 | 1348 |
1346 /** | 1349 /** |
1347 * Generates new task ID. | 1350 * Generates new task ID. |
1348 * | 1351 * |
1349 * @return {string} New task ID. | 1352 * @return {string} New task ID. |
1350 * @private | 1353 * @private |
1351 */ | 1354 */ |
1352 FileOperationManager.prototype.generateTaskId_ = function() { | 1355 FileOperationManager.prototype.generateTaskId_ = function() { |
1353 return 'file-operation-' + this.taskIdCounter_++; | 1356 return 'file-operation-' + this.taskIdCounter_++; |
1354 }; | 1357 }; |
OLD | NEW |