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