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 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
625 }; | 625 }; |
626 | 626 |
627 /** | 627 /** |
628 * One-time initialization of various DOM nodes. | 628 * One-time initialization of various DOM nodes. |
629 */ | 629 */ |
630 FileManager.prototype.initDom_ = function() { | 630 FileManager.prototype.initDom_ = function() { |
631 // Cache nodes we'll be manipulating. | 631 // Cache nodes we'll be manipulating. |
632 this.previewThumbnails_ = | 632 this.previewThumbnails_ = |
633 this.dialogDom_.querySelector('.preview-thumbnails'); | 633 this.dialogDom_.querySelector('.preview-thumbnails'); |
634 this.previewPanel_ = this.dialogDom_.querySelector('.preview-panel'); | 634 this.previewPanel_ = this.dialogDom_.querySelector('.preview-panel'); |
635 this.previewFilename_ = this.dialogDom_.querySelector('.preview-filename'); | |
636 this.previewSummary_ = this.dialogDom_.querySelector('.preview-summary'); | 635 this.previewSummary_ = this.dialogDom_.querySelector('.preview-summary'); |
637 this.filenameInput_ = this.dialogDom_.querySelector('.filename-input'); | 636 this.filenameInput_ = this.dialogDom_.querySelector('.filename-input'); |
638 this.taskItems_ = this.dialogDom_.querySelector('.tasks'); | 637 this.taskItems_ = this.dialogDom_.querySelector('.tasks'); |
639 this.okButton_ = this.dialogDom_.querySelector('.ok'); | 638 this.okButton_ = this.dialogDom_.querySelector('.ok'); |
640 this.cancelButton_ = this.dialogDom_.querySelector('.cancel'); | 639 this.cancelButton_ = this.dialogDom_.querySelector('.cancel'); |
641 this.deleteButton_ = this.dialogDom_.querySelector('.delete-button'); | 640 this.deleteButton_ = this.dialogDom_.querySelector('.delete-button'); |
642 this.table_ = this.dialogDom_.querySelector('.detail-table'); | 641 this.table_ = this.dialogDom_.querySelector('.detail-table'); |
643 this.grid_ = this.dialogDom_.querySelector('.thumbnail-grid'); | 642 this.grid_ = this.dialogDom_.querySelector('.thumbnail-grid'); |
644 this.spinner_ = this.dialogDom_.querySelector('.spinner'); | 643 this.spinner_ = this.dialogDom_.querySelector('.spinner'); |
645 this.showSpinner_(false); | 644 this.showSpinner_(false); |
(...skipping 30 matching lines...) Expand all Loading... | |
676 'keyup', this.onFilenameInputKeyUp_.bind(this)); | 675 'keyup', this.onFilenameInputKeyUp_.bind(this)); |
677 this.filenameInput_.addEventListener( | 676 this.filenameInput_.addEventListener( |
678 'focus', this.onFilenameInputFocus_.bind(this)); | 677 'focus', this.onFilenameInputFocus_.bind(this)); |
679 | 678 |
680 var listContainer = this.dialogDom_.querySelector('.list-container'); | 679 var listContainer = this.dialogDom_.querySelector('.list-container'); |
681 listContainer.addEventListener('keydown', this.onListKeyDown_.bind(this)); | 680 listContainer.addEventListener('keydown', this.onListKeyDown_.bind(this)); |
682 listContainer.addEventListener('keypress', this.onListKeyPress_.bind(this)); | 681 listContainer.addEventListener('keypress', this.onListKeyPress_.bind(this)); |
683 this.okButton_.addEventListener('click', this.onOk_.bind(this)); | 682 this.okButton_.addEventListener('click', this.onOk_.bind(this)); |
684 this.cancelButton_.addEventListener('click', this.onCancel_.bind(this)); | 683 this.cancelButton_.addEventListener('click', this.onCancel_.bind(this)); |
685 | 684 |
685 this.deleteButton_.addEventListener('click', | |
686 this.onDeleteButtonClick_.bind(this)); | |
687 this.deleteButton_.addEventListener('keypress', | |
688 this.onDeleteButtonKeyPress_.bind(this)); | |
689 | |
686 this.dialogDom_.querySelector('div.open-sidebar').addEventListener( | 690 this.dialogDom_.querySelector('div.open-sidebar').addEventListener( |
687 'click', this.onToggleSidebar_.bind(this)); | 691 'click', this.onToggleSidebar_.bind(this)); |
688 this.dialogDom_.querySelector('div.open-sidebar').addEventListener( | 692 this.dialogDom_.querySelector('div.open-sidebar').addEventListener( |
689 'keypress', this.onToggleSidebarPress_.bind(this)); | 693 'keypress', this.onToggleSidebarPress_.bind(this)); |
690 this.dialogDom_.querySelector('div.close-sidebar').addEventListener( | 694 this.dialogDom_.querySelector('div.close-sidebar').addEventListener( |
691 'click', this.onToggleSidebar_.bind(this)); | 695 'click', this.onToggleSidebar_.bind(this)); |
692 this.dialogDom_.querySelector('div.close-sidebar').addEventListener( | 696 this.dialogDom_.querySelector('div.close-sidebar').addEventListener( |
693 'keypress', this.onToggleSidebarPress_.bind(this)); | 697 'keypress', this.onToggleSidebarPress_.bind(this)); |
694 this.dialogContainer_ = this.dialogDom_.querySelector('.dialog-container'); | 698 this.dialogContainer_ = this.dialogDom_.querySelector('.dialog-container'); |
695 this.dialogDom_.querySelector('div.detail-view').addEventListener( | 699 this.dialogDom_.querySelector('div.detail-view').addEventListener( |
(...skipping 18 matching lines...) Expand all Loading... | |
714 }.bind(this) | 718 }.bind(this) |
715 ); | 719 ); |
716 | 720 |
717 cr.ui.ComboButton.decorate(this.taskItems_); | 721 cr.ui.ComboButton.decorate(this.taskItems_); |
718 this.taskItems_.addEventListener('select', | 722 this.taskItems_.addEventListener('select', |
719 this.onTaskItemClicked_.bind(this)); | 723 this.onTaskItemClicked_.bind(this)); |
720 | 724 |
721 this.dialogDom_.ownerDocument.defaultView.addEventListener( | 725 this.dialogDom_.ownerDocument.defaultView.addEventListener( |
722 'resize', this.onResize_.bind(this)); | 726 'resize', this.onResize_.bind(this)); |
723 | 727 |
724 var ary = this.dialogDom_.querySelectorAll('[visibleif]'); | 728 this.dialogDom_.setAttribute('type', this.dialogType_); |
dgozman
2012/04/12 11:18:14
I believe, we have a method initDialogType.
Vladislav Kaznacheev
2012/04/12 12:47:32
Done.
| |
725 for (var i = 0; i < ary.length; i++) { | 729 if (str('ASH') == '1') |
726 var expr = ary[i].getAttribute('visibleif'); | 730 this.dialogDom_.setAttribute('ash', true); |
dgozman
2012/04/12 11:18:14
true -> 'true' ?
Vladislav Kaznacheev
2012/04/12 12:47:32
Done.
| |
727 if (!eval(expr)) | |
728 ary[i].style.display = 'none'; | |
729 } | |
730 | 731 |
731 this.filePopup_ = null; | 732 this.filePopup_ = null; |
732 | 733 |
733 // Populate the static localized strings. | 734 // Populate the static localized strings. |
734 i18nTemplate.process(this.document_, localStrings.templateData); | 735 i18nTemplate.process(this.document_, localStrings.templateData); |
735 }; | 736 }; |
736 | 737 |
737 /** | 738 /** |
738 * Constructs table and grid (heavy operation). | 739 * Constructs table and grid (heavy operation). |
739 **/ | 740 **/ |
(...skipping 2556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3296 } | 3297 } |
3297 | 3298 |
3298 this.confirm.show(msg, this.deleteEntries.bind( | 3299 this.confirm.show(msg, this.deleteEntries.bind( |
3299 this, entries, true, opt_callback)); | 3300 this, entries, true, opt_callback)); |
3300 return; | 3301 return; |
3301 } | 3302 } |
3302 | 3303 |
3303 this.directoryModel_.deleteEntries(entries, opt_callback); | 3304 this.directoryModel_.deleteEntries(entries, opt_callback); |
3304 }; | 3305 }; |
3305 | 3306 |
3307 FileManager.prototype.onDeleteButtonClick_ = function() { | |
3308 this.deleteEntries(this.selection.entries); | |
3309 }, | |
3310 | |
3311 FileManager.prototype.onDeleteButtonKeyPress_ = function(event) { | |
3312 switch (util.getKeyModifiers(event) + event.keyCode) { | |
3313 case '13': // Enter | |
3314 case '32': // Space | |
3315 this.deleteEntries(this.selection.entries); | |
dgozman
2012/04/12 11:18:14
also event.preventDefault and event.stopPropagatio
Vladislav Kaznacheev
2012/04/12 12:47:32
Done.
| |
3316 break; | |
3317 } | |
3318 }, | |
3319 | |
3306 FileManager.prototype.blinkSelection = function() { | 3320 FileManager.prototype.blinkSelection = function() { |
3307 if (!this.selection || this.selection.totalCount == 0) | 3321 if (!this.selection || this.selection.totalCount == 0) |
3308 return; | 3322 return; |
3309 | 3323 |
3310 for (var i = 0; i < this.selection.entries.length; i++) { | 3324 for (var i = 0; i < this.selection.entries.length; i++) { |
3311 var selectedIndex = this.selection.indexes[i]; | 3325 var selectedIndex = this.selection.indexes[i]; |
3312 var listItem = this.currentList_.getListItemByIndex(selectedIndex); | 3326 var listItem = this.currentList_.getListItemByIndex(selectedIndex); |
3313 if (listItem) | 3327 if (listItem) |
3314 this.blinkListItem_(listItem); | 3328 this.blinkListItem_(listItem); |
3315 } | 3329 } |
(...skipping 1381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4697 | 4711 |
4698 chrome.fileBrowserPrivate.setGDataPreferences(changeInfo); | 4712 chrome.fileBrowserPrivate.setGDataPreferences(changeInfo); |
4699 | 4713 |
4700 if (oldValue) { | 4714 if (oldValue) { |
4701 event.target.removeAttribute('checked'); | 4715 event.target.removeAttribute('checked'); |
4702 } else { | 4716 } else { |
4703 event.target.setAttribute('checked', 'checked'); | 4717 event.target.setAttribute('checked', 'checked'); |
4704 } | 4718 } |
4705 }; | 4719 }; |
4706 })(); | 4720 })(); |
OLD | NEW |