OLD | NEW |
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 /** | 5 /** |
6 * FileManager constructor. | 6 * FileManager constructor. |
7 * | 7 * |
8 * FileManager objects encapsulate the functionality of the file selector | 8 * FileManager objects encapsulate the functionality of the file selector |
9 * dialogs, as well as the full screen file manager application (though the | 9 * dialogs, as well as the full screen file manager application (though the |
10 * latter is not yet implemented). | 10 * latter is not yet implemented). |
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
512 this.refocus(); | 512 this.refocus(); |
513 | 513 |
514 this.metadataProvider_ = | 514 this.metadataProvider_ = |
515 new MetadataProvider(this.filesystem_.root.toURL()); | 515 new MetadataProvider(this.filesystem_.root.toURL()); |
516 | 516 |
517 // PyAuto tests monitor this state by polling this variable | 517 // PyAuto tests monitor this state by polling this variable |
518 this.__defineGetter__('workerInitialized_', function() { | 518 this.__defineGetter__('workerInitialized_', function() { |
519 return self.getMetadataProvider().isInitialized(); | 519 return self.getMetadataProvider().isInitialized(); |
520 }); | 520 }); |
521 | 521 |
522 this.directoryModel_.setOffline(this.isOffline()); | |
523 | |
524 if (this.dialogType_ == FileManager.DialogType.FULL_PAGE) | 522 if (this.dialogType_ == FileManager.DialogType.FULL_PAGE) |
525 this.initDataTransferOperations_(); | 523 this.initDataTransferOperations_(); |
526 | 524 |
527 this.table_.endBatchUpdates(); | 525 this.table_.endBatchUpdates(); |
528 this.grid_.endBatchUpdates(); | 526 this.grid_.endBatchUpdates(); |
529 | 527 |
530 metrics.recordInterval('Load.DOM'); | 528 metrics.recordInterval('Load.DOM'); |
531 metrics.recordInterval('Load.Total'); | 529 metrics.recordInterval('Load.Total'); |
532 }; | 530 }; |
533 | 531 |
534 FileManager.prototype.initDataTransferOperations_ = function() { | 532 FileManager.prototype.initDataTransferOperations_ = function() { |
535 this.copyManager_ = new FileCopyManager(this.filesystem_.root); | 533 this.copyManager_ = new FileCopyManager(this.filesystem_.root); |
536 this.copyManager_.addEventListener('copy-progress', | 534 this.copyManager_.addEventListener('copy-progress', |
537 this.onCopyProgress_.bind(this)); | 535 this.onCopyProgress_.bind(this)); |
538 this.copyManager_.addEventListener('copy-operation-complete', | 536 this.copyManager_.addEventListener('copy-operation-complete', |
539 this.onCopyManagerOperationComplete_.bind(this)); | 537 this.onCopyManagerOperationComplete_.bind(this)); |
540 | 538 |
541 var controller = this.fileTransferController_ = new FileTransferController( | 539 var controller = this.fileTransferController_ = new FileTransferController( |
542 this.directoryModel_.getFileList(), | 540 this.directoryModel_.getFileList(), |
543 this.directoryModel_.getFileListSelection(), | 541 this.directoryModel_.getFileListSelection(), |
544 GridItem.bind(null, this), | 542 GridItem.bind(null, this), |
545 this.copyManager_, | 543 this.copyManager_, |
546 this.directoryModel_); | 544 this.directoryModel_); |
547 controller.attachDragSource(this.table_.list); | 545 controller.attachDragSource(this.table_.list); |
548 controller.attachDropTarget(this.table_.list); | 546 controller.attachDropTarget(this.table_.list); |
549 controller.attachDragSource(this.grid_); | 547 controller.attachDragSource(this.grid_); |
550 controller.attachDropTarget(this.grid_); | 548 controller.attachDropTarget(this.grid_); |
| 549 controller.attachDropTarget(this.rootsList_, true); |
551 controller.attachCopyPasteHandlers(this.document_); | 550 controller.attachCopyPasteHandlers(this.document_); |
552 controller.addEventListener('selection-copied', | 551 controller.addEventListener('selection-copied', |
553 this.blinkSelection.bind(this)); | 552 this.blinkSelection.bind(this)); |
554 controller.addEventListener('selection-cut', | 553 controller.addEventListener('selection-cut', |
555 this.blinkSelection.bind(this)); | 554 this.blinkSelection.bind(this)); |
556 }; | 555 }; |
557 | 556 |
558 /** | 557 /** |
559 * One-time initialization of commands. | 558 * One-time initialization of commands. |
560 */ | 559 */ |
(...skipping 2047 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2608 }; | 2607 }; |
2609 | 2608 |
2610 FileManager.prototype.onOnlineOffline_ = function() { | 2609 FileManager.prototype.onOnlineOffline_ = function() { |
2611 if (this.isOffline()) { | 2610 if (this.isOffline()) { |
2612 console.log('OFFLINE'); | 2611 console.log('OFFLINE'); |
2613 this.dialogContainer_.setAttribute('offline', true); | 2612 this.dialogContainer_.setAttribute('offline', true); |
2614 } else { | 2613 } else { |
2615 console.log('ONLINE'); | 2614 console.log('ONLINE'); |
2616 this.dialogContainer_.removeAttribute('offline'); | 2615 this.dialogContainer_.removeAttribute('offline'); |
2617 } | 2616 } |
2618 this.directoryModel_.setOffline(this.isOffline()); | |
2619 }; | 2617 }; |
2620 | 2618 |
2621 FileManager.prototype.isOnGDataOffline = function() { | 2619 FileManager.prototype.isOnGDataOffline = function() { |
2622 return this.isOnGData() && this.isOffline(); | 2620 return this.isOnGData() && this.isOffline(); |
2623 }; | 2621 }; |
2624 | 2622 |
2625 FileManager.prototype.isOnReadonlyDirectory = function() { | 2623 FileManager.prototype.isOnReadonlyDirectory = function() { |
2626 return this.directoryModel_.isReadOnly(); | 2624 return this.directoryModel_.isReadOnly(); |
2627 }; | 2625 }; |
2628 | 2626 |
(...skipping 1703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4332 | 4330 |
4333 handleSplitterDragEnd: function(e) { | 4331 handleSplitterDragEnd: function(e) { |
4334 Splitter.prototype.handleSplitterDragEnd.apply(this, arguments); | 4332 Splitter.prototype.handleSplitterDragEnd.apply(this, arguments); |
4335 this.ownerDocument.documentElement.classList.remove('col-resize'); | 4333 this.ownerDocument.documentElement.classList.remove('col-resize'); |
4336 } | 4334 } |
4337 }; | 4335 }; |
4338 | 4336 |
4339 customSplitter.decorate(splitterElement); | 4337 customSplitter.decorate(splitterElement); |
4340 }; | 4338 }; |
4341 })(); | 4339 })(); |
OLD | NEW |