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

Side by Side Diff: chrome/browser/resources/file_manager/js/file_copy_manager.js

Issue 10342010: Add gdata content search to file_manager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: some fixes Created 8 years, 7 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 function FileCopyManager(root) { 5 function FileCopyManager(root) {
6 this.copyTasks_ = []; 6 this.copyTasks_ = [];
7 this.cancelObservers_ = []; 7 this.cancelObservers_ = [];
8 this.cancelRequested_ = false; 8 this.cancelRequested_ = false;
9 this.root_ = root; 9 this.root_ = root;
10 } 10 }
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 484
485 var sourcePath = task.sourceDirEntry.fullPath; 485 var sourcePath = task.sourceDirEntry.fullPath;
486 if (sourceEntry.fullPath.substr(0, sourcePath.length) != sourcePath) { 486 if (sourceEntry.fullPath.substr(0, sourcePath.length) != sourcePath) {
487 // We found an entry in the list that is not relative to the base source 487 // We found an entry in the list that is not relative to the base source
488 // path, something is wrong. 488 // path, something is wrong.
489 return onError('UNEXPECTED_SOURCE_FILE', sourceEntry.fullPath); 489 return onError('UNEXPECTED_SOURCE_FILE', sourceEntry.fullPath);
490 } 490 }
491 491
492 var targetDirEntry = task.targetDirEntry; 492 var targetDirEntry = task.targetDirEntry;
493 var originalPath = sourceEntry.fullPath.substr(sourcePath.length + 1); 493 var originalPath = sourceEntry.fullPath.substr(sourcePath.length + 1);
494
495 // If the source entry is GData search result, we should not use the file name
496 // we get from file entry (this will be in format
497 // resource_id.original_file_name). Instead, we should use original_file_name.
498 // Note that if the entry is GData search result, it can only be imediate
dgozman 2012/05/03 11:21:47 typo: imediate
tbarzic 2012/05/03 19:16:02 Done.
499 // child of |task.sourceDirEntry|, so originalPath should be equal to
500 // gdataSearchResult.fileName.
501 var gdataSearchResult =
502 util.getFileAndDisplayNameForGDataSearchResult(sourceEntry.fullPath);
503 if (gdataSearchResult && originalPath == gdataSearchResult.fileName) {
504 if (sourceEntry.isDirectory) {
505 task.registerRename(gdataSearchResult.fileName,
dgozman 2012/05/03 11:21:47 I think, you have to register full paths here inst
tbarzic 2012/05/03 19:16:02 Don't we register paths relative to sourceDir. Sin
506 gdataSearchResult.displayName);
507 }
508 originalPath = gdataSearchResult.displayName;
dgozman 2012/05/03 11:21:47 For directory, you do: 1. register rename 2. chang
tbarzic 2012/05/03 19:16:02 registered rename paths are automatically appended
509 }
510
494 originalPath = task.applyRenames(originalPath); 511 originalPath = task.applyRenames(originalPath);
495 512
496 var targetRelativePrefix = originalPath; 513 var targetRelativePrefix = originalPath;
497 var targetExt = ''; 514 var targetExt = '';
498 var index = targetRelativePrefix.lastIndexOf('.'); 515 var index = targetRelativePrefix.lastIndexOf('.');
499 if (index != -1) { 516 if (index != -1) {
500 targetExt = targetRelativePrefix.substr(index); 517 targetExt = targetRelativePrefix.substr(index);
501 targetRelativePrefix = targetRelativePrefix.substr(0, index); 518 targetRelativePrefix = targetRelativePrefix.substr(0, index);
502 } 519 }
503 520
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 successCallback(targetEntry, file.size) 739 successCallback(targetEntry, file.size)
723 }; 740 };
724 writer.write(file); 741 writer.write(file);
725 } 742 }
726 743
727 targetEntry.createWriter(onWriterCreated, errorCallback); 744 targetEntry.createWriter(onWriterCreated, errorCallback);
728 } 745 }
729 746
730 sourceEntry.file(onSourceFileFound, errorCallback); 747 sourceEntry.file(onSourceFileFound, errorCallback);
731 }; 748 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698