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

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 4319 matching lines...) Expand 10 before | Expand all | Expand 10 after
4330 event.target.setAttribute('checked', 'checked'); 4330 event.target.setAttribute('checked', 'checked');
4331 else 4331 else
4332 event.target.removeAttribute('checked'); 4332 event.target.removeAttribute('checked');
4333 4333
4334 var changeInfo = {}; 4334 var changeInfo = {};
4335 changeInfo[pref] = inverted ? !newValue : newValue; 4335 changeInfo[pref] = inverted ? !newValue : newValue;
4336 chrome.fileBrowserPrivate.setGDataPreferences(changeInfo); 4336 chrome.fileBrowserPrivate.setGDataPreferences(changeInfo);
4337 }; 4337 };
4338 4338
4339 FileManager.prototype.onSearchBoxUpdate_ = function(event) { 4339 FileManager.prototype.onSearchBoxUpdate_ = function(event) {
4340 var searchString = this.dialogDom_.querySelector('#search-box').value; 4340 var searchString = this.document_.getElementById('search-box').value;
SeRya 2012/05/15 14:08:03 var searchBox = this.document_.getElementById('sea
Oleg Eterevsky 2012/05/15 14:16:51 Why? I don't need it.
4341 if (searchString) { 4341 if (searchString) {
4342 this.directoryModel_.addFilter( 4342 this.directoryModel_.addFilter(
4343 'searchbox', 4343 'searchbox',
4344 function(e) { 4344 function(e) {
4345 return e.name.substr(0, searchString.length) == searchString; 4345 return e.name.substr(0, searchString.length) == searchString;
4346 }); 4346 });
4347
4348 this.reportEmptySearchResults_ = function() {
4349 if (this.directoryModel_.getFileList().length === 0) {
4350 var text = strf('SEARCH_NO_MATCHING_FILES', searchString);
4351 this.document_.getElementById('no-search-results').innerHTML = text;
4352 this.document_.getElementById('no-search-results').removeAttribute(
SeRya 2012/05/15 14:08:03 .hidden = false;
Oleg Eterevsky 2012/05/15 14:16:51 Done.
4353 'hidden');
4354 }
4355 }.bind(this);
4356
4357 this.directoryModel_.addEventListener(
4358 'rescan-completed', this.reportEmptySearchResults_);
SeRya 2012/05/15 14:08:03 The 'splice' event of fileList is better because i
Oleg Eterevsky 2012/05/15 14:16:51 I don't believe there is any difference.
4347 } else { 4359 } else {
4348 this.directoryModel_.removeFilter('searchbox'); 4360 this.directoryModel_.removeFilter('searchbox');
4361 this.document_.getElementById('no-search-results').setAttribute('hidden',
SeRya 2012/05/15 14:08:03 There is a setter for 'hidden'. Use ".hidden = tru
Oleg Eterevsky 2012/05/15 14:16:51 Done.
4362 'true');
4363 this.directoryModel_.removeEventListener(
4364 'rescan-completed', this.reportEmptySearchResults_);
4349 } 4365 }
4350 }; 4366 };
4351 4367
4352 FileManager.prototype.decorateSplitter = function(splitterElement) { 4368 FileManager.prototype.decorateSplitter = function(splitterElement) {
4353 var self = this; 4369 var self = this;
4354 4370
4355 var Splitter = cr.ui.Splitter; 4371 var Splitter = cr.ui.Splitter;
4356 4372
4357 var customSplitter = cr.ui.define('div'); 4373 var customSplitter = cr.ui.define('div');
4358 4374
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
4479 4495
4480 this.directoryModel_.addEventListener('scan-completed', maybeShowBanner); 4496 this.directoryModel_.addEventListener('scan-completed', maybeShowBanner);
4481 this.directoryModel_.addEventListener('rescan-completed', maybeShowBanner); 4497 this.directoryModel_.addEventListener('rescan-completed', maybeShowBanner);
4482 4498
4483 var style = this.document_.createElement('link'); 4499 var style = this.document_.createElement('link');
4484 style.rel = 'stylesheet'; 4500 style.rel = 'stylesheet';
4485 style.href = 'css/gdrive_welcome.css'; 4501 style.href = 'css/gdrive_welcome.css';
4486 this.document_.head.appendChild(style); 4502 this.document_.head.appendChild(style);
4487 }; 4503 };
4488 })(); 4504 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698