| 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 // Send the history query immediately. This allows the query to process during | 5 // Send the history query immediately. This allows the query to process during |
| 6 // the initial page startup. | 6 // the initial page startup. |
| 7 chrome.send('queryHistory', ['', 0, 0, 0, RESULTS_PER_PAGE]); | 7 chrome.send('queryHistory', ['', 0, 0, 0, RESULTS_PER_PAGE]); |
| 8 chrome.send('getForeignSessions'); | 8 chrome.send('getForeignSessions'); |
| 9 | 9 |
| 10 /** | 10 /** |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 }); | 59 }); |
| 60 | 60 |
| 61 /** | 61 /** |
| 62 * When the search is changed refresh the results from the backend. Ensures that | 62 * When the search is changed refresh the results from the backend. Ensures that |
| 63 * the search bar is updated with the new search term. | 63 * the search bar is updated with the new search term. |
| 64 * @param {{detail: {search: string}}} e | 64 * @param {{detail: {search: string}}} e |
| 65 */ | 65 */ |
| 66 window.addEventListener('search-changed', function(e) { | 66 window.addEventListener('search-changed', function(e) { |
| 67 $('toolbar').setSearchTerm(e.detail.search); | 67 $('toolbar').setSearchTerm(e.detail.search); |
| 68 /** @type {HistoryListElement} */($('history-list')).setLoading(); | 68 /** @type {HistoryListElement} */($('history-list')).setLoading(); |
| 69 /** @type {HistoryToolbarElement} */($('toolbar')).setSearching(); |
| 69 chrome.send('queryHistory', [e.detail.search, 0, 0, 0, RESULTS_PER_PAGE]); | 70 chrome.send('queryHistory', [e.detail.search, 0, 0, 0, RESULTS_PER_PAGE]); |
| 70 }); | 71 }); |
| 71 | 72 |
| 72 /** | 73 /** |
| 73 * Switches between displaying history data and synced tabs data for the page. | 74 * Switches between displaying history data and synced tabs data for the page. |
| 74 */ | 75 */ |
| 75 window.addEventListener('switch-display', function(e) { | 76 window.addEventListener('switch-display', function(e) { |
| 76 $('history-synced-device-manager').hidden = | 77 $('history-synced-device-manager').hidden = |
| 77 e.detail.display != 'synced-tabs-button'; | 78 e.detail.display != 'synced-tabs-button'; |
| 78 $('history-list').hidden = e.detail.display != 'history-button'; | 79 $('history-list').hidden = e.detail.display != 'history-button'; |
| 79 }); | 80 }); |
| 80 | 81 |
| 81 // Chrome Callbacks------------------------------------------------------------- | 82 // Chrome Callbacks------------------------------------------------------------- |
| 82 | 83 |
| 83 /** | 84 /** |
| 84 * Our history system calls this function with results from searches. | 85 * Our history system calls this function with results from searches. |
| 85 * @param {HistoryQuery} info An object containing information about the query. | 86 * @param {HistoryQuery} info An object containing information about the query. |
| 86 * @param {!Array<HistoryEntry>} results A list of results. | 87 * @param {!Array<HistoryEntry>} results A list of results. |
| 87 */ | 88 */ |
| 88 function historyResult(info, results) { | 89 function historyResult(info, results) { |
| 89 var listElem = $('history-list'); | 90 var listElem = $('history-list'); |
| 90 waitForUpgrade(listElem).then(function() { | 91 waitForUpgrade(listElem).then(function() { |
| 91 var list = /** @type {HistoryListElement} */(listElem); | 92 var list = /** @type {HistoryListElement} */(listElem); |
| 92 list.addNewResults(results, info.term); | 93 list.addNewResults(results, info.term); |
| 94 var toolbarElem = $('toolbar'); |
| 95 waitForUpgrade(toolbarElem).then(function() { |
| 96 toolbarElem.searchingFinished(); |
| 97 }); |
| 93 if (info.finished) | 98 if (info.finished) |
| 94 list.disableResultLoading(); | 99 list.disableResultLoading(); |
| 95 // TODO(tsergeant): Showing everything as soon as the list is ready is not | 100 // TODO(tsergeant): Showing everything as soon as the list is ready is not |
| 96 // ideal, as the sidebar can still pop in after. Fix this to show everything | 101 // ideal, as the sidebar can still pop in after. Fix this to show everything |
| 97 // at once. | 102 // at once. |
| 98 document.body.classList.remove('loading'); | 103 document.body.classList.remove('loading'); |
| 99 }); | 104 }); |
| 100 } | 105 } |
| 101 | 106 |
| 102 /** | 107 /** |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 * Called by the history backend when the deletion failed. | 152 * Called by the history backend when the deletion failed. |
| 148 */ | 153 */ |
| 149 function deleteFailed() { | 154 function deleteFailed() { |
| 150 } | 155 } |
| 151 | 156 |
| 152 /** | 157 /** |
| 153 * Called when the history is deleted by someone else. | 158 * Called when the history is deleted by someone else. |
| 154 */ | 159 */ |
| 155 function historyDeleted() { | 160 function historyDeleted() { |
| 156 } | 161 } |
| OLD | NEW |