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 'use strict'; | 5 'use strict'; |
6 | 6 |
7 /** | 7 /** |
8 * This variable is checked in SelectFileDialogExtensionBrowserTest. | 8 * This variable is checked in SelectFileDialogExtensionBrowserTest. |
9 * @type {number} | 9 * @type {number} |
10 */ | 10 */ |
(...skipping 1031 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1042 if (loadTimeData.getBoolean('ASH')) | 1042 if (loadTimeData.getBoolean('ASH')) |
1043 this.dialogDom_.setAttribute('ash', 'true'); | 1043 this.dialogDom_.setAttribute('ash', 'true'); |
1044 | 1044 |
1045 this.filePopup_ = null; | 1045 this.filePopup_ = null; |
1046 | 1046 |
1047 this.searchBoxWrapper_ = | 1047 this.searchBoxWrapper_ = |
1048 this.dialogDom_.querySelector('.search-box-wrapper'); | 1048 this.dialogDom_.querySelector('.search-box-wrapper'); |
1049 this.searchBox_ = this.dialogDom_.querySelector('#search-box'); | 1049 this.searchBox_ = this.dialogDom_.querySelector('#search-box'); |
1050 this.searchBox_.addEventListener( | 1050 this.searchBox_.addEventListener( |
1051 'input', this.onSearchBoxUpdate_.bind(this)); | 1051 'input', this.onSearchBoxUpdate_.bind(this)); |
1052 this.searchBox_.addEventListener( | |
1053 'keydown', this.onSearchBoxKeyDown_.bind(this)); | |
1052 this.searchTextMeasure_ = new TextMeasure(this.searchBox_); | 1054 this.searchTextMeasure_ = new TextMeasure(this.searchBox_); |
1053 if (util.platform.newUI()) { | 1055 if (util.platform.newUI()) { |
1054 this.searchIcon_ = this.dialogDom_.querySelector('#search-icon'); | 1056 this.searchIcon_ = this.dialogDom_.querySelector('#search-icon'); |
1055 this.searchIcon_.addEventListener( | 1057 this.searchIcon_.addEventListener( |
1056 'click', | 1058 'click', |
1057 function() { this.searchBox_.focus(); }.bind(this)); | 1059 function() { this.searchBox_.focus(); }.bind(this)); |
1058 this.searchClearButton_ = | 1060 this.searchClearButton_ = |
1059 this.dialogDom_.querySelector('#search-clear-button'); | 1061 this.dialogDom_.querySelector('#search-clear-button'); |
1060 this.searchClearButton_.addEventListener( | 1062 this.searchClearButton_.addEventListener( |
1061 'click', | 1063 'click', |
(...skipping 2454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3516 | 3518 |
3517 // On drive, incremental search is not invoked since we have an auto- | 3519 // On drive, incremental search is not invoked since we have an auto- |
3518 // complete suggestion instead. | 3520 // complete suggestion instead. |
3519 return; | 3521 return; |
3520 } | 3522 } |
3521 | 3523 |
3522 this.search_(searchString); | 3524 this.search_(searchString); |
3523 }; | 3525 }; |
3524 | 3526 |
3525 /** | 3527 /** |
3528 * Handled to special key such as ESC. | |
mtomasz
2013/05/28 04:07:06
We usually start with a passive verb.
Eg. Handles
hirono
2013/05/28 04:24:26
Done.
| |
3529 * Normal text inputs should not be handled by this, should be handled by | |
mtomasz
2013/05/28 04:07:06
I think that the second line is confusing. The fir
hirono
2013/05/28 04:24:26
Done.
| |
3530 * onSearchBoxUpdate_. | |
3531 * | |
3532 * @param {Event} event The 'keydown' event. | |
mtomasz
2013/05/28 04:07:06
Without '' for consistency.
hirono
2013/05/28 04:24:26
Done.
| |
3533 * @private | |
3534 */ | |
3535 FileManager.prototype.onSearchBoxKeyDown_ = function(event) { | |
3536 // Handle only Esc key now. | |
3537 if (event.keyCode != 27) return; | |
3538 if (this.searchBox_.value) return; | |
3539 if (this.listType_ == FileManager.ListType.DETAIL) { | |
3540 this.table_.list.focus(); | |
3541 } else if (this.listType_ == FileManager.ListType.THUMBNAIL) { | |
3542 this.grid_.focus(); | |
3543 // The grid not selects its item when focused. | |
mtomasz
2013/05/28 04:07:06
not selects -> does not select
hirono
2013/05/28 04:24:26
Done.
| |
3544 if (this.grid_.dataModel.length != 0) | |
mtomasz
2013/05/28 04:07:06
Shall we do it for the table list too?
hirono
2013/05/28 04:24:26
Done.
| |
3545 this.grid_.selectionModel.selectedIndex = 0; | |
3546 } | |
3547 }; | |
3548 | |
3549 /** | |
3526 * Updates search box's CSS classes. | 3550 * Updates search box's CSS classes. |
3527 * These classes are refered from CSS. | 3551 * These classes are refered from CSS. |
3528 * | 3552 * |
3529 * @private | 3553 * @private |
3530 */ | 3554 */ |
3531 FileManager.prototype.updateSearchBoxStyles_ = function() { | 3555 FileManager.prototype.updateSearchBoxStyles_ = function() { |
3532 if (!util.platform.newUI()) | 3556 if (!util.platform.newUI()) |
3533 return; | 3557 return; |
3534 var TEXT_BOX_PADDING = 16; // in px. | 3558 var TEXT_BOX_PADDING = 16; // in px. |
3535 this.searchBoxWrapper_.classList.toggle('has-text', | 3559 this.searchBoxWrapper_.classList.toggle('has-text', |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3917 * Set the flag expressing whether the ctrl key is pressed or not. | 3941 * Set the flag expressing whether the ctrl key is pressed or not. |
3918 * @param {boolean} flag New value of the flag | 3942 * @param {boolean} flag New value of the flag |
3919 * @private | 3943 * @private |
3920 */ | 3944 */ |
3921 FileManager.prototype.setCtrlKeyPressed_ = function(flag) { | 3945 FileManager.prototype.setCtrlKeyPressed_ = function(flag) { |
3922 this.ctrlKeyPressed_ = flag; | 3946 this.ctrlKeyPressed_ = flag; |
3923 this.document_.querySelector('#drive-clear-local-cache').canExecuteChange(); | 3947 this.document_.querySelector('#drive-clear-local-cache').canExecuteChange(); |
3924 this.document_.querySelector('#drive-reload').canExecuteChange(); | 3948 this.document_.querySelector('#drive-reload').canExecuteChange(); |
3925 }; | 3949 }; |
3926 })(); | 3950 })(); |
OLD | NEW |