OLD | NEW |
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 /** | 5 /** |
6 * @constructor | 6 * @constructor |
7 * @param {DirectoryEntry} root Root directory entry. | 7 * @param {DirectoryEntry} root Root directory entry. |
8 */ | 8 */ |
9 function FileCopyManager(root) { | 9 function FileCopyManager(root) { |
10 this.copyTasks_ = []; | 10 this.copyTasks_ = []; |
(...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
673 self.sendOperationEvent_('copied', [entry]); | 673 self.sendOperationEvent_('copied', [entry]); |
674 onCopyCompleteBase(entry, size); | 674 onCopyCompleteBase(entry, size); |
675 } | 675 } |
676 | 676 |
677 function onCopyProgress(entry, size) { | 677 function onCopyProgress(entry, size) { |
678 task.updateFileCopyProgress(entry, size); | 678 task.updateFileCopyProgress(entry, size); |
679 self.sendProgressEvent_('PROGRESS'); | 679 self.sendProgressEvent_('PROGRESS'); |
680 } | 680 } |
681 | 681 |
682 function onError(reason, data) { | 682 function onError(reason, data) { |
683 this.log_('serviceNextTaskEntry error: ' + reason + ':', data); | 683 self.log_('serviceNextTaskEntry error: ' + reason + ':', data); |
684 errorCallback(new FileCopyManager.Error(reason, data)); | 684 errorCallback(new FileCopyManager.Error(reason, data)); |
685 } | 685 } |
686 | 686 |
687 function onFilesystemCopyComplete(sourceEntry, targetEntry) { | 687 function onFilesystemCopyComplete(sourceEntry, targetEntry) { |
688 // TODO(benchan): We currently do not know the size of data being | 688 // TODO(benchan): We currently do not know the size of data being |
689 // copied by FileEntry.copyTo(), so task.completedBytes will not be | 689 // copied by FileEntry.copyTo(), so task.completedBytes will not be |
690 // increased. We will address this issue once we need to use | 690 // increased. We will address this issue once we need to use |
691 // task.completedBytes to track the progress. | 691 // task.completedBytes to track the progress. |
692 self.sendOperationEvent_('copied', [sourceEntry, targetEntry]); | 692 self.sendOperationEvent_('copied', [sourceEntry, targetEntry]); |
693 onCopyCompleteBase(targetEntry, 0); | 693 onCopyCompleteBase(targetEntry, 0); |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
936 | 936 |
937 writer.write(file); | 937 writer.write(file); |
938 } | 938 } |
939 | 939 |
940 targetEntry.createWriter(onWriterCreated, errorCallback); | 940 targetEntry.createWriter(onWriterCreated, errorCallback); |
941 } | 941 } |
942 | 942 |
943 sourceEntry.file(onSourceFileFound, errorCallback); | 943 sourceEntry.file(onSourceFileFound, errorCallback); |
944 }; | 944 }; |
945 | 945 |
OLD | NEW |