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

Side by Side Diff: chrome/browser/resources/md_history/history_list.js

Issue 2764803002: MD History: Prevent flickering of 'no search results' message (Closed)
Patch Set: Created 3 years, 9 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
« no previous file with comments | « chrome/browser/resources/md_history/history_list.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 Polymer({ 5 Polymer({
6 is: 'history-list', 6 is: 'history-list',
7 7
8 properties: { 8 properties: {
9 // The search term for the current query. Set when the query returns. 9 // The search term for the current query. Set when the query returns.
10 searchedTerm: { 10 searchedTerm: {
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 * @param {number} historyDataLength 453 * @param {number} historyDataLength
454 * @return {boolean} 454 * @return {boolean}
455 * @private 455 * @private
456 */ 456 */
457 hasResults_: function(historyDataLength) { 457 hasResults_: function(historyDataLength) {
458 return historyDataLength > 0; 458 return historyDataLength > 0;
459 }, 459 },
460 460
461 /** 461 /**
462 * @param {string} searchedTerm 462 * @param {string} searchedTerm
463 * @param {boolean} isLoading
464 * @return {string} 463 * @return {string}
465 * @private 464 * @private
466 */ 465 */
467 noResultsMessage_: function(searchedTerm, isLoading) { 466 noResultsMessage_: function(searchedTerm) {
468 if (isLoading)
469 return '';
470
471 var messageId = searchedTerm !== '' ? 'noSearchResults' : 'noResults'; 467 var messageId = searchedTerm !== '' ? 'noSearchResults' : 'noResults';
472 return loadTimeData.getString(messageId); 468 return loadTimeData.getString(messageId);
473 }, 469 },
474 470
475 /** 471 /**
476 * @param {HistoryQuery} info 472 * @param {HistoryQuery} info
477 * @param {!Array<HistoryEntry>} results 473 * @param {!Array<HistoryEntry>} results
478 * @private 474 * @private
479 */ 475 */
480 initializeResults_: function(info, results) { 476 initializeResults_: function(info, results) {
481 if (results.length == 0) 477 if (results.length == 0)
482 return; 478 return;
483 479
484 var currentDate = results[0].dateRelativeDay; 480 var currentDate = results[0].dateRelativeDay;
485 481
486 for (var i = 0; i < results.length; i++) { 482 for (var i = 0; i < results.length; i++) {
487 // Sets the default values for these fields to prevent undefined types. 483 // Sets the default values for these fields to prevent undefined types.
488 results[i].selected = false; 484 results[i].selected = false;
489 results[i].readableTimestamp = 485 results[i].readableTimestamp =
490 info.term == '' ? results[i].dateTimeOfDay : results[i].dateShort; 486 info.term == '' ? results[i].dateTimeOfDay : results[i].dateShort;
491 487
492 if (results[i].dateRelativeDay != currentDate) { 488 if (results[i].dateRelativeDay != currentDate) {
493 currentDate = results[i].dateRelativeDay; 489 currentDate = results[i].dateRelativeDay;
494 } 490 }
495 } 491 }
496 }, 492 },
497 }); 493 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/md_history/history_list.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698