| OLD | NEW |
| 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 // Globals: | 5 // Globals: |
| 6 /** @const */ var RESULTS_PER_PAGE = 150; | 6 /** @const */ var RESULTS_PER_PAGE = 150; |
| 7 | 7 |
| 8 /** | 8 /** |
| 9 * Amount of time between pageviews that we consider a 'break' in browsing, | 9 * Amount of time between pageviews that we consider a 'break' in browsing, |
| 10 * measured in milliseconds. | 10 * measured in milliseconds. |
| 11 * @const | 11 * @const |
| 12 */ | 12 */ |
| 13 var BROWSING_GAP_TIME = 15 * 60 * 1000; | 13 var BROWSING_GAP_TIME = 15 * 60 * 1000; |
| 14 | 14 |
| 15 window.addEventListener('load', function() { | 15 window.addEventListener('load', function() { |
| 16 chrome.send('queryHistory', ['', 0, 0, 0, RESULTS_PER_PAGE]); | 16 chrome.send('queryHistory', ['', 0, 0, 0, RESULTS_PER_PAGE]); |
| 17 }); | 17 }); |
| 18 | 18 |
| 19 /** | 19 /** |
| 20 * Our history system calls this function with results from searches. | 20 * Our history system calls this function with results from searches. |
| 21 * @param {HistoryQuery} info An object containing information about the query. | 21 * @param {HistoryQuery} info An object containing information about the query. |
| 22 * @param {Array<HistoryEntry>} results A list of results. | 22 * @param {Array<HistoryEntry>} results A list of results. |
| 23 */ | 23 */ |
| 24 function historyResult(info, results) { | 24 function historyResult(info, results) { |
| 25 $('history-card-manager').addNewResults(results); | 25 $('history-list').addNewResults(results); |
| 26 } | 26 } |
| 27 | 27 |
| 28 /** | 28 /** |
| 29 * Listens for history-item being selected or deselected (through checkbox) | 29 * Listens for history-item being selected or deselected (through checkbox) |
| 30 * and changes the view of the top toolbar. | 30 * and changes the view of the top toolbar. |
| 31 */ | 31 */ |
| 32 window.addEventListener('history-checkbox-select', function(e) { | 32 window.addEventListener('history-checkbox-select', function(e) { |
| 33 $('toolbar').count += e.detail.countAddition; | 33 $('toolbar').count += e.detail.countAddition; |
| 34 }); | 34 }); |
| 35 | 35 |
| 36 /** | 36 /** |
| 37 * Listens for call to cancel selection and loops through all items to set | 37 * Listens for call to cancel selection and loops through all items to set |
| 38 * checkbox to be unselected. | 38 * checkbox to be unselected. |
| 39 */ | 39 */ |
| 40 window.addEventListener('unselect-all', function() { | 40 window.addEventListener('unselect-all', function() { |
| 41 $('history-card-manager').unselectAllItems($('toolbar').count); | 41 $('history-list').unselectAllItems($('toolbar').count); |
| 42 $('toolbar').count = 0; | 42 $('toolbar').count = 0; |
| 43 }); | 43 }); |
| 44 | 44 |
| 45 /** | 45 /** |
| 46 * Listens for any keyboard presses which will close the overflow menu. | 46 * Listens for any keyboard presses which will close the overflow menu. |
| 47 */ | 47 */ |
| 48 window.addEventListener('keydown', function(e) { | 48 window.addEventListener('keydown', function(e) { |
| 49 // Escape button on keyboard | 49 // Escape button on keyboard |
| 50 if (e.keyCode == 27) { | 50 if (e.keyCode == 27) { |
| 51 $('history-card-manager').closeMenu(); | 51 $('history-list').closeMenu(); |
| 52 } | 52 } |
| 53 }); | 53 }); |
| 54 | 54 |
| 55 /** | 55 /** |
| 56 * Resizing browser window will cause the overflow menu to close. | 56 * Resizing browser window will cause the overflow menu to close. |
| 57 */ | 57 */ |
| 58 window.addEventListener('resize', function() { | 58 window.addEventListener('resize', function() { |
| 59 $('history-card-manager').closeMenu(); | 59 $('history-list').closeMenu(); |
| 60 }); | 60 }); |
| OLD | NEW |