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

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

Issue 10092002: Disabling copying, dasting, and dragging in open/save dialogs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed ling lines. Created 8 years, 8 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 | chrome/browser/resources/file_manager/main.html » ('j') | 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 3904c3ba6bdde75a9998ca27821e8074d1054c86..c2f205666c5a7367d03c75534007038032f13778 100644
--- a/chrome/browser/resources/file_manager/js/file_manager.js
+++ b/chrome/browser/resources/file_manager/js/file_manager.js
@@ -490,12 +490,6 @@ FileManager.prototype = {
this.initFileList_();
this.initDialogs_();
- this.copyManager_ = new FileCopyManager(this.filesystem_.root);
- this.copyManager_.addEventListener('copy-progress',
- this.onCopyProgress_.bind(this));
- this.copyManager_.addEventListener('copy-operation-complete',
- this.onCopyManagerOperationComplete_.bind(this));
-
window.addEventListener('popstate', this.onPopState_.bind(this));
window.addEventListener('unload', this.onUnload_.bind(this));
@@ -531,10 +525,6 @@ FileManager.prototype = {
chrome.fileBrowserPrivate.onFileChanged.addListener(
this.onFileChanged_.bind(this));
- // The list of callbacks to be invoked during the directory rescan after
- // all paste tasks are complete.
- this.pasteSuccessCallbacks_ = [];
-
var path = this.getPathFromUrlOrParams_();
if (path &&
DirectoryModel.getRootType(path) == DirectoryModel.RootType.GDATA) {
@@ -577,6 +567,23 @@ FileManager.prototype = {
this.directoryModel_.offline = this.isOffline();
+ if (this.dialogType_ == FileManager.DialogType.FULL_PAGE)
+ this.initDataTransferOperations_();
+
+ this.table_.endBatchUpdates();
+ this.grid_.endBatchUpdates();
+
+ metrics.recordInterval('Load.DOM');
+ metrics.recordInterval('Load.Total');
+ };
+
+ FileManager.prototype.initDataTransferOperations_ = function() {
+ this.copyManager_ = new FileCopyManager(this.filesystem_.root);
+ this.copyManager_.addEventListener('copy-progress',
+ this.onCopyProgress_.bind(this));
+ this.copyManager_.addEventListener('copy-operation-complete',
+ this.onCopyManagerOperationComplete_.bind(this));
+
var controller = this.fileTransferController_ = new FileTransferController(
this.directoryModel_.fileList,
this.directoryModel_.fileListSelection,
@@ -592,12 +599,6 @@ FileManager.prototype = {
this.blinkSelection.bind(this));
controller.addEventListener('selection-cut',
this.blinkSelection.bind(this));
-
- this.table_.endBatchUpdates();
- this.grid_.endBatchUpdates();
-
- metrics.recordInterval('Load.DOM');
- metrics.recordInterval('Load.Total');
};
/**
@@ -1213,7 +1214,8 @@ FileManager.prototype = {
return this.document_.queryCommandEnabled(commandId);
case 'paste':
- return this.fileTransferController_.queryPasteCommandEnabled();
+ return !!this.fileTransferController_ &&
+ this.fileTransferController_.queryPasteCommandEnabled();
case 'rename':
return (// Initialized to the point where we have a current directory
@@ -1437,17 +1439,6 @@ FileManager.prototype = {
clearTimeout(this.butterTimeout_);
if (this.currentButter_)
this.hideButter();
-
- self = this;
- var callback;
- while (callback = self.pasteSuccessCallbacks_.shift()) {
- try {
- callback();
- } catch (ex) {
- console.error('Caught exception while inovking callback: ' +
- callback, ex);
- }
- }
} else if (event.reason == 'ERROR') {
clearTimeout(this.butterTimeout_);
switch (event.error.reason) {
« no previous file with comments | « no previous file | chrome/browser/resources/file_manager/main.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698