| 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 function PromiseResolver() { | 4 function PromiseResolver() { |
| 5 this.resolve_; | 5 this.resolve_; |
| 6 this.reject_; | 6 this.reject_; |
| 7 this.promise_ = new Promise(function(resolve, reject) { | 7 this.promise_ = new Promise(function(resolve, reject) { |
| 8 this.resolve_ = resolve; | 8 this.resolve_ = resolve; |
| 9 this.reject_ = reject; | 9 this.reject_ = reject; |
| 10 }.bind(this)); | 10 }.bind(this)); |
| (...skipping 6226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6237 } | 6237 } |
| 6238 }; | 6238 }; |
| 6239 | 6239 |
| 6240 Polymer.PaperItemBehavior = [ Polymer.IronButtonState, Polymer.IronControlState,
Polymer.PaperItemBehaviorImpl ]; | 6240 Polymer.PaperItemBehavior = [ Polymer.IronButtonState, Polymer.IronControlState,
Polymer.PaperItemBehaviorImpl ]; |
| 6241 | 6241 |
| 6242 Polymer({ | 6242 Polymer({ |
| 6243 is: 'paper-item', | 6243 is: 'paper-item', |
| 6244 behaviors: [ Polymer.PaperItemBehavior ] | 6244 behaviors: [ Polymer.PaperItemBehavior ] |
| 6245 }); | 6245 }); |
| 6246 | 6246 |
| 6247 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 6248 // Use of this source code is governed by a BSD-style license that can be |
| 6249 // found in the LICENSE file. |
| 6250 cr.define('md_history', function() { |
| 6251 function BrowserService() { |
| 6252 this.pendingDeleteItems_ = null; |
| 6253 this.pendingDeletePromise_ = null; |
| 6254 } |
| 6255 BrowserService.prototype = { |
| 6256 deleteItems: function(items) { |
| 6257 if (this.pendingDeleteItems_ != null) { |
| 6258 return new Promise(function(resolve, reject) { |
| 6259 reject(items); |
| 6260 }); |
| 6261 } |
| 6262 var removalList = items.map(function(item) { |
| 6263 return { |
| 6264 url: item.url, |
| 6265 timestamps: item.allTimestamps |
| 6266 }; |
| 6267 }); |
| 6268 this.pendingDeleteItems_ = items; |
| 6269 this.pendingDeletePromise_ = new PromiseResolver(); |
| 6270 chrome.send('removeVisits', removalList); |
| 6271 return this.pendingDeletePromise_.promise; |
| 6272 }, |
| 6273 removeBookmark: function(url) { |
| 6274 chrome.send('removeBookmark', [ url ]); |
| 6275 }, |
| 6276 openForeignSessionAllTabs: function(sessionTag) { |
| 6277 chrome.send('openForeignSession', [ sessionTag ]); |
| 6278 }, |
| 6279 openForeignSessionTab: function(sessionTag, windowId, tabId, e) { |
| 6280 chrome.send('openForeignSession', [ sessionTag, String(windowId), String(t
abId), e.button || 0, e.altKey, e.ctrlKey, e.metaKey, e.shiftKey ]); |
| 6281 }, |
| 6282 deleteForeignSession: function(sessionTag) { |
| 6283 chrome.send('deleteForeignSession', [ sessionTag ]); |
| 6284 }, |
| 6285 openClearBrowsingData: function() { |
| 6286 chrome.send('clearBrowsingData'); |
| 6287 }, |
| 6288 recordHistogram: function(histogram, value, max) { |
| 6289 chrome.send('metricsHandler:recordInHistogram', [ histogram, value, max ])
; |
| 6290 }, |
| 6291 recordAction: function(action) { |
| 6292 if (action.indexOf('_') == -1) action = 'HistoryPage_' + action; |
| 6293 chrome.send('metricsHandler:recordAction', [ action ]); |
| 6294 }, |
| 6295 resolveDelete_: function(successful) { |
| 6296 if (this.pendingDeleteItems_ == null || this.pendingDeletePromise_ == null
) { |
| 6297 return; |
| 6298 } |
| 6299 if (successful) this.pendingDeletePromise_.resolve(this.pendingDeleteItems
_); else this.pendingDeletePromise_.reject(this.pendingDeleteItems_); |
| 6300 this.pendingDeleteItems_ = null; |
| 6301 this.pendingDeletePromise_ = null; |
| 6302 } |
| 6303 }; |
| 6304 cr.addSingletonGetter(BrowserService); |
| 6305 return { |
| 6306 BrowserService: BrowserService |
| 6307 }; |
| 6308 }); |
| 6309 |
| 6310 function deleteComplete() { |
| 6311 md_history.BrowserService.getInstance().resolveDelete_(true); |
| 6312 } |
| 6313 |
| 6314 function deleteFailed() { |
| 6315 md_history.BrowserService.getInstance().resolveDelete_(false); |
| 6316 } |
| 6317 |
| 6247 Polymer({ | 6318 Polymer({ |
| 6248 is: 'iron-collapse', | 6319 is: 'iron-collapse', |
| 6249 behaviors: [ Polymer.IronResizableBehavior ], | 6320 behaviors: [ Polymer.IronResizableBehavior ], |
| 6250 properties: { | 6321 properties: { |
| 6251 horizontal: { | 6322 horizontal: { |
| 6252 type: Boolean, | 6323 type: Boolean, |
| 6253 value: false, | 6324 value: false, |
| 6254 observer: '_horizontalChanged' | 6325 observer: '_horizontalChanged' |
| 6255 }, | 6326 }, |
| 6256 opened: { | 6327 opened: { |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6561 return { | 6632 return { |
| 6562 getSupportedScaleFactors: getSupportedScaleFactors, | 6633 getSupportedScaleFactors: getSupportedScaleFactors, |
| 6563 getProfileAvatarIcon: getProfileAvatarIcon, | 6634 getProfileAvatarIcon: getProfileAvatarIcon, |
| 6564 getFaviconImageSet: getFaviconImageSet | 6635 getFaviconImageSet: getFaviconImageSet |
| 6565 }; | 6636 }; |
| 6566 }); | 6637 }); |
| 6567 | 6638 |
| 6568 // Copyright 2016 The Chromium Authors. All rights reserved. | 6639 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 6569 // Use of this source code is governed by a BSD-style license that can be | 6640 // Use of this source code is governed by a BSD-style license that can be |
| 6570 // found in the LICENSE file. | 6641 // found in the LICENSE file. |
| 6571 cr.define('md_history', function() { | |
| 6572 function BrowserService() { | |
| 6573 this.pendingDeleteItems_ = null; | |
| 6574 this.pendingDeletePromise_ = null; | |
| 6575 } | |
| 6576 BrowserService.prototype = { | |
| 6577 deleteItems: function(items) { | |
| 6578 if (this.pendingDeleteItems_ != null) { | |
| 6579 return new Promise(function(resolve, reject) { | |
| 6580 reject(items); | |
| 6581 }); | |
| 6582 } | |
| 6583 var removalList = items.map(function(item) { | |
| 6584 return { | |
| 6585 url: item.url, | |
| 6586 timestamps: item.allTimestamps | |
| 6587 }; | |
| 6588 }); | |
| 6589 this.pendingDeleteItems_ = items; | |
| 6590 this.pendingDeletePromise_ = new PromiseResolver(); | |
| 6591 chrome.send('removeVisits', removalList); | |
| 6592 return this.pendingDeletePromise_.promise; | |
| 6593 }, | |
| 6594 removeBookmark: function(url) { | |
| 6595 chrome.send('removeBookmark', [ url ]); | |
| 6596 }, | |
| 6597 openForeignSessionAllTabs: function(sessionTag) { | |
| 6598 chrome.send('openForeignSession', [ sessionTag ]); | |
| 6599 }, | |
| 6600 openForeignSessionTab: function(sessionTag, windowId, tabId, e) { | |
| 6601 chrome.send('openForeignSession', [ sessionTag, String(windowId), String(t
abId), e.button || 0, e.altKey, e.ctrlKey, e.metaKey, e.shiftKey ]); | |
| 6602 }, | |
| 6603 deleteForeignSession: function(sessionTag) { | |
| 6604 chrome.send('deleteForeignSession', [ sessionTag ]); | |
| 6605 }, | |
| 6606 openClearBrowsingData: function() { | |
| 6607 chrome.send('clearBrowsingData'); | |
| 6608 }, | |
| 6609 recordHistogram: function(histogram, value, max) { | |
| 6610 chrome.send('metricsHandler:recordInHistogram', [ histogram, value, max ])
; | |
| 6611 }, | |
| 6612 recordAction: function(actionDesc) { | |
| 6613 chrome.send('metricsHandler:recordAction', [ actionDesc ]); | |
| 6614 }, | |
| 6615 resolveDelete_: function(successful) { | |
| 6616 if (this.pendingDeleteItems_ == null || this.pendingDeletePromise_ == null
) { | |
| 6617 return; | |
| 6618 } | |
| 6619 if (successful) this.pendingDeletePromise_.resolve(this.pendingDeleteItems
_); else this.pendingDeletePromise_.reject(this.pendingDeleteItems_); | |
| 6620 this.pendingDeleteItems_ = null; | |
| 6621 this.pendingDeletePromise_ = null; | |
| 6622 } | |
| 6623 }; | |
| 6624 cr.addSingletonGetter(BrowserService); | |
| 6625 return { | |
| 6626 BrowserService: BrowserService | |
| 6627 }; | |
| 6628 }); | |
| 6629 | |
| 6630 function deleteComplete() { | |
| 6631 md_history.BrowserService.getInstance().resolveDelete_(true); | |
| 6632 } | |
| 6633 | |
| 6634 function deleteFailed() { | |
| 6635 md_history.BrowserService.getInstance().resolveDelete_(false); | |
| 6636 } | |
| 6637 | |
| 6638 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 6639 // Use of this source code is governed by a BSD-style license that can be | |
| 6640 // found in the LICENSE file. | |
| 6641 Polymer({ | 6642 Polymer({ |
| 6642 is: 'history-searched-label', | 6643 is: 'history-searched-label', |
| 6643 properties: { | 6644 properties: { |
| 6644 title: String, | 6645 title: String, |
| 6645 searchTerm: String | 6646 searchTerm: String |
| 6646 }, | 6647 }, |
| 6647 observers: [ 'setSearchedTextToBold_(title, searchTerm)' ], | 6648 observers: [ 'setSearchedTextToBold_(title, searchTerm)' ], |
| 6648 setSearchedTextToBold_: function() { | 6649 setSearchedTextToBold_: function() { |
| 6649 var i = 0; | 6650 var i = 0; |
| 6650 var titleElem = this.$.container; | 6651 var titleElem = this.$.container; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6715 shiftKey: e.shiftKey | 6716 shiftKey: e.shiftKey |
| 6716 }); | 6717 }); |
| 6717 e.preventDefault(); | 6718 e.preventDefault(); |
| 6718 }, | 6719 }, |
| 6719 onCheckboxMousedown_: function(e) { | 6720 onCheckboxMousedown_: function(e) { |
| 6720 if (e.shiftKey) e.preventDefault(); | 6721 if (e.shiftKey) e.preventDefault(); |
| 6721 }, | 6722 }, |
| 6722 onRemoveBookmarkTap_: function() { | 6723 onRemoveBookmarkTap_: function() { |
| 6723 if (!this.item.starred) return; | 6724 if (!this.item.starred) return; |
| 6724 if (this.$$('#bookmark-star') == this.root.activeElement) this.$['menu-but
ton'].focus(); | 6725 if (this.$$('#bookmark-star') == this.root.activeElement) this.$['menu-but
ton'].focus(); |
| 6725 md_history.BrowserService.getInstance().removeBookmark(this.item.url); | 6726 var browserService = md_history.BrowserService.getInstance(); |
| 6727 browserService.removeBookmark(this.item.url); |
| 6728 browserService.recordAction('BookmarkStarClicked'); |
| 6726 this.fire('remove-bookmark-stars', this.item.url); | 6729 this.fire('remove-bookmark-stars', this.item.url); |
| 6727 }, | 6730 }, |
| 6728 onMenuButtonTap_: function(e) { | 6731 onMenuButtonTap_: function(e) { |
| 6729 this.fire('toggle-menu', { | 6732 this.fire('toggle-menu', { |
| 6730 target: Polymer.dom(e).localTarget, | 6733 target: Polymer.dom(e).localTarget, |
| 6731 item: this.item, | 6734 item: this.item, |
| 6732 path: this.path | 6735 path: this.path |
| 6733 }); | 6736 }); |
| 6734 e.stopPropagation(); | 6737 e.stopPropagation(); |
| 6735 }, | 6738 }, |
| 6739 onLinkClick_: function() { |
| 6740 var browserService = md_history.BrowserService.getInstance(); |
| 6741 browserService.recordAction('EntryLinkClick'); |
| 6742 browserService.recordHistogram('HistoryPage.ClickPosition', this.item.inde
x, UMA_MAX_BUCKET_VALUE); |
| 6743 if (this.item.index <= UMA_MAX_SUBSET_BUCKET_VALUE) { |
| 6744 browserService.recordHistogram('HistoryPage.ClickPositionSubset', this.i
tem.index, UMA_MAX_SUBSET_BUCKET_VALUE); |
| 6745 } |
| 6746 if (this.searchTerm) browserService.recordAction('SearchResultClick'); |
| 6747 }, |
| 6748 onLinkRightClick_: function() { |
| 6749 md_history.BrowserService.getInstance().recordAction('EntryLinkRightClick'
); |
| 6750 }, |
| 6736 showIcon_: function() { | 6751 showIcon_: function() { |
| 6737 this.$.icon.style.backgroundImage = cr.icon.getFaviconImageSet(this.item.u
rl); | 6752 this.$.icon.style.backgroundImage = cr.icon.getFaviconImageSet(this.item.u
rl); |
| 6738 }, | 6753 }, |
| 6739 selectionNotAllowed_: function() { | 6754 selectionNotAllowed_: function() { |
| 6740 return !loadTimeData.getBoolean('allowDeletingHistory'); | 6755 return !loadTimeData.getBoolean('allowDeletingHistory'); |
| 6741 }, | 6756 }, |
| 6742 cardTitle_: function(numberOfItems, historyDate, search) { | 6757 cardTitle_: function(numberOfItems, historyDate, search) { |
| 6743 if (!search) return this.item.dateRelativeDay; | 6758 if (!search) return this.item.dateRelativeDay; |
| 6744 var resultId = numberOfItems == 1 ? 'searchResult' : 'searchResults'; | 6759 var resultId = numberOfItems == 1 ? 'searchResult' : 'searchResults'; |
| 6745 return loadTimeData.getStringF('foundSearchResults', numberOfItems, loadTi
meData.getString(resultId), search); | 6760 return loadTimeData.getStringF('foundSearchResults', numberOfItems, loadTi
meData.getString(resultId), search); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6802 }.bind(this)); | 6817 }.bind(this)); |
| 6803 this.selectedPaths.clear(); | 6818 this.selectedPaths.clear(); |
| 6804 }, | 6819 }, |
| 6805 deleteSelected: function() { | 6820 deleteSelected: function() { |
| 6806 var toBeRemoved = Array.from(this.selectedPaths.values()).map(function(path)
{ | 6821 var toBeRemoved = Array.from(this.selectedPaths.values()).map(function(path)
{ |
| 6807 return this.get(path); | 6822 return this.get(path); |
| 6808 }.bind(this)); | 6823 }.bind(this)); |
| 6809 md_history.BrowserService.getInstance().deleteItems(toBeRemoved).then(functi
on() { | 6824 md_history.BrowserService.getInstance().deleteItems(toBeRemoved).then(functi
on() { |
| 6810 this.removeItemsByPath(Array.from(this.selectedPaths)); | 6825 this.removeItemsByPath(Array.from(this.selectedPaths)); |
| 6811 this.fire('unselect-all'); | 6826 this.fire('unselect-all'); |
| 6827 this.refreshItemIndexes(); |
| 6812 }.bind(this)); | 6828 }.bind(this)); |
| 6813 }, | 6829 }, |
| 6814 removeItemsByPath: function(paths) { | 6830 removeItemsByPath: function(paths) { |
| 6815 if (paths.length == 0) return; | 6831 if (paths.length == 0) return; |
| 6816 this.removeItemsBeneathNode_(this.buildRemovalTree_(paths)); | 6832 this.removeItemsBeneathNode_(this.buildRemovalTree_(paths)); |
| 6817 }, | 6833 }, |
| 6818 buildRemovalTree_: function(paths) { | 6834 buildRemovalTree_: function(paths) { |
| 6819 var rootNode = new SelectionTreeNode(paths[0].split('.')[0]); | 6835 var rootNode = new SelectionTreeNode(paths[0].split('.')[0]); |
| 6820 paths.forEach(function(path) { | 6836 paths.forEach(function(path) { |
| 6821 var components = path.split('.'); | 6837 var components = path.split('.'); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 6833 return rootNode; | 6849 return rootNode; |
| 6834 }, | 6850 }, |
| 6835 removeItemsBeneathNode_: function(node) { | 6851 removeItemsBeneathNode_: function(node) { |
| 6836 var array = this.get(node.currentPath); | 6852 var array = this.get(node.currentPath); |
| 6837 var splices = []; | 6853 var splices = []; |
| 6838 node.indexes.sort(function(a, b) { | 6854 node.indexes.sort(function(a, b) { |
| 6839 return b - a; | 6855 return b - a; |
| 6840 }); | 6856 }); |
| 6841 node.indexes.forEach(function(index) { | 6857 node.indexes.forEach(function(index) { |
| 6842 if (node.leaf || this.removeItemsBeneathNode_(node.children[index])) { | 6858 if (node.leaf || this.removeItemsBeneathNode_(node.children[index])) { |
| 6843 var item = array.splice(index, 1); | 6859 var item = array.splice(index, 1)[0]; |
| 6844 splices.push({ | 6860 splices.push({ |
| 6845 index: index, | 6861 index: index, |
| 6846 removed: [ item ], | 6862 removed: [ item ], |
| 6847 addedCount: 0, | 6863 addedCount: 0, |
| 6848 object: array, | 6864 object: array, |
| 6849 type: 'splice' | 6865 type: 'splice' |
| 6850 }); | 6866 }); |
| 6867 if (item.index == undefined) return; |
| 6868 var browserService = md_history.BrowserService.getInstance(); |
| 6869 browserService.recordHistogram('HistoryPage.RemoveEntryPosition', item.i
ndex, UMA_MAX_BUCKET_VALUE); |
| 6870 if (item.index <= UMA_MAX_SUBSET_BUCKET_VALUE) { |
| 6871 browserService.recordHistogram('HistoryPage.RemoveEntryPositionSubset'
, item.index, UMA_MAX_SUBSET_BUCKET_VALUE); |
| 6872 } |
| 6851 } | 6873 } |
| 6852 }.bind(this)); | 6874 }.bind(this)); |
| 6853 if (array.length == 0) return true; | 6875 if (array.length == 0) return true; |
| 6854 this.notifySplices(node.currentPath, splices); | 6876 this.notifySplices(node.currentPath, splices); |
| 6855 return false; | 6877 return false; |
| 6856 }, | 6878 }, |
| 6857 itemSelected_: function(e) { | 6879 itemSelected_: function(e) { |
| 6858 var item = e.detail.element; | 6880 var item = e.detail.element; |
| 6859 var paths = []; | 6881 var paths = []; |
| 6860 var itemPath = item.path; | 6882 var itemPath = item.path; |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6960 currentDayVisits.push(visit); | 6982 currentDayVisits.push(visit); |
| 6961 } | 6983 } |
| 6962 pushCurrentDay(); | 6984 pushCurrentDay(); |
| 6963 this.groupedHistoryData_ = days; | 6985 this.groupedHistoryData_ = days; |
| 6964 } else if (this.range == HistoryRange.MONTH) { | 6986 } else if (this.range == HistoryRange.MONTH) { |
| 6965 this.groupedHistoryData_ = [ { | 6987 this.groupedHistoryData_ = [ { |
| 6966 title: this.queryStartTime + ' – ' + this.queryEndTime, | 6988 title: this.queryStartTime + ' – ' + this.queryEndTime, |
| 6967 domains: this.createHistoryDomains_(this.historyData) | 6989 domains: this.createHistoryDomains_(this.historyData) |
| 6968 } ]; | 6990 } ]; |
| 6969 } | 6991 } |
| 6992 this.refreshItemIndexes(); |
| 6993 }, |
| 6994 refreshItemIndexes: function() { |
| 6995 var index = 0; |
| 6996 this.groupedHistoryData_.forEach(function(group) { |
| 6997 group.domains.forEach(function(domain) { |
| 6998 domain.visits.forEach(function(visit) { |
| 6999 visit.index = index++; |
| 7000 }); |
| 7001 }); |
| 7002 }); |
| 6970 }, | 7003 }, |
| 6971 toggleDomainExpanded_: function(e) { | 7004 toggleDomainExpanded_: function(e) { |
| 6972 var collapse = e.currentTarget.parentNode.querySelector('iron-collapse'); | 7005 var collapse = e.currentTarget.parentNode.querySelector('iron-collapse'); |
| 6973 e.model.set('domain.rendered', true); | 7006 e.model.set('domain.rendered', true); |
| 6974 setTimeout(function() { | 7007 setTimeout(function() { |
| 6975 collapse.toggle(); | 7008 collapse.toggle(); |
| 6976 }, 0); | 7009 }, 0); |
| 6977 }, | 7010 }, |
| 6978 needsTimeGap_: function(groupIndex, domainIndex, itemIndex) { | 7011 needsTimeGap_: function(groupIndex, domainIndex, itemIndex) { |
| 6979 var visits = this.groupedHistoryData_[groupIndex].domains[domainIndex].visit
s; | 7012 var visits = this.groupedHistoryData_[groupIndex].domains[domainIndex].visit
s; |
| (...skipping 1078 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8058 this.resultLoadingDisabled_ = true; | 8091 this.resultLoadingDisabled_ = true; |
| 8059 }, | 8092 }, |
| 8060 addNewResults: function(historyResults, incremental) { | 8093 addNewResults: function(historyResults, incremental) { |
| 8061 var results = historyResults.slice(); | 8094 var results = historyResults.slice(); |
| 8062 this.$['scroll-threshold'].clearTriggers(); | 8095 this.$['scroll-threshold'].clearTriggers(); |
| 8063 if (!incremental) { | 8096 if (!incremental) { |
| 8064 this.resultLoadingDisabled_ = false; | 8097 this.resultLoadingDisabled_ = false; |
| 8065 if (this.historyData_) this.splice('historyData_', 0, this.historyData_.le
ngth); | 8098 if (this.historyData_) this.splice('historyData_', 0, this.historyData_.le
ngth); |
| 8066 this.fire('unselect-all'); | 8099 this.fire('unselect-all'); |
| 8067 } | 8100 } |
| 8101 var offset = this.historyData_ ? this.historyData_.length : 0; |
| 8102 results.forEach(function(item, index) { |
| 8103 item.index = index + offset; |
| 8104 }); |
| 8068 if (this.historyData_) { | 8105 if (this.historyData_) { |
| 8069 results.unshift('historyData_'); | 8106 results.unshift('historyData_'); |
| 8070 this.push.apply(this, results); | 8107 this.push.apply(this, results); |
| 8071 } else { | 8108 } else { |
| 8072 this.set('historyData_', results); | 8109 this.set('historyData_', results); |
| 8073 } | 8110 } |
| 8074 }, | 8111 }, |
| 8112 refreshItemIndexes: function() { |
| 8113 this.historyData_.forEach(function(item, index) { |
| 8114 item.index = index; |
| 8115 }); |
| 8116 }, |
| 8075 loadMoreData_: function() { | 8117 loadMoreData_: function() { |
| 8076 if (this.resultLoadingDisabled_ || this.querying) return; | 8118 if (this.resultLoadingDisabled_ || this.querying) return; |
| 8077 this.fire('load-more-history'); | 8119 this.fire('load-more-history'); |
| 8078 }, | 8120 }, |
| 8079 needsTimeGap_: function(item, index, length) { | 8121 needsTimeGap_: function(item, index, length) { |
| 8080 return md_history.HistoryItem.needsTimeGap(this.historyData_, index, this.se
archedTerm); | 8122 return md_history.HistoryItem.needsTimeGap(this.historyData_, index, this.se
archedTerm); |
| 8081 }, | 8123 }, |
| 8082 isCardStart_: function(item, i, length) { | 8124 isCardStart_: function(item, i, length) { |
| 8083 if (length == 0 || i > length - 1) return false; | 8125 if (length == 0 || i > length - 1) return false; |
| 8084 return i == 0 || this.historyData_[i].dateRelativeDay != this.historyData_[i
- 1].dateRelativeDay; | 8126 return i == 0 || this.historyData_[i].dateRelativeDay != this.historyData_[i
- 1].dateRelativeDay; |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8200 }, | 8242 }, |
| 8201 getSelectedItemCount: function() { | 8243 getSelectedItemCount: function() { |
| 8202 return this.getSelectedList_().selectedPaths.size; | 8244 return this.getSelectedList_().selectedPaths.size; |
| 8203 }, | 8245 }, |
| 8204 unselectAllItems: function(count) { | 8246 unselectAllItems: function(count) { |
| 8205 var selectedList = this.getSelectedList_(); | 8247 var selectedList = this.getSelectedList_(); |
| 8206 if (selectedList) selectedList.unselectAllItems(count); | 8248 if (selectedList) selectedList.unselectAllItems(count); |
| 8207 }, | 8249 }, |
| 8208 deleteSelectedWithPrompt: function() { | 8250 deleteSelectedWithPrompt: function() { |
| 8209 if (!loadTimeData.getBoolean('allowDeletingHistory')) return; | 8251 if (!loadTimeData.getBoolean('allowDeletingHistory')) return; |
| 8252 var browserService = md_history.BrowserService.getInstance(); |
| 8253 browserService.recordAction('RemoveSelected'); |
| 8254 if (this.searchTerm != '') browserService.recordAction('SearchResultRemove')
; |
| 8210 this.$.dialog.get().then(function(dialog) { | 8255 this.$.dialog.get().then(function(dialog) { |
| 8211 dialog.showModal(); | 8256 dialog.showModal(); |
| 8212 }); | 8257 }); |
| 8213 }, | 8258 }, |
| 8214 groupedRangeChanged_: function(range, oldRange) { | 8259 groupedRangeChanged_: function(range, oldRange) { |
| 8215 this.selectedPage_ = range == HistoryRange.ALL_TIME ? 'infinite-list' : 'gro
uped-list'; | 8260 this.selectedPage_ = range == HistoryRange.ALL_TIME ? 'infinite-list' : 'gro
uped-list'; |
| 8216 if (oldRange == undefined) return; | 8261 if (oldRange == undefined) return; |
| 8217 this.queryHistory(false); | 8262 this.queryHistory(false); |
| 8218 this.fire('history-view-changed'); | 8263 this.fire('history-view-changed'); |
| 8219 }, | 8264 }, |
| 8220 loadMoreHistory_: function() { | 8265 loadMoreHistory_: function() { |
| 8221 this.queryHistory(true); | 8266 this.queryHistory(true); |
| 8222 }, | 8267 }, |
| 8223 initializeResults_: function(info, results) { | 8268 initializeResults_: function(info, results) { |
| 8224 if (results.length == 0) return; | 8269 if (results.length == 0) return; |
| 8225 var currentDate = results[0].dateRelativeDay; | 8270 var currentDate = results[0].dateRelativeDay; |
| 8226 for (var i = 0; i < results.length; i++) { | 8271 for (var i = 0; i < results.length; i++) { |
| 8227 results[i].selected = false; | 8272 results[i].selected = false; |
| 8228 results[i].readableTimestamp = info.term == '' ? results[i].dateTimeOfDay
: results[i].dateShort; | 8273 results[i].readableTimestamp = info.term == '' ? results[i].dateTimeOfDay
: results[i].dateShort; |
| 8229 if (results[i].dateRelativeDay != currentDate) { | 8274 if (results[i].dateRelativeDay != currentDate) { |
| 8230 currentDate = results[i].dateRelativeDay; | 8275 currentDate = results[i].dateRelativeDay; |
| 8231 } | 8276 } |
| 8232 } | 8277 } |
| 8233 }, | 8278 }, |
| 8234 onDialogConfirmTap_: function() { | 8279 onDialogConfirmTap_: function() { |
| 8280 md_history.BrowserService.getInstance().recordAction('ConfirmRemoveSelected'
); |
| 8235 this.getSelectedList_().deleteSelected(); | 8281 this.getSelectedList_().deleteSelected(); |
| 8236 var dialog = assert(this.$.dialog.getIfExists()); | 8282 var dialog = assert(this.$.dialog.getIfExists()); |
| 8237 dialog.close(); | 8283 dialog.close(); |
| 8238 }, | 8284 }, |
| 8239 onDialogCancelTap_: function() { | 8285 onDialogCancelTap_: function() { |
| 8286 md_history.BrowserService.getInstance().recordAction('CancelRemoveSelected')
; |
| 8240 var dialog = assert(this.$.dialog.getIfExists()); | 8287 var dialog = assert(this.$.dialog.getIfExists()); |
| 8241 dialog.close(); | 8288 dialog.close(); |
| 8242 }, | 8289 }, |
| 8243 closeMenu_: function() { | 8290 closeMenu_: function() { |
| 8244 var menu = this.$.sharedMenu.getIfExists(); | 8291 var menu = this.$.sharedMenu.getIfExists(); |
| 8245 if (menu) menu.closeMenu(); | 8292 if (menu) menu.closeMenu(); |
| 8246 }, | 8293 }, |
| 8247 toggleMenu_: function(e) { | 8294 toggleMenu_: function(e) { |
| 8248 var target = e.detail.target; | 8295 var target = e.detail.target; |
| 8249 return this.$.sharedMenu.get().then(function(menu) { | 8296 return this.$.sharedMenu.get().then(function(menu) { |
| 8250 menu.toggleMenu(target, e.detail); | 8297 menu.toggleMenu(target, e.detail); |
| 8251 }); | 8298 }); |
| 8252 }, | 8299 }, |
| 8253 onMoreFromSiteTap_: function() { | 8300 onMoreFromSiteTap_: function() { |
| 8301 md_history.BrowserService.getInstance().recordAction('EntryMenuShowMoreFromS
ite'); |
| 8254 var menu = assert(this.$.sharedMenu.getIfExists()); | 8302 var menu = assert(this.$.sharedMenu.getIfExists()); |
| 8255 this.fire('search-domain', { | 8303 this.fire('search-domain', { |
| 8256 domain: menu.itemData.item.domain | 8304 domain: menu.itemData.item.domain |
| 8257 }); | 8305 }); |
| 8258 menu.closeMenu(); | 8306 menu.closeMenu(); |
| 8259 }, | 8307 }, |
| 8260 onRemoveFromHistoryTap_: function() { | 8308 onRemoveFromHistoryTap_: function() { |
| 8309 var browserService = md_history.BrowserService.getInstance(); |
| 8310 browserService.recordAction('EntryMenuRemoveFromHistory'); |
| 8261 var menu = assert(this.$.sharedMenu.getIfExists()); | 8311 var menu = assert(this.$.sharedMenu.getIfExists()); |
| 8262 var itemData = menu.itemData; | 8312 var itemData = menu.itemData; |
| 8263 md_history.BrowserService.getInstance().deleteItems([ itemData.item ]).then(
function(items) { | 8313 browserService.deleteItems([ itemData.item ]).then(function(items) { |
| 8264 this.getSelectedList_().removeItemsByPath([ itemData.path ]); | 8314 this.getSelectedList_().removeItemsByPath([ itemData.path ]); |
| 8265 this.fire('unselect-all'); | 8315 this.fire('unselect-all'); |
| 8266 }.bind(this)); | 8316 }.bind(this)); |
| 8267 menu.closeMenu(); | 8317 menu.closeMenu(); |
| 8268 }, | 8318 }, |
| 8269 getSelectedList_: function() { | 8319 getSelectedList_: function() { |
| 8270 return this.$.content.selectedItem; | 8320 return this.$.content.selectedItem; |
| 8271 } | 8321 } |
| 8272 }); | 8322 }); |
| 8273 | 8323 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 8286 }, | 8336 }, |
| 8287 observer: 'updateIcons_' | 8337 observer: 'updateIcons_' |
| 8288 }, | 8338 }, |
| 8289 separatorIndexes: Array, | 8339 separatorIndexes: Array, |
| 8290 opened: Boolean, | 8340 opened: Boolean, |
| 8291 searchTerm: String, | 8341 searchTerm: String, |
| 8292 sessionTag: String | 8342 sessionTag: String |
| 8293 }, | 8343 }, |
| 8294 openTab_: function(e) { | 8344 openTab_: function(e) { |
| 8295 var tab = e.model.tab; | 8345 var tab = e.model.tab; |
| 8296 md_history.BrowserService.getInstance().openForeignSessionTab(this.sessionTa
g, tab.windowId, tab.sessionId, e); | 8346 var browserService = md_history.BrowserService.getInstance(); |
| 8347 browserService.recordHistogram(SYNCED_TABS_HISTOGRAM_NAME, SyncedTabsHistogr
am.LINK_CLICKED, SyncedTabsHistogram.LIMIT); |
| 8348 browserService.openForeignSessionTab(this.sessionTag, tab.windowId, tab.sess
ionId, e); |
| 8297 e.preventDefault(); | 8349 e.preventDefault(); |
| 8298 }, | 8350 }, |
| 8299 toggleTabCard: function() { | 8351 toggleTabCard: function() { |
| 8352 var histogramValue = this.$.collapse.opened ? SyncedTabsHistogram.COLLAPSE_S
ESSION : SyncedTabsHistogram.EXPAND_SESSION; |
| 8353 md_history.BrowserService.getInstance().recordHistogram(SYNCED_TABS_HISTOGRA
M_NAME, histogramValue, SyncedTabsHistogram.LIMIT); |
| 8300 this.$.collapse.toggle(); | 8354 this.$.collapse.toggle(); |
| 8301 this.$['dropdown-indicator'].icon = this.$.collapse.opened ? 'cr:expand-less
' : 'cr:expand-more'; | 8355 this.$['dropdown-indicator'].icon = this.$.collapse.opened ? 'cr:expand-less
' : 'cr:expand-more'; |
| 8302 }, | 8356 }, |
| 8303 updateIcons_: function() { | 8357 updateIcons_: function() { |
| 8304 this.async(function() { | 8358 this.async(function() { |
| 8305 var icons = Polymer.dom(this.root).querySelectorAll('.website-icon'); | 8359 var icons = Polymer.dom(this.root).querySelectorAll('.website-icon'); |
| 8306 for (var i = 0; i < this.tabs.length; i++) { | 8360 for (var i = 0; i < this.tabs.length; i++) { |
| 8307 icons[i].style.backgroundImage = cr.icon.getFaviconImageSet(this.tabs[i]
.url); | 8361 icons[i].style.backgroundImage = cr.icon.getFaviconImageSet(this.tabs[i]
.url); |
| 8308 } | 8362 } |
| 8309 }); | 8363 }); |
| 8310 }, | 8364 }, |
| 8311 isWindowSeparatorIndex_: function(index, separatorIndexes) { | 8365 isWindowSeparatorIndex_: function(index, separatorIndexes) { |
| 8312 return this.separatorIndexes.indexOf(index) != -1; | 8366 return this.separatorIndexes.indexOf(index) != -1; |
| 8313 }, | 8367 }, |
| 8314 getCollapseIcon_: function(opened) { | 8368 getCollapseIcon_: function(opened) { |
| 8315 return opened ? 'cr:expand-less' : 'cr:expand-more'; | 8369 return opened ? 'cr:expand-less' : 'cr:expand-more'; |
| 8316 }, | 8370 }, |
| 8317 getCollapseTitle_: function(opened) { | 8371 getCollapseTitle_: function(opened) { |
| 8318 return opened ? loadTimeData.getString('collapseSessionButton') : loadTimeDa
ta.getString('expandSessionButton'); | 8372 return opened ? loadTimeData.getString('collapseSessionButton') : loadTimeDa
ta.getString('expandSessionButton'); |
| 8319 }, | 8373 }, |
| 8320 onMenuButtonTap_: function(e) { | 8374 onMenuButtonTap_: function(e) { |
| 8321 this.fire('toggle-menu', { | 8375 this.fire('toggle-menu', { |
| 8322 target: Polymer.dom(e).localTarget, | 8376 target: Polymer.dom(e).localTarget, |
| 8323 tag: this.sessionTag | 8377 tag: this.sessionTag |
| 8324 }); | 8378 }); |
| 8325 e.stopPropagation(); | 8379 e.stopPropagation(); |
| 8380 }, |
| 8381 onLinkRightClick_: function() { |
| 8382 md_history.BrowserService.getInstance().recordHistogram(SYNCED_TABS_HISTOGRA
M_NAME, SyncedTabsHistogram.LINK_RIGHT_CLICKED, SyncedTabsHistogram.LIMIT); |
| 8326 } | 8383 } |
| 8327 }); | 8384 }); |
| 8328 | 8385 |
| 8329 // Copyright 2016 The Chromium Authors. All rights reserved. | 8386 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 8330 // Use of this source code is governed by a BSD-style license that can be | 8387 // Use of this source code is governed by a BSD-style license that can be |
| 8331 // found in the LICENSE file. | 8388 // found in the LICENSE file. |
| 8332 var ForeignDeviceInternal; | 8389 var ForeignDeviceInternal; |
| 8333 | 8390 |
| 8334 Polymer({ | 8391 Polymer({ |
| 8335 is: 'history-synced-device-manager', | 8392 is: 'history-synced-device-manager', |
| (...skipping 16 matching lines...) Expand all Loading... |
| 8352 type: Boolean, | 8409 type: Boolean, |
| 8353 observer: 'signInStateChanged_' | 8410 observer: 'signInStateChanged_' |
| 8354 }, | 8411 }, |
| 8355 guestSession_: { | 8412 guestSession_: { |
| 8356 type: Boolean, | 8413 type: Boolean, |
| 8357 value: loadTimeData.getBoolean('isGuestSession') | 8414 value: loadTimeData.getBoolean('isGuestSession') |
| 8358 }, | 8415 }, |
| 8359 fetchingSyncedTabs_: { | 8416 fetchingSyncedTabs_: { |
| 8360 type: Boolean, | 8417 type: Boolean, |
| 8361 value: false | 8418 value: false |
| 8362 } | 8419 }, |
| 8420 hasSeenForeignData_: Boolean |
| 8363 }, | 8421 }, |
| 8364 listeners: { | 8422 listeners: { |
| 8365 'toggle-menu': 'onToggleMenu_', | 8423 'toggle-menu': 'onToggleMenu_', |
| 8366 scroll: 'onListScroll_' | 8424 scroll: 'onListScroll_' |
| 8367 }, | 8425 }, |
| 8368 attached: function() { | 8426 attached: function() { |
| 8369 chrome.send('otherDevicesInitialized'); | 8427 chrome.send('otherDevicesInitialized'); |
| 8428 md_history.BrowserService.getInstance().recordHistogram(SYNCED_TABS_HISTOGRA
M_NAME, SyncedTabsHistogram.INITIALIZED, SyncedTabsHistogram.LIMIT); |
| 8370 }, | 8429 }, |
| 8371 createInternalDevice_: function(session) { | 8430 createInternalDevice_: function(session) { |
| 8372 var tabs = []; | 8431 var tabs = []; |
| 8373 var separatorIndexes = []; | 8432 var separatorIndexes = []; |
| 8374 for (var i = 0; i < session.windows.length; i++) { | 8433 for (var i = 0; i < session.windows.length; i++) { |
| 8375 var windowId = session.windows[i].sessionId; | 8434 var windowId = session.windows[i].sessionId; |
| 8376 var newTabs = session.windows[i].tabs; | 8435 var newTabs = session.windows[i].tabs; |
| 8377 if (newTabs.length == 0) continue; | 8436 if (newTabs.length == 0) continue; |
| 8378 newTabs.forEach(function(tab) { | 8437 newTabs.forEach(function(tab) { |
| 8379 tab.windowId = windowId; | 8438 tab.windowId = windowId; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 8407 onSignInTap_: function() { | 8466 onSignInTap_: function() { |
| 8408 chrome.send('startSignInFlow'); | 8467 chrome.send('startSignInFlow'); |
| 8409 }, | 8468 }, |
| 8410 onListScroll_: function() { | 8469 onListScroll_: function() { |
| 8411 var menu = this.$.menu.getIfExists(); | 8470 var menu = this.$.menu.getIfExists(); |
| 8412 if (menu) menu.closeMenu(); | 8471 if (menu) menu.closeMenu(); |
| 8413 }, | 8472 }, |
| 8414 onToggleMenu_: function(e) { | 8473 onToggleMenu_: function(e) { |
| 8415 this.$.menu.get().then(function(menu) { | 8474 this.$.menu.get().then(function(menu) { |
| 8416 menu.toggleMenu(e.detail.target, e.detail.tag); | 8475 menu.toggleMenu(e.detail.target, e.detail.tag); |
| 8476 if (menu.menuOpen) { |
| 8477 md_history.BrowserService.getInstance().recordHistogram(SYNCED_TABS_HIST
OGRAM_NAME, SyncedTabsHistogram.SHOW_SESSION_MENU, SyncedTabsHistogram.LIMIT); |
| 8478 } |
| 8417 }); | 8479 }); |
| 8418 }, | 8480 }, |
| 8419 onOpenAllTap_: function() { | 8481 onOpenAllTap_: function() { |
| 8420 var menu = assert(this.$.menu.getIfExists()); | 8482 var menu = assert(this.$.menu.getIfExists()); |
| 8421 md_history.BrowserService.getInstance().openForeignSessionAllTabs(menu.itemD
ata); | 8483 var browserService = md_history.BrowserService.getInstance(); |
| 8484 browserService.recordHistogram(SYNCED_TABS_HISTOGRAM_NAME, SyncedTabsHistogr
am.OPEN_ALL, SyncedTabsHistogram.LIMIT); |
| 8485 browserService.openForeignSessionAllTabs(menu.itemData); |
| 8422 menu.closeMenu(); | 8486 menu.closeMenu(); |
| 8423 }, | 8487 }, |
| 8424 onDeleteSessionTap_: function() { | 8488 onDeleteSessionTap_: function() { |
| 8425 var menu = assert(this.$.menu.getIfExists()); | 8489 var menu = assert(this.$.menu.getIfExists()); |
| 8426 md_history.BrowserService.getInstance().deleteForeignSession(menu.itemData); | 8490 var browserService = md_history.BrowserService.getInstance(); |
| 8491 browserService.recordHistogram(SYNCED_TABS_HISTOGRAM_NAME, SyncedTabsHistogr
am.HIDE_FOR_NOW, SyncedTabsHistogram.LIMIT); |
| 8492 browserService.deleteForeignSession(menu.itemData); |
| 8427 menu.closeMenu(); | 8493 menu.closeMenu(); |
| 8428 }, | 8494 }, |
| 8429 clearDisplayedSyncedDevices_: function() { | 8495 clearDisplayedSyncedDevices_: function() { |
| 8430 this.syncedDevices_ = []; | 8496 this.syncedDevices_ = []; |
| 8431 }, | 8497 }, |
| 8432 showNoSyncedMessage: function(signInState, syncedDevicesLength, guestSession)
{ | 8498 showNoSyncedMessage: function(signInState, syncedDevicesLength, guestSession)
{ |
| 8433 if (guestSession) return true; | 8499 if (guestSession) return true; |
| 8434 return signInState && syncedDevicesLength == 0; | 8500 return signInState && syncedDevicesLength == 0; |
| 8435 }, | 8501 }, |
| 8436 showSignInGuide: function(signInState, guestSession) { | 8502 showSignInGuide: function(signInState, guestSession) { |
| 8437 var show = !signInState && !guestSession; | 8503 var show = !signInState && !guestSession; |
| 8438 if (show) { | 8504 if (show) { |
| 8439 md_history.BrowserService.getInstance().recordAction('Signin_Impression_Fr
omRecentTabs'); | 8505 md_history.BrowserService.getInstance().recordAction('Signin_Impression_Fr
omRecentTabs'); |
| 8440 } | 8506 } |
| 8441 return show; | 8507 return show; |
| 8442 }, | 8508 }, |
| 8443 noSyncedTabsMessage: function(fetchingSyncedTabs) { | 8509 noSyncedTabsMessage: function(fetchingSyncedTabs) { |
| 8444 return loadTimeData.getString(fetchingSyncedTabs ? 'loading' : 'noSyncedResu
lts'); | 8510 return loadTimeData.getString(fetchingSyncedTabs ? 'loading' : 'noSyncedResu
lts'); |
| 8445 }, | 8511 }, |
| 8446 updateSyncedDevices: function(sessionList) { | 8512 updateSyncedDevices: function(sessionList) { |
| 8447 this.fetchingSyncedTabs_ = false; | 8513 this.fetchingSyncedTabs_ = false; |
| 8448 if (!sessionList) return; | 8514 if (!sessionList) return; |
| 8515 if (sessionList.length > 0 && !this.hasSeenForeignData_) { |
| 8516 this.hasSeenForeignData_ = true; |
| 8517 md_history.BrowserService.getInstance().recordHistogram(SYNCED_TABS_HISTOG
RAM_NAME, SyncedTabsHistogram.HAS_FOREIGN_DATA, SyncedTabsHistogram.LIMIT); |
| 8518 } |
| 8449 var updateCount = Math.min(sessionList.length, this.syncedDevices_.length); | 8519 var updateCount = Math.min(sessionList.length, this.syncedDevices_.length); |
| 8450 for (var i = 0; i < updateCount; i++) { | 8520 for (var i = 0; i < updateCount; i++) { |
| 8451 var oldDevice = this.syncedDevices_[i]; | 8521 var oldDevice = this.syncedDevices_[i]; |
| 8452 if (oldDevice.tag != sessionList[i].tag || oldDevice.timestamp != sessionL
ist[i].timestamp) { | 8522 if (oldDevice.tag != sessionList[i].tag || oldDevice.timestamp != sessionL
ist[i].timestamp) { |
| 8453 this.splice('syncedDevices_', i, 1, this.createInternalDevice_(sessionLi
st[i])); | 8523 this.splice('syncedDevices_', i, 1, this.createInternalDevice_(sessionLi
st[i])); |
| 8454 } | 8524 } |
| 8455 } | 8525 } |
| 8456 if (sessionList.length >= this.syncedDevices_.length) { | 8526 if (sessionList.length >= this.syncedDevices_.length) { |
| 8457 for (var i = updateCount; i < sessionList.length; i++) { | 8527 for (var i = updateCount; i < sessionList.length; i++) { |
| 8458 this.push('syncedDevices_', this.createInternalDevice_(sessionList[i])); | 8528 this.push('syncedDevices_', this.createInternalDevice_(sessionList[i])); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8498 showFooter: Boolean, | 8568 showFooter: Boolean, |
| 8499 drawer: { | 8569 drawer: { |
| 8500 type: Boolean, | 8570 type: Boolean, |
| 8501 reflectToAttribute: true | 8571 reflectToAttribute: true |
| 8502 } | 8572 } |
| 8503 }, | 8573 }, |
| 8504 onSelectorActivate_: function() { | 8574 onSelectorActivate_: function() { |
| 8505 this.fire('history-close-drawer'); | 8575 this.fire('history-close-drawer'); |
| 8506 }, | 8576 }, |
| 8507 onClearBrowsingDataTap_: function(e) { | 8577 onClearBrowsingDataTap_: function(e) { |
| 8508 md_history.BrowserService.getInstance().recordAction('HistoryPage_InitClearB
rowsingData'); | 8578 var browserService = md_history.BrowserService.getInstance(); |
| 8509 md_history.BrowserService.getInstance().openClearBrowsingData(); | 8579 browserService.getInstance().recordAction('InitClearBrowsingData'); |
| 8580 browserService.openClearBrowsingData(); |
| 8510 e.preventDefault(); | 8581 e.preventDefault(); |
| 8511 }, | 8582 }, |
| 8512 getQueryString_: function(route) { | 8583 getQueryString_: function(route) { |
| 8513 return window.location.search; | 8584 return window.location.search; |
| 8514 } | 8585 } |
| 8515 }); | 8586 }); |
| 8516 | 8587 |
| 8517 // Copyright 2016 The Chromium Authors. All rights reserved. | 8588 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 8518 // Use of this source code is governed by a BSD-style license that can be | 8589 // Use of this source code is governed by a BSD-style license that can be |
| 8519 // found in the LICENSE file. | 8590 // found in the LICENSE file. |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8635 break; | 8706 break; |
| 8636 | 8707 |
| 8637 case 'delete-command': | 8708 case 'delete-command': |
| 8638 e.canExecute = this.$.toolbar.count > 0; | 8709 e.canExecute = this.$.toolbar.count > 0; |
| 8639 break; | 8710 break; |
| 8640 } | 8711 } |
| 8641 }, | 8712 }, |
| 8642 searchTermChanged_: function(searchTerm) { | 8713 searchTermChanged_: function(searchTerm) { |
| 8643 this.set('queryParams_.q', searchTerm || null); | 8714 this.set('queryParams_.q', searchTerm || null); |
| 8644 this.$['history'].queryHistory(false); | 8715 this.$['history'].queryHistory(false); |
| 8716 if (this.queryState_.searchTerm) md_history.BrowserService.getInstance().rec
ordAction('Search'); |
| 8645 }, | 8717 }, |
| 8646 searchQueryParamChanged_: function(searchQuery) { | 8718 searchQueryParamChanged_: function(searchQuery) { |
| 8647 this.$.toolbar.setSearchTerm(searchQuery || ''); | 8719 this.$.toolbar.setSearchTerm(searchQuery || ''); |
| 8648 }, | 8720 }, |
| 8649 onCommand_: function(e) { | 8721 onCommand_: function(e) { |
| 8650 if (e.command.id == 'find-command' || e.command.id == 'slash-command') this.
focusToolbarSearchField(); | 8722 if (e.command.id == 'find-command' || e.command.id == 'slash-command') this.
focusToolbarSearchField(); |
| 8651 if (e.command.id == 'delete-command') this.deleteSelected(); | 8723 if (e.command.id == 'delete-command') this.deleteSelected(); |
| 8652 }, | 8724 }, |
| 8653 setForeignSessions: function(sessionList, isTabSyncEnabled) { | 8725 setForeignSessions: function(sessionList, isTabSyncEnabled) { |
| 8654 if (!isTabSyncEnabled) { | 8726 if (!isTabSyncEnabled) { |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8703 | 8775 |
| 8704 case HistoryRange.MONTH: | 8776 case HistoryRange.MONTH: |
| 8705 histogramValue = HistoryViewHistogram.GROUPED_MONTH; | 8777 histogramValue = HistoryViewHistogram.GROUPED_MONTH; |
| 8706 break; | 8778 break; |
| 8707 } | 8779 } |
| 8708 break; | 8780 break; |
| 8709 } | 8781 } |
| 8710 md_history.BrowserService.getInstance().recordHistogram('History.HistoryView
', histogramValue, HistoryViewHistogram.END); | 8782 md_history.BrowserService.getInstance().recordHistogram('History.HistoryView
', histogramValue, HistoryViewHistogram.END); |
| 8711 } | 8783 } |
| 8712 }); | 8784 }); |
| OLD | NEW |