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

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

Issue 9809021: Dragging files into external apps. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Code review fixes. Created 8 years, 9 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 | « no previous file | 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/file_manager.js
diff --git a/chrome/browser/resources/file_manager/js/file_manager.js b/chrome/browser/resources/file_manager/js/file_manager.js
index e4b697e01ed8ce12c878428cb83487552263fb39..f3f2b2b42b40b3c0c24fc963276c06ea70351685 100644
--- a/chrome/browser/resources/file_manager/js/file_manager.js
+++ b/chrome/browser/resources/file_manager/js/file_manager.js
@@ -2193,7 +2193,6 @@ FileManager.prototype = {
// (copy, paste and drag). Clipboard object closes for write after
// returning control from that handlers so they may not have
// asynchronous operations.
- // TODO(serya): Put file objects into the clipboard.
if (!this.isOnGData()) {
entry.file(function(f) {
selection.files.push(f);
@@ -3136,6 +3135,11 @@ FileManager.prototype = {
clipboard.setData('fs/sourceOnGData', this.isOnGData());
clipboard.setData('fs/directories', directories);
clipboard.setData('fs/files', files);
+
+ var files = this.selection.files;
+ for(var i = 0; i < files.length; i++) {
+ clipboard.items.add(files[i]);
+ }
}
FileManager.prototype.onCopy_ = function(event) {
@@ -3160,6 +3164,9 @@ FileManager.prototype = {
};
FileManager.prototype.onPaste_ = function(event) {
+ // Check that the data copied by ourselves.
+ if (!event.clipboardData.getData('fs/isCut'))
+ return;
event.preventDefault();
this.pasteFromClipboard_(event.clipboardData);
};
@@ -3168,9 +3175,6 @@ FileManager.prototype = {
* Queue up a file copy operation based on the current system clipboard.
*/
FileManager.prototype.pasteFromClipboard_ = function(clipboard) {
- if (!event.clipboardData.getData('fs/isCut'))
- return;
-
var operationInfo = {
isCut: clipboard.getData('fs/isCut'),
sourceDir: clipboard.getData('fs/sourceDir'),
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698