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 // Setting the src of an img to an empty string can crash the browser, so we | 5 // Setting the src of an img to an empty string can crash the browser, so we |
6 // use an empty 1x1 gif instead. | 6 // use an empty 1x1 gif instead. |
7 | 7 |
8 /** | 8 /** |
9 * FileManager constructor. | 9 * FileManager constructor. |
10 * | 10 * |
(...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
642 }; | 642 }; |
643 | 643 |
644 /** | 644 /** |
645 * One-time initialization of various DOM nodes. | 645 * One-time initialization of various DOM nodes. |
646 */ | 646 */ |
647 FileManager.prototype.initDom_ = function() { | 647 FileManager.prototype.initDom_ = function() { |
648 // Cache nodes we'll be manipulating. | 648 // Cache nodes we'll be manipulating. |
649 this.previewThumbnails_ = | 649 this.previewThumbnails_ = |
650 this.dialogDom_.querySelector('.preview-thumbnails'); | 650 this.dialogDom_.querySelector('.preview-thumbnails'); |
651 this.previewPanel_ = this.dialogDom_.querySelector('.preview-panel'); | 651 this.previewPanel_ = this.dialogDom_.querySelector('.preview-panel'); |
652 this.previewFilename_ = this.dialogDom_.querySelector('.preview-filename'); | |
653 this.previewSummary_ = this.dialogDom_.querySelector('.preview-summary'); | 652 this.previewSummary_ = this.dialogDom_.querySelector('.preview-summary'); |
654 this.filenameInput_ = this.dialogDom_.querySelector('.filename-input'); | 653 this.filenameInput_ = this.dialogDom_.querySelector('.filename-input'); |
655 this.taskItems_ = this.dialogDom_.querySelector('.tasks'); | 654 this.taskItems_ = this.dialogDom_.querySelector('.tasks'); |
656 this.okButton_ = this.dialogDom_.querySelector('.ok'); | 655 this.okButton_ = this.dialogDom_.querySelector('.ok'); |
657 this.cancelButton_ = this.dialogDom_.querySelector('.cancel'); | 656 this.cancelButton_ = this.dialogDom_.querySelector('.cancel'); |
658 this.deleteButton_ = this.dialogDom_.querySelector('.delete-button'); | 657 this.deleteButton_ = this.dialogDom_.querySelector('.delete-button'); |
659 this.table_ = this.dialogDom_.querySelector('.detail-table'); | 658 this.table_ = this.dialogDom_.querySelector('.detail-table'); |
660 this.grid_ = this.dialogDom_.querySelector('.thumbnail-grid'); | 659 this.grid_ = this.dialogDom_.querySelector('.thumbnail-grid'); |
661 this.spinner_ = this.dialogDom_.querySelector('.spinner'); | 660 this.spinner_ = this.dialogDom_.querySelector('.spinner'); |
662 this.showSpinner_(false); | 661 this.showSpinner_(false); |
(...skipping 26 matching lines...) Expand all Loading... |
689 this.listContainer_.addEventListener( | 688 this.listContainer_.addEventListener( |
690 'keydown', this.onListKeyDown_.bind(this)); | 689 'keydown', this.onListKeyDown_.bind(this)); |
691 this.listContainer_.addEventListener( | 690 this.listContainer_.addEventListener( |
692 'keypress', this.onListKeyPress_.bind(this)); | 691 'keypress', this.onListKeyPress_.bind(this)); |
693 this.listContainer_.addEventListener( | 692 this.listContainer_.addEventListener( |
694 'mousemove', this.onListMouseMove_.bind(this)); | 693 'mousemove', this.onListMouseMove_.bind(this)); |
695 | 694 |
696 this.okButton_.addEventListener('click', this.onOk_.bind(this)); | 695 this.okButton_.addEventListener('click', this.onOk_.bind(this)); |
697 this.cancelButton_.addEventListener('click', this.onCancel_.bind(this)); | 696 this.cancelButton_.addEventListener('click', this.onCancel_.bind(this)); |
698 | 697 |
| 698 this.deleteButton_.addEventListener('click', |
| 699 this.onDeleteButtonClick_.bind(this)); |
| 700 this.deleteButton_.addEventListener('keypress', |
| 701 this.onDeleteButtonKeyPress_.bind(this)); |
| 702 |
699 this.dialogDom_.querySelector('div.open-sidebar').addEventListener( | 703 this.dialogDom_.querySelector('div.open-sidebar').addEventListener( |
700 'click', this.onToggleSidebar_.bind(this)); | 704 'click', this.onToggleSidebar_.bind(this)); |
701 this.dialogDom_.querySelector('div.open-sidebar').addEventListener( | 705 this.dialogDom_.querySelector('div.open-sidebar').addEventListener( |
702 'keypress', this.onToggleSidebarPress_.bind(this)); | 706 'keypress', this.onToggleSidebarPress_.bind(this)); |
703 this.dialogDom_.querySelector('div.close-sidebar').addEventListener( | 707 this.dialogDom_.querySelector('div.close-sidebar').addEventListener( |
704 'click', this.onToggleSidebar_.bind(this)); | 708 'click', this.onToggleSidebar_.bind(this)); |
705 this.dialogDom_.querySelector('div.close-sidebar').addEventListener( | 709 this.dialogDom_.querySelector('div.close-sidebar').addEventListener( |
706 'keypress', this.onToggleSidebarPress_.bind(this)); | 710 'keypress', this.onToggleSidebarPress_.bind(this)); |
707 this.dialogContainer_ = this.dialogDom_.querySelector('.dialog-container'); | 711 this.dialogContainer_ = this.dialogDom_.querySelector('.dialog-container'); |
708 this.dialogDom_.querySelector('div.detail-view').addEventListener( | 712 this.dialogDom_.querySelector('div.detail-view').addEventListener( |
(...skipping 18 matching lines...) Expand all Loading... |
727 }.bind(this) | 731 }.bind(this) |
728 ); | 732 ); |
729 | 733 |
730 cr.ui.ComboButton.decorate(this.taskItems_); | 734 cr.ui.ComboButton.decorate(this.taskItems_); |
731 this.taskItems_.addEventListener('select', | 735 this.taskItems_.addEventListener('select', |
732 this.onTaskItemClicked_.bind(this)); | 736 this.onTaskItemClicked_.bind(this)); |
733 | 737 |
734 this.dialogDom_.ownerDocument.defaultView.addEventListener( | 738 this.dialogDom_.ownerDocument.defaultView.addEventListener( |
735 'resize', this.onResize_.bind(this)); | 739 'resize', this.onResize_.bind(this)); |
736 | 740 |
737 var ary = this.dialogDom_.querySelectorAll('[visibleif]'); | 741 if (str('ASH') == '1') |
738 for (var i = 0; i < ary.length; i++) { | 742 this.dialogDom_.setAttribute('ash', 'true'); |
739 var expr = ary[i].getAttribute('visibleif'); | |
740 if (!eval(expr)) | |
741 ary[i].style.display = 'none'; | |
742 } | |
743 | 743 |
744 this.filePopup_ = null; | 744 this.filePopup_ = null; |
745 | 745 |
746 // Populate the static localized strings. | 746 // Populate the static localized strings. |
747 i18nTemplate.process(this.document_, localStrings.templateData); | 747 i18nTemplate.process(this.document_, localStrings.templateData); |
748 }; | 748 }; |
749 | 749 |
750 /** | 750 /** |
751 * Constructs table and grid (heavy operation). | 751 * Constructs table and grid (heavy operation). |
752 **/ | 752 **/ |
(...skipping 971 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1724 | 1724 |
1725 case FileManager.DialogType.FULL_PAGE: | 1725 case FileManager.DialogType.FULL_PAGE: |
1726 break; | 1726 break; |
1727 | 1727 |
1728 default: | 1728 default: |
1729 throw new Error('Unknown dialog type: ' + this.dialogType_); | 1729 throw new Error('Unknown dialog type: ' + this.dialogType_); |
1730 } | 1730 } |
1731 | 1731 |
1732 this.okButton_.textContent = okLabel; | 1732 this.okButton_.textContent = okLabel; |
1733 | 1733 |
1734 dialogTitle = this.params_.title || defaultTitle; | 1734 var dialogTitle = this.params_.title || defaultTitle; |
1735 this.dialogDom_.querySelector('.dialog-title').textContent = dialogTitle; | 1735 this.dialogDom_.querySelector('.dialog-title').textContent = dialogTitle; |
| 1736 |
| 1737 this.dialogDom_.setAttribute('type', this.dialogType_); |
1736 }; | 1738 }; |
1737 | 1739 |
1738 FileManager.prototype.renderCheckbox_ = function() { | 1740 FileManager.prototype.renderCheckbox_ = function() { |
1739 function stopEventPropagation(event) { | 1741 function stopEventPropagation(event) { |
1740 event.stopPropagation(); | 1742 event.stopPropagation(); |
1741 } | 1743 } |
1742 var input = this.document_.createElement('input'); | 1744 var input = this.document_.createElement('input'); |
1743 input.setAttribute('type', 'checkbox'); | 1745 input.setAttribute('type', 'checkbox'); |
1744 input.setAttribute('tabindex', -1); | 1746 input.setAttribute('tabindex', -1); |
1745 input.classList.add('common'); | 1747 input.classList.add('common'); |
(...skipping 1406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3152 } | 3154 } |
3153 | 3155 |
3154 this.confirm.show(msg, this.deleteEntries.bind( | 3156 this.confirm.show(msg, this.deleteEntries.bind( |
3155 this, entries, true, opt_callback)); | 3157 this, entries, true, opt_callback)); |
3156 return; | 3158 return; |
3157 } | 3159 } |
3158 | 3160 |
3159 this.directoryModel_.deleteEntries(entries, opt_callback); | 3161 this.directoryModel_.deleteEntries(entries, opt_callback); |
3160 }; | 3162 }; |
3161 | 3163 |
| 3164 FileManager.prototype.onDeleteButtonClick_ = function(event) { |
| 3165 this.deleteEntries(this.selection.entries); |
| 3166 event.preventDefault(); |
| 3167 event.stopPropagation(); |
| 3168 }, |
| 3169 |
| 3170 FileManager.prototype.onDeleteButtonKeyPress_ = function(event) { |
| 3171 switch (util.getKeyModifiers(event) + event.keyCode) { |
| 3172 case '13': // Enter |
| 3173 case '32': // Space |
| 3174 this.deleteEntries(this.selection.entries); |
| 3175 event.preventDefault(); |
| 3176 event.stopPropagation(); |
| 3177 break; |
| 3178 } |
| 3179 }, |
| 3180 |
3162 FileManager.prototype.blinkSelection = function() { | 3181 FileManager.prototype.blinkSelection = function() { |
3163 if (!this.selection || this.selection.totalCount == 0) | 3182 if (!this.selection || this.selection.totalCount == 0) |
3164 return; | 3183 return; |
3165 | 3184 |
3166 for (var i = 0; i < this.selection.entries.length; i++) { | 3185 for (var i = 0; i < this.selection.entries.length; i++) { |
3167 var selectedIndex = this.selection.indexes[i]; | 3186 var selectedIndex = this.selection.indexes[i]; |
3168 var listItem = this.currentList_.getListItemByIndex(selectedIndex); | 3187 var listItem = this.currentList_.getListItemByIndex(selectedIndex); |
3169 if (listItem) | 3188 if (listItem) |
3170 this.blinkListItem_(listItem); | 3189 this.blinkListItem_(listItem); |
3171 } | 3190 } |
(...skipping 1226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4398 | 4417 |
4399 chrome.fileBrowserPrivate.setGDataPreferences(changeInfo); | 4418 chrome.fileBrowserPrivate.setGDataPreferences(changeInfo); |
4400 | 4419 |
4401 if (oldValue) { | 4420 if (oldValue) { |
4402 event.target.removeAttribute('checked'); | 4421 event.target.removeAttribute('checked'); |
4403 } else { | 4422 } else { |
4404 event.target.setAttribute('checked', 'checked'); | 4423 event.target.setAttribute('checked', 'checked'); |
4405 } | 4424 } |
4406 }; | 4425 }; |
4407 })(); | 4426 })(); |
OLD | NEW |