| Index: chrome/browser/resources/md_history/history.js
|
| diff --git a/chrome/browser/resources/md_history/history.js b/chrome/browser/resources/md_history/history.js
|
| index dff27c6a4565eec9648d91f036d6e9a0900da239..8279522f675f6eac33c75d1f56fb504f9b04d6d9 100644
|
| --- a/chrome/browser/resources/md_history/history.js
|
| +++ b/chrome/browser/resources/md_history/history.js
|
| @@ -2,16 +2,6 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -// Globals:
|
| -/** @const */ var RESULTS_PER_PAGE = 150;
|
| -
|
| -/**
|
| - * Amount of time between pageviews that we consider a 'break' in browsing,
|
| - * measured in milliseconds.
|
| - * @const
|
| - */
|
| -var BROWSING_GAP_TIME = 15 * 60 * 1000;
|
| -
|
| window.addEventListener('load', function() {
|
| chrome.send('queryHistory', ['', 0, 0, 0, RESULTS_PER_PAGE]);
|
| });
|
| @@ -19,9 +9,11 @@ window.addEventListener('load', function() {
|
| /**
|
| * Listens for history-item being selected or deselected (through checkbox)
|
| * and changes the view of the top toolbar.
|
| + * @param {{detail: {countAddition: number}}} e
|
| */
|
| window.addEventListener('history-checkbox-select', function(e) {
|
| - $('toolbar').count += e.detail.countAddition;
|
| + var toolbar = /** @type {HistoryToolbarElement} */($('toolbar'));
|
| + toolbar.count += e.detail.countAddition;
|
| });
|
|
|
| /**
|
| @@ -29,8 +21,10 @@ window.addEventListener('history-checkbox-select', function(e) {
|
| * checkbox to be unselected.
|
| */
|
| window.addEventListener('unselect-all', function() {
|
| - $('history-list').unselectAllItems($('toolbar').count);
|
| - $('toolbar').count = 0;
|
| + var historyList = /** @type {HistoryListElement} */($('history-list'));
|
| + var toolbar = /** @type {HistoryToolbarElement} */($('toolbar'));
|
| + historyList.unselectAllItems(toolbar.count);
|
| + toolbar.count = 0;
|
| });
|
|
|
| /**
|
| @@ -38,15 +32,15 @@ window.addEventListener('unselect-all', function() {
|
| * to determine which ones are selected and deletes these.
|
| */
|
| window.addEventListener('delete-selected', function() {
|
| - if (!loadTimeData.getBoolean('allowDeletingHistory')) {
|
| + if (!loadTimeData.getBoolean('allowDeletingHistory'))
|
| return;
|
| - }
|
|
|
| // TODO(hsampson): add a popup to check whether the user definitely wants to
|
| // delete the selected items.
|
|
|
| - var toBeRemoved =
|
| - $('history-list').getSelectedItems($('toolbar').count);
|
| + var historyList = /** @type {HistoryListElement} */($('history-list'));
|
| + var toolbar = /** @type {HistoryToolbarElement} */($('toolbar'));
|
| + var toBeRemoved = historyList.getSelectedItems(toolbar.count);
|
| chrome.send('removeVisits', toBeRemoved);
|
| });
|
|
|
| @@ -55,7 +49,7 @@ window.addEventListener('delete-selected', function() {
|
| * When the search is changed refresh the results from the backend.
|
| */
|
| window.addEventListener('search-changed', function(e) {
|
| - $('history-list').setLoading();
|
| + /** @type {HistoryListElement} */($('history-list')).setLoading();
|
| chrome.send('queryHistory', [e.detail.search, 0, 0, 0, RESULTS_PER_PAGE]);
|
| });
|
|
|
| @@ -64,20 +58,23 @@ window.addEventListener('search-changed', function(e) {
|
| /**
|
| * Our history system calls this function with results from searches.
|
| * @param {HistoryQuery} info An object containing information about the query.
|
| - * @param {Array<HistoryEntry>} results A list of results.
|
| + * @param {!Array<HistoryEntry>} results A list of results.
|
| */
|
| function historyResult(info, results) {
|
| - $('history-list').addNewResults(results, info.term);
|
| + var historyList = /** @type {HistoryListElement} */($('history-list'));
|
| + historyList.addNewResults(results, info.term);
|
| if (info.finished)
|
| - $('history-list').disableResultLoading();
|
| + historyList.disableResultLoading();
|
| }
|
|
|
| /**
|
| * Called by the history backend when deletion was succesful.
|
| */
|
| function deleteComplete() {
|
| - $('history-list').removeDeletedHistory($('toolbar').count);
|
| - $('toolbar').count = 0;
|
| + var historyList = /** @type {HistoryListElement} */($('history-list'));
|
| + var toolbar = /** @type {HistoryToolbarElement} */($('toolbar'));
|
| + historyList.removeDeletedHistory(toolbar.count);
|
| + toolbar.count = 0;
|
| }
|
|
|
| /**
|
|
|