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

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

Issue 2570253002: [MD History] Fix toolbar dates in grouped mode. (Closed)
Patch Set: rebase Created 3 years, 11 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
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 // <include src="../uber/uber_utils.js"> 5 // <include src="../uber/uber_utils.js">
6 // <include src="history_focus_manager.js"> 6 // <include src="history_focus_manager.js">
7 7
8 /////////////////////////////////////////////////////////////////////////////// 8 ///////////////////////////////////////////////////////////////////////////////
9 // Globals: 9 // Globals:
10 /** @const */ var RESULTS_PER_PAGE = 150; 10 /** @const */ var RESULTS_PER_PAGE = 150;
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after
624 */ 624 */
625 HistoryModel.prototype.addResults = function(info, results) { 625 HistoryModel.prototype.addResults = function(info, results) {
626 // If no requests are in flight then this was an old request so we drop the 626 // If no requests are in flight then this was an old request so we drop the
627 // results. Double check the search term as well. 627 // results. Double check the search term as well.
628 if (!this.inFlight_ || info.term != this.searchText_) 628 if (!this.inFlight_ || info.term != this.searchText_)
629 return; 629 return;
630 630
631 $('loading-spinner').hidden = true; 631 $('loading-spinner').hidden = true;
632 this.inFlight_ = false; 632 this.inFlight_ = false;
633 this.isQueryFinished_ = info.finished; 633 this.isQueryFinished_ = info.finished;
634 this.queryStartTime = info.queryStartTime; 634 this.queryInterval = info.queryInterval;
635 this.queryEndTime = info.queryEndTime;
636 635
637 var lastVisit = this.visits_.slice(-1)[0]; 636 var lastVisit = this.visits_.slice(-1)[0];
638 var lastDay = lastVisit ? lastVisit.dateRelativeDay : null; 637 var lastDay = lastVisit ? lastVisit.dateRelativeDay : null;
639 638
640 for (var i = 0, result; result = results[i]; i++) { 639 for (var i = 0, result; result = results[i]; i++) {
641 var thisDay = result.dateRelativeDay; 640 var thisDay = result.dateRelativeDay;
642 var isSameDay = lastDay == thisDay; 641 var isSameDay = lastDay == thisDay;
643 this.visits_.push(new Visit(result, isSameDay, this)); 642 this.visits_.push(new Visit(result, isSameDay, this));
644 lastDay = thisDay; 643 lastDay = thisDay;
645 } 644 }
(...skipping 926 matching lines...) Expand 10 before | Expand all | Expand 10 after
1572 HistoryView.prototype.addTimeframeInterval_ = function(resultsFragment) { 1571 HistoryView.prototype.addTimeframeInterval_ = function(resultsFragment) {
1573 if (this.getRangeInDays() == HistoryModel.Range.ALL_TIME) 1572 if (this.getRangeInDays() == HistoryModel.Range.ALL_TIME)
1574 return; 1573 return;
1575 1574
1576 // If this is a time range result add some text that shows what is the 1575 // If this is a time range result add some text that shows what is the
1577 // time range for the results the user is viewing. 1576 // time range for the results the user is viewing.
1578 var timeFrame = resultsFragment.appendChild( 1577 var timeFrame = resultsFragment.appendChild(
1579 createElementWithClassName('h2', 'timeframe')); 1578 createElementWithClassName('h2', 'timeframe'));
1580 // TODO(sergiu): Figure the best way to show this for the first day of 1579 // TODO(sergiu): Figure the best way to show this for the first day of
1581 // the month. 1580 // the month.
1582 timeFrame.appendChild(document.createTextNode(loadTimeData.getStringF( 1581 timeFrame.appendChild(
1583 'historyInterval', 1582 document.createTextNode(this.model_.queryInterval));
1584 this.model_.queryStartTime,
1585 this.model_.queryEndTime)));
1586 }; 1583 };
1587 1584
1588 /** 1585 /**
1589 * Update the page with results. 1586 * Update the page with results.
1590 * @param {boolean} doneLoading Whether the current request is complete. 1587 * @param {boolean} doneLoading Whether the current request is complete.
1591 * @private 1588 * @private
1592 */ 1589 */
1593 HistoryView.prototype.displayResults_ = function(doneLoading) { 1590 HistoryView.prototype.displayResults_ = function(doneLoading) {
1594 // Either show a page of results received for the all time results or all the 1591 // Either show a page of results received for the all time results or all the
1595 // received results for the weekly and monthly view. 1592 // received results for the weekly and monthly view.
(...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after
2413 historyView.reload(); 2410 historyView.reload();
2414 } 2411 }
2415 2412
2416 // Add handlers to HTML elements. 2413 // Add handlers to HTML elements.
2417 document.addEventListener('DOMContentLoaded', load); 2414 document.addEventListener('DOMContentLoaded', load);
2418 2415
2419 // This event lets us enable and disable menu items before the menu is shown. 2416 // This event lets us enable and disable menu items before the menu is shown.
2420 document.addEventListener('canExecute', function(e) { 2417 document.addEventListener('canExecute', function(e) {
2421 e.canExecute = true; 2418 e.canExecute = true;
2422 }); 2419 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/history/externs.js ('k') | chrome/browser/resources/md_history/app.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698