OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // WK Bug 55728 is fixed on the chrome 12 branch but not on the trunk. | 5 // WK Bug 55728 is fixed on the chrome 12 branch but not on the trunk. |
6 // TODO(rginda): Enable this everywhere once we have a trunk-worthy fix. | 6 // TODO(rginda): Enable this everywhere once we have a trunk-worthy fix. |
7 const ENABLE_METADATA = true; | 7 const ENABLE_METADATA = true; |
8 | 8 |
9 // Thumbnail view is painful without the exif reader. | 9 // Thumbnail view is painful without the exif reader. |
10 const ENABLE_THUMBNAIL_VIEW = ENABLE_METADATA; | 10 const ENABLE_THUMBNAIL_VIEW = ENABLE_METADATA; |
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
560 FileManager.prototype.updateCommands_ = function() { | 560 FileManager.prototype.updateCommands_ = function() { |
561 this.commands_['rename'].canExecuteChange(); | 561 this.commands_['rename'].canExecuteChange(); |
562 this.commands_['delete'].canExecuteChange(); | 562 this.commands_['delete'].canExecuteChange(); |
563 }; | 563 }; |
564 | 564 |
565 /** | 565 /** |
566 * Invoked to decide whether the "rename" command can be executed. | 566 * Invoked to decide whether the "rename" command can be executed. |
567 */ | 567 */ |
568 FileManager.prototype.onRenameCanExecute_ = function(event) { | 568 FileManager.prototype.onRenameCanExecute_ = function(event) { |
569 event.canExecute = | 569 event.canExecute = |
570 (// Full page mode. | 570 (// Rename not in progress. |
571 this.dialogType_ == FileManager.DialogType.FULL_PAGE && | |
572 // Rename not in progress. | |
573 !this.renameInput_.currentEntry && | 571 !this.renameInput_.currentEntry && |
574 // Not in root directory. | 572 // Not in root directory. |
575 this.currentDirEntry_.fullPath != '/' && | 573 this.currentDirEntry_.fullPath != '/' && |
576 // Not in media directory. | 574 // Not in media directory. |
577 this.currentDirEntry_.fullPath != MEDIA_DIRECTORY && | 575 this.currentDirEntry_.fullPath != MEDIA_DIRECTORY && |
578 // Only one file selected. | 576 // Only one file selected. |
579 this.selection.totalCount == 1); | 577 this.selection.totalCount == 1); |
580 }; | 578 }; |
581 | 579 |
582 /** | 580 /** |
583 * Invoked to decide whether the "delete" command can be executed. | 581 * Invoked to decide whether the "delete" command can be executed. |
584 */ | 582 */ |
585 FileManager.prototype.onDeleteCanExecute_ = function(event) { | 583 FileManager.prototype.onDeleteCanExecute_ = function(event) { |
586 event.canExecute = | 584 event.canExecute = |
587 (// Full page mode. | 585 (// Rename not in progress. |
588 this.dialogType_ == FileManager.DialogType.FULL_PAGE && | |
589 // Rename not in progress. | |
590 !this.renameInput_.currentEntry && | 586 !this.renameInput_.currentEntry && |
591 // Not in root directory. | 587 // Not in root directory. |
592 this.currentDirEntry_.fullPath != '/' && | 588 this.currentDirEntry_.fullPath != '/' && |
593 // Not in media directory. | 589 // Not in media directory. |
594 this.currentDirEntry_.fullPath != MEDIA_DIRECTORY); | 590 this.currentDirEntry_.fullPath != MEDIA_DIRECTORY); |
595 }; | 591 }; |
596 | 592 |
597 FileManager.prototype.setListType = function(type) { | 593 FileManager.prototype.setListType = function(type) { |
598 if (type && type == this.listType_) | 594 if (type && type == this.listType_) |
599 return; | 595 return; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
634 return self.renderThumbnail_(entry); | 630 return self.renderThumbnail_(entry); |
635 }; | 631 }; |
636 | 632 |
637 this.grid_.selectionModel = new this.selectionModelClass_(); | 633 this.grid_.selectionModel = new this.selectionModelClass_(); |
638 | 634 |
639 this.grid_.addEventListener( | 635 this.grid_.addEventListener( |
640 'dblclick', this.onDetailDoubleClick_.bind(this)); | 636 'dblclick', this.onDetailDoubleClick_.bind(this)); |
641 this.grid_.selectionModel.addEventListener( | 637 this.grid_.selectionModel.addEventListener( |
642 'change', this.onSelectionChanged_.bind(this)); | 638 'change', this.onSelectionChanged_.bind(this)); |
643 | 639 |
644 if (this.dialogType_ == FileManager.DialogType.FULL_PAGE) { | 640 cr.ui.contextMenuHandler.addContextMenuProperty(this.grid_); |
645 cr.ui.contextMenuHandler.addContextMenuProperty(this.grid_); | 641 this.grid_.contextMenu = this.fileContextMenu_; |
646 this.grid_.contextMenu = this.fileContextMenu_; | |
647 } | |
648 | |
649 this.grid_.addEventListener('mousedown', | 642 this.grid_.addEventListener('mousedown', |
650 this.onGridMouseDown_.bind(this)); | 643 this.onGridMouseDown_.bind(this)); |
651 }; | 644 }; |
652 | 645 |
653 /** | 646 /** |
654 * Initialize the file list table. | 647 * Initialize the file list table. |
655 */ | 648 */ |
656 FileManager.prototype.initTable_ = function() { | 649 FileManager.prototype.initTable_ = function() { |
657 var checkWidth = this.showCheckboxes_ ? 5 : 0; | 650 var checkWidth = this.showCheckboxes_ ? 5 : 0; |
658 | 651 |
(...skipping 17 matching lines...) Expand all Loading... |
676 cr.ui.Table.decorate(this.table_); | 669 cr.ui.Table.decorate(this.table_); |
677 | 670 |
678 this.table_.selectionModel = new this.selectionModelClass_(); | 671 this.table_.selectionModel = new this.selectionModelClass_(); |
679 this.table_.columnModel = new cr.ui.table.TableColumnModel(columns); | 672 this.table_.columnModel = new cr.ui.table.TableColumnModel(columns); |
680 | 673 |
681 this.table_.addEventListener( | 674 this.table_.addEventListener( |
682 'dblclick', this.onDetailDoubleClick_.bind(this)); | 675 'dblclick', this.onDetailDoubleClick_.bind(this)); |
683 this.table_.selectionModel.addEventListener( | 676 this.table_.selectionModel.addEventListener( |
684 'change', this.onSelectionChanged_.bind(this)); | 677 'change', this.onSelectionChanged_.bind(this)); |
685 | 678 |
686 if (this.dialogType_ == FileManager.DialogType.FULL_PAGE) { | 679 cr.ui.contextMenuHandler.addContextMenuProperty(this.table_); |
687 cr.ui.contextMenuHandler.addContextMenuProperty(this.table_); | 680 this.table_.contextMenu = this.fileContextMenu_; |
688 this.table_.contextMenu = this.fileContextMenu_; | |
689 } | |
690 | 681 |
691 this.table_.addEventListener('mousedown', | 682 this.table_.addEventListener('mousedown', |
692 this.onTableMouseDown_.bind(this)); | 683 this.onTableMouseDown_.bind(this)); |
693 }; | 684 }; |
694 | 685 |
695 /** | 686 /** |
696 * Respond to a command being executed. | 687 * Respond to a command being executed. |
697 */ | 688 */ |
698 FileManager.prototype.onCommand_ = function(event) { | 689 FileManager.prototype.onCommand_ = function(event) { |
699 switch (event.command.id) { | 690 switch (event.command.id) { |
(...skipping 1436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2136 } else if (this.dialogType_ == FileManager.DialogType.SELECT_OPEN_FILE) { | 2127 } else if (this.dialogType_ == FileManager.DialogType.SELECT_OPEN_FILE) { |
2137 if (!this.selection.leadEntry.isFile) | 2128 if (!this.selection.leadEntry.isFile) |
2138 throw new Error('Selected entry is not a file!'); | 2129 throw new Error('Selected entry is not a file!'); |
2139 } | 2130 } |
2140 | 2131 |
2141 chrome.fileBrowserPrivate.selectFile(ary[0], 0); | 2132 chrome.fileBrowserPrivate.selectFile(ary[0], 0); |
2142 window.close(); | 2133 window.close(); |
2143 }; | 2134 }; |
2144 | 2135 |
2145 })(); | 2136 })(); |
OLD | NEW |