Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(424)

Side by Side Diff: chrome/browser/resources/file_manager/js/file_manager.js

Issue 10388142: Show the message 'No files match "abc"' if the search results are empty. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 searchStringLC = searchString.toLowerCase();
4376 var noResultsDiv = this.document_.getElementById('no-search-results');
4375 if (searchString) { 4377 if (searchString) {
4376 this.directoryModel_.addFilter( 4378 this.directoryModel_.addFilter(
4377 'searchbox', 4379 'searchbox',
4378 function(e) { 4380 function(e) {
4379 return e.name.substr(0, searchString.length) == searchString; 4381 return e.name.toLowerCase().indexOf(searchStringLC) > -1;
4380 }); 4382 });
4383
4384 this.reportEmptySearchResults_ = function() {
4385 if (this.directoryModel_.getFileList().length === 0) {
4386 var text = strf('SEARCH_NO_MATCHING_FILES', searchString);
4387 noResultsDiv.innerHTML = text;
4388 noResultsDiv.hidden = false;
4389 }
4390 }.bind(this);
4391
4392 this.directoryModel_.addEventListener(
4393 'rescan-completed', this.reportEmptySearchResults_);
4381 } else { 4394 } else {
4382 this.directoryModel_.removeFilter('searchbox'); 4395 this.directoryModel_.removeFilter('searchbox');
4396 noResultsDiv.hidden = true;
4397 this.directoryModel_.removeEventListener(
4398 'rescan-completed', this.reportEmptySearchResults_);
4383 } 4399 }
4384 }; 4400 };
4385 4401
4386 FileManager.prototype.decorateSplitter = function(splitterElement) { 4402 FileManager.prototype.decorateSplitter = function(splitterElement) {
4387 var self = this; 4403 var self = this;
4388 4404
4389 var Splitter = cr.ui.Splitter; 4405 var Splitter = cr.ui.Splitter;
4390 4406
4391 var customSplitter = cr.ui.define('div'); 4407 var customSplitter = cr.ui.define('div');
4392 4408
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
4535 4551
4536 function closeBanner() { 4552 function closeBanner() {
4537 self.cleanupGDataWelcome_(); 4553 self.cleanupGDataWelcome_();
4538 // Stop showing the welcome banner. 4554 // Stop showing the welcome banner.
4539 localStorage[WELCOME_HEADER_COUNTER_KEY] = WELCOME_HEADER_COUNTER_LIMIT; 4555 localStorage[WELCOME_HEADER_COUNTER_KEY] = WELCOME_HEADER_COUNTER_LIMIT;
4540 } 4556 }
4541 4557
4542 return maybeShowBanner; 4558 return maybeShowBanner;
4543 }; 4559 };
4544 })(); 4560 })();
OLDNEW
« no previous file with comments | « chrome/browser/resources/file_manager/css/file_manager.css ('k') | chrome/browser/resources/file_manager/js/mock_chrome.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698