| 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 /** | 5 /** |
| 6 * FileManager constructor. | 6 * FileManager constructor. |
| 7 * | 7 * |
| 8 * FileManager objects encapsulate the functionality of the file selector | 8 * FileManager objects encapsulate the functionality of the file selector |
| 9 * dialogs, as well as the full screen file manager application (though the | 9 * dialogs, as well as the full screen file manager application (though the |
| 10 * latter is not yet implemented). | 10 * latter is not yet implemented). |
| (...skipping 4354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4365 event.target.setAttribute('checked', 'checked'); | 4365 event.target.setAttribute('checked', 'checked'); |
| 4366 else | 4366 else |
| 4367 event.target.removeAttribute('checked'); | 4367 event.target.removeAttribute('checked'); |
| 4368 | 4368 |
| 4369 var changeInfo = {}; | 4369 var changeInfo = {}; |
| 4370 changeInfo[pref] = inverted ? !newValue : newValue; | 4370 changeInfo[pref] = inverted ? !newValue : newValue; |
| 4371 chrome.fileBrowserPrivate.setGDataPreferences(changeInfo); | 4371 chrome.fileBrowserPrivate.setGDataPreferences(changeInfo); |
| 4372 }; | 4372 }; |
| 4373 | 4373 |
| 4374 FileManager.prototype.onSearchBoxUpdate_ = function(event) { | 4374 FileManager.prototype.onSearchBoxUpdate_ = function(event) { |
| 4375 var searchString = this.dialogDom_.querySelector('#search-box').value; | 4375 var searchString = this.document_.getElementById('search-box').value; |
| 4376 var searchStringLC = searchString.toLowerCase(); |
| 4377 var noResultsDiv = this.document_.getElementById('no-search-results'); |
| 4376 if (searchString) { | 4378 if (searchString) { |
| 4377 this.directoryModel_.addFilter( | 4379 this.directoryModel_.addFilter( |
| 4378 'searchbox', | 4380 'searchbox', |
| 4379 function(e) { | 4381 function(e) { |
| 4380 return e.name.substr(0, searchString.length) == searchString; | 4382 return e.name.toLowerCase().indexOf(searchStringLC) > -1; |
| 4381 }); | 4383 }); |
| 4384 |
| 4385 this.reportEmptySearchResults_ = function() { |
| 4386 if (this.directoryModel_.getFileList().length === 0) { |
| 4387 var text = strf('SEARCH_NO_MATCHING_FILES', searchString); |
| 4388 noResultsDiv.innerHTML = text; |
| 4389 noResultsDiv.hidden = false; |
| 4390 } |
| 4391 }.bind(this); |
| 4392 |
| 4393 this.directoryModel_.addEventListener( |
| 4394 'rescan-completed', this.reportEmptySearchResults_); |
| 4382 } else { | 4395 } else { |
| 4383 this.directoryModel_.removeFilter('searchbox'); | 4396 this.directoryModel_.removeFilter('searchbox'); |
| 4397 noResultsDiv.hidden = true; |
| 4398 this.directoryModel_.removeEventListener( |
| 4399 'rescan-completed', this.reportEmptySearchResults_); |
| 4384 } | 4400 } |
| 4385 }; | 4401 }; |
| 4386 | 4402 |
| 4387 FileManager.prototype.decorateSplitter = function(splitterElement) { | 4403 FileManager.prototype.decorateSplitter = function(splitterElement) { |
| 4388 var self = this; | 4404 var self = this; |
| 4389 | 4405 |
| 4390 var Splitter = cr.ui.Splitter; | 4406 var Splitter = cr.ui.Splitter; |
| 4391 | 4407 |
| 4392 var customSplitter = cr.ui.define('div'); | 4408 var customSplitter = cr.ui.define('div'); |
| 4393 | 4409 |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4536 | 4552 |
| 4537 function closeBanner() { | 4553 function closeBanner() { |
| 4538 self.cleanupGDataWelcome_(); | 4554 self.cleanupGDataWelcome_(); |
| 4539 // Stop showing the welcome banner. | 4555 // Stop showing the welcome banner. |
| 4540 localStorage[WELCOME_HEADER_COUNTER_KEY] = WELCOME_HEADER_COUNTER_LIMIT; | 4556 localStorage[WELCOME_HEADER_COUNTER_KEY] = WELCOME_HEADER_COUNTER_LIMIT; |
| 4541 } | 4557 } |
| 4542 | 4558 |
| 4543 return maybeShowBanner; | 4559 return maybeShowBanner; |
| 4544 }; | 4560 }; |
| 4545 })(); | 4561 })(); |
| OLD | NEW |