| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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-app', | 6 is: 'history-app', |
| 7 | 7 |
| 8 properties: { | 8 properties: { |
| 9 // The id of the currently selected page. | 9 // The id of the currently selected page. |
| 10 selectedPage: { | 10 selectedPage: { |
| 11 type: String, | 11 type: String, |
| 12 value: 'history-list' | 12 value: 'history-list' |
| 13 } | 13 } |
| 14 }, | 14 }, |
| 15 | 15 |
| 16 // TODO(calamity): Replace these event listeners with data bound properties. | 16 // TODO(calamity): Replace these event listeners with data bound properties. |
| 17 listeners: { | 17 listeners: { |
| 18 'history-checkbox-select': 'checkboxSelected', | 18 'history-checkbox-select': 'checkboxSelected', |
| 19 'unselect-all': 'unselectAll', | 19 'unselect-all': 'unselectAll', |
| 20 'delete-selected': 'deleteSelected', | 20 'delete-selected': 'deleteSelected', |
| 21 'search-changed': 'searchChanged', | 21 'search-changed': 'searchChanged', |
| 22 }, | 22 }, |
| 23 | 23 |
| 24 ready: function() { |
| 25 this.$.toolbar.isGroupedMode = loadTimeData.getBoolean('groupByDomain'); |
| 26 }, |
| 27 |
| 24 /** | 28 /** |
| 25 * Listens for history-item being selected or deselected (through checkbox) | 29 * Listens for history-item being selected or deselected (through checkbox) |
| 26 * and changes the view of the top toolbar. | 30 * and changes the view of the top toolbar. |
| 27 * @param {{detail: {countAddition: number}}} e | 31 * @param {{detail: {countAddition: number}}} e |
| 28 */ | 32 */ |
| 29 checkboxSelected: function(e) { | 33 checkboxSelected: function(e) { |
| 30 var toolbar = /** @type {HistoryToolbarElement} */(this.$.toolbar); | 34 var toolbar = /** @type {HistoryToolbarElement} */(this.$.toolbar); |
| 31 toolbar.count += e.detail.countAddition; | 35 toolbar.count += e.detail.countAddition; |
| 32 }, | 36 }, |
| 33 | 37 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 * @param {HistoryQuery} info An object containing information about the | 81 * @param {HistoryQuery} info An object containing information about the |
| 78 * query. | 82 * query. |
| 79 * @param {!Array<HistoryEntry>} results A list of results. | 83 * @param {!Array<HistoryEntry>} results A list of results. |
| 80 */ | 84 */ |
| 81 historyResult: function(info, results) { | 85 historyResult: function(info, results) { |
| 82 var list = /** @type {HistoryListElement} */(this.$['history-list']); | 86 var list = /** @type {HistoryListElement} */(this.$['history-list']); |
| 83 list.addNewResults(results, info.term); | 87 list.addNewResults(results, info.term); |
| 84 /** @type {HistoryToolbarElement} */(this.$.toolbar).searching = false; | 88 /** @type {HistoryToolbarElement} */(this.$.toolbar).searching = false; |
| 85 if (info.finished) | 89 if (info.finished) |
| 86 list.disableResultLoading(); | 90 list.disableResultLoading(); |
| 91 |
| 92 var toolbar = /** @type {HistoryToolbarElement} */(this.$.toolbar); |
| 93 toolbar.queryStartTime = info.queryStartTime; |
| 94 toolbar.queryEndTime = info.queryEndTime; |
| 87 }, | 95 }, |
| 88 | 96 |
| 89 /** | 97 /** |
| 90 * @param {!Array<!ForeignSession>} sessionList Array of objects describing | 98 * @param {!Array<!ForeignSession>} sessionList Array of objects describing |
| 91 * the sessions from other devices. | 99 * the sessions from other devices. |
| 92 * @param {boolean} isTabSyncEnabled Is tab sync enabled for this profile? | 100 * @param {boolean} isTabSyncEnabled Is tab sync enabled for this profile? |
| 93 */ | 101 */ |
| 94 setForeignSessions: function(sessionList, isTabSyncEnabled) { | 102 setForeignSessions: function(sessionList, isTabSyncEnabled) { |
| 95 if (!isTabSyncEnabled) | 103 if (!isTabSyncEnabled) |
| 96 return; | 104 return; |
| 97 | 105 |
| 98 // TODO(calamity): Add a 'no synced devices' message when sessions are | 106 // TODO(calamity): Add a 'no synced devices' message when sessions are |
| 99 // empty. | 107 // empty. |
| 100 var syncedDeviceElem = this.$['history-synced-device-manager']; | 108 var syncedDeviceElem = this.$['history-synced-device-manager']; |
| 101 var syncedDeviceManager = | 109 var syncedDeviceManager = |
| 102 /** @type {HistorySyncedDeviceManagerElement} */(syncedDeviceElem); | 110 /** @type {HistorySyncedDeviceManagerElement} */(syncedDeviceElem); |
| 103 syncedDeviceManager.setSyncedHistory(sessionList); | 111 syncedDeviceManager.setSyncedHistory(sessionList); |
| 104 }, | 112 }, |
| 105 | 113 |
| 106 deleteComplete: function() { | 114 deleteComplete: function() { |
| 107 var historyList = /** @type {HistoryListElement} */(this.$['history-list']); | 115 var historyList = /** @type {HistoryListElement} */(this.$['history-list']); |
| 108 var toolbar = /** @type {HistoryToolbarElement} */(this.$.toolbar); | 116 var toolbar = /** @type {HistoryToolbarElement} */(this.$.toolbar); |
| 109 historyList.removeDeletedHistory(toolbar.count); | 117 historyList.removeDeletedHistory(toolbar.count); |
| 110 toolbar.count = 0; | 118 toolbar.count = 0; |
| 111 } | 119 } |
| 112 }); | 120 }); |
| OLD | NEW |