| 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 2191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2202 var rootPath = PathUtil.getRootPath(path); | 2202 var rootPath = PathUtil.getRootPath(path); |
| 2203 this.document_.title = PathUtil.getRootLabel(rootPath) + | 2203 this.document_.title = PathUtil.getRootLabel(rootPath) + |
| 2204 path.substring(rootPath.length); | 2204 path.substring(rootPath.length); |
| 2205 }; | 2205 }; |
| 2206 | 2206 |
| 2207 /** | 2207 /** |
| 2208 * Updates search box value when directory gets changed. | 2208 * Updates search box value when directory gets changed. |
| 2209 * @private | 2209 * @private |
| 2210 */ | 2210 */ |
| 2211 FileManager.prototype.updateSearchBoxOnDirChange_ = function() { | 2211 FileManager.prototype.updateSearchBoxOnDirChange_ = function() { |
| 2212 if (!this.searchBox_.disabled) | 2212 if (!this.searchBox_.disabled) { |
| 2213 this.searchBox_.value = ''; | 2213 this.searchBox_.value = ''; |
| 2214 this.updateSearchBoxClass_(); |
| 2215 } |
| 2214 }; | 2216 }; |
| 2215 | 2217 |
| 2216 /** | 2218 /** |
| 2217 * Update the gear menu. | 2219 * Update the gear menu. |
| 2218 * @private | 2220 * @private |
| 2219 */ | 2221 */ |
| 2220 FileManager.prototype.updateGearMenu_ = function() { | 2222 FileManager.prototype.updateGearMenu_ = function() { |
| 2221 var hideItemsForDrive = !this.isOnDrive(); | 2223 var hideItemsForDrive = !this.isOnDrive(); |
| 2222 this.syncButton.hidden = hideItemsForDrive; | 2224 this.syncButton.hidden = hideItemsForDrive; |
| 2223 this.hostedButton.hidden = hideItemsForDrive; | 2225 this.hostedButton.hidden = hideItemsForDrive; |
| (...skipping 1054 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3278 | 3280 |
| 3279 /** | 3281 /** |
| 3280 * Invoked when the search box is changed. | 3282 * Invoked when the search box is changed. |
| 3281 * | 3283 * |
| 3282 * @param {Event} event The 'changed' event. | 3284 * @param {Event} event The 'changed' event. |
| 3283 * @private | 3285 * @private |
| 3284 */ | 3286 */ |
| 3285 FileManager.prototype.onSearchBoxUpdate_ = function(event) { | 3287 FileManager.prototype.onSearchBoxUpdate_ = function(event) { |
| 3286 var searchString = this.searchBox_.value; | 3288 var searchString = this.searchBox_.value; |
| 3287 | 3289 |
| 3290 this.updateSearchBoxClass_(); |
| 3288 if (this.isOnDrive()) { | 3291 if (this.isOnDrive()) { |
| 3289 // When the search text is changed, finishes the search and showes back | 3292 // When the search text is changed, finishes the search and showes back |
| 3290 // the last directory by passing an empty string to | 3293 // the last directory by passing an empty string to |
| 3291 // {@code DirectoryModel.search()}. | 3294 // {@code DirectoryModel.search()}. |
| 3292 if (this.directoryModel_.isSearching() && | 3295 if (this.directoryModel_.isSearching() && |
| 3293 this.lastSearchQuery_ != searchString) { | 3296 this.lastSearchQuery_ != searchString) { |
| 3294 this.doSearch(''); | 3297 this.doSearch(''); |
| 3295 } | 3298 } |
| 3296 | 3299 |
| 3297 // On drive, incremental search is not invoked since we have an auto- | 3300 // On drive, incremental search is not invoked since we have an auto- |
| 3298 // complete suggestion instead. | 3301 // complete suggestion instead. |
| 3299 return; | 3302 return; |
| 3300 } | 3303 } |
| 3301 | 3304 |
| 3302 this.search_(searchString); | 3305 this.search_(searchString); |
| 3303 }; | 3306 }; |
| 3304 | 3307 |
| 3305 /** | 3308 /** |
| 3309 * Updates search box's CSS classes. |
| 3310 * These classes are refered from CSS. |
| 3311 * |
| 3312 * @private |
| 3313 */ |
| 3314 FileManager.prototype.updateSearchBoxClass_ = function() { |
| 3315 this.searchBox_.classList.toggle('has-text', !!this.searchBox_.value); |
| 3316 }; |
| 3317 |
| 3318 /** |
| 3306 * Search files and update the list with the search result. | 3319 * Search files and update the list with the search result. |
| 3307 * | 3320 * |
| 3308 * @param {string} searchString String to be searched with. | 3321 * @param {string} searchString String to be searched with. |
| 3309 * @private | 3322 * @private |
| 3310 */ | 3323 */ |
| 3311 FileManager.prototype.search_ = function(searchString) { | 3324 FileManager.prototype.search_ = function(searchString) { |
| 3312 var noResultsDiv = this.document_.getElementById('no-search-results'); | 3325 var noResultsDiv = this.document_.getElementById('no-search-results'); |
| 3313 | 3326 |
| 3314 var reportEmptySearchResults = function() { | 3327 var reportEmptySearchResults = function() { |
| 3315 if (this.directoryModel_.getFileList().length === 0) { | 3328 if (this.directoryModel_.getFileList().length === 0) { |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3680 * Set the flag expressing whether the ctrl key is pressed or not. | 3693 * Set the flag expressing whether the ctrl key is pressed or not. |
| 3681 * @param {boolean} flag New value of the flag | 3694 * @param {boolean} flag New value of the flag |
| 3682 * @private | 3695 * @private |
| 3683 */ | 3696 */ |
| 3684 FileManager.prototype.setCtrlKeyPressed_ = function(flag) { | 3697 FileManager.prototype.setCtrlKeyPressed_ = function(flag) { |
| 3685 this.ctrlKeyPressed_ = flag; | 3698 this.ctrlKeyPressed_ = flag; |
| 3686 this.document_.querySelector('#drive-clear-local-cache').canExecuteChange(); | 3699 this.document_.querySelector('#drive-clear-local-cache').canExecuteChange(); |
| 3687 this.document_.querySelector('#drive-reload').canExecuteChange(); | 3700 this.document_.querySelector('#drive-reload').canExecuteChange(); |
| 3688 }; | 3701 }; |
| 3689 })(); | 3702 })(); |
| OLD | NEW |