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

Unified 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: . 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/file_manager/js/file_copy_manager.js
diff --git a/chrome/browser/resources/file_manager/js/file_copy_manager.js b/chrome/browser/resources/file_manager/js/file_copy_manager.js
index 47db7dca05913f7080a0bfc3a7890bea720841e3..41af9268ca660a06dbd0a92c106dd54203635676 100644
--- a/chrome/browser/resources/file_manager/js/file_copy_manager.js
+++ b/chrome/browser/resources/file_manager/js/file_copy_manager.js
@@ -491,6 +491,29 @@ FileCopyManager.prototype.serviceNextTaskEntry_ = function(
var targetDirEntry = task.targetDirEntry;
var originalPath = sourceEntry.fullPath.substr(sourcePath.length + 1);
+
+ // If the source entry is GData search result, we should not use the file name
+ // we get from file entry (this will be in format
+ // resource_id.original_file_name). Instead, we should use original_file_name.
+ // Note that if the entry is GData search result, it can only be immediate
+ // child of |task.sourceDirEntry|, so originalPath should be equal to
+ // gdataSearchResult.fileName.
+ var gdataSearchResult =
+ util.getFileAndDisplayNameForGDataSearchResult(sourceEntry.fullPath);
+ if (gdataSearchResult && originalPath != gdataSearchResult.displayName) {
+ if (sourceEntry.isDirectory) {
+ // We usually register paths relative to sourceDirEntry, but since the
+ // entries for which we have to do this can only be immediate children of
+ // the source dir, registering names should be fine.
+ task.registerRename(gdataSearchResult.fileName,
+ gdataSearchResult.displayName);
+ }
+ // Registered rename paths are appended '/', so we have to change
+ // |originalPath| for directory entries too. |originalPath| won't be changed
+ // during applyRenames (at least not by applying just registered rename).
+ originalPath = gdataSearchResult.displayName;
+ }
+
originalPath = task.applyRenames(originalPath);
var targetRelativePrefix = originalPath;

Powered by Google App Engine
This is Rietveld 408576698