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

Unified Diff: chrome/browser/resources/file_manager/js/util.js

Issue 22150006: Re-implement cancellation of copyFileEntry_(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 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
« no previous file with comments | « chrome/browser/resources/file_manager/js/file_copy_manager.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/file_manager/js/util.js
diff --git a/chrome/browser/resources/file_manager/js/util.js b/chrome/browser/resources/file_manager/js/util.js
index aa1351634deb8c81d5fd134da00cc24b50ba17e7..2023266cf86bde7f234c7bf59a958c91303f3e2c 100644
--- a/chrome/browser/resources/file_manager/js/util.js
+++ b/chrome/browser/resources/file_manager/js/util.js
@@ -505,11 +505,7 @@ util.deduplicatePath = function(dirEntry, relativePath, onSuccess, onError) {
// Hit the limit of the number of retrial.
// Note that we cannot create FileError object directly, so here we use
// Object.create instead.
- onError(Object.create(FileError.prototype, {
- code: {
- get: function() { return FileError.PATH_EXISTS_ERR; }
- }
- }));
+ onError(util.createFileError(FileError.PATH_EXISTS_ERR));
return;
}
@@ -1167,3 +1163,16 @@ util.isFakeDirectoryEntry = function(entry) {
// Currently, fake entry doesn't support createReader.
return !('createReader' in entry);
};
+
+/**
+ * Creates a FileError instance with given code.
+ * Note that we cannot create FileError instance by "new FileError(code)",
+ * unfortunately, so here we use Object.create.
+ * @param {number} code Error code for the FileError.
+ * @return {FileError} FileError instance
+ */
+util.createFileError = function(code) {
+ return Object.create(FileError.prototype, {
+ code: { get: function() { return code; } }
+ });
+};
« no previous file with comments | « chrome/browser/resources/file_manager/js/file_copy_manager.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698