Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1066)

Side by Side Diff: chrome/browser/resources/md_history/history_list.js

Issue 2578013002: [MD History] clang-format all javascript. (Closed)
Patch Set: rebase Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 Polymer({ 5 Polymer({
6 is: 'history-list', 6 is: 'history-list',
7 7
8 behaviors: [HistoryListBehavior], 8 behaviors: [HistoryListBehavior],
9 9
10 properties: { 10 properties: {
11 // The search term for the current query. Set when the query returns. 11 // The search term for the current query. Set when the query returns.
12 searchedTerm: { 12 searchedTerm: {
13 type: String, 13 type: String,
14 value: '', 14 value: '',
15 }, 15 },
16 16
17 querying: Boolean,
18
19 // An array of history entries in reverse chronological order.
20 historyData_: Array,
21
22 resultLoadingDisabled_: { 17 resultLoadingDisabled_: {
23 type: Boolean, 18 type: Boolean,
24 value: false, 19 value: false,
25 }, 20 },
26 21
22 // An array of history entries in reverse chronological order.
23 historyData_: Array,
24
27 lastFocused_: Object, 25 lastFocused_: Object,
26
27 querying: Boolean,
28 }, 28 },
29 29
30 listeners: { 30 listeners: {
31 'scroll': 'notifyListScroll_', 31 'scroll': 'notifyListScroll_',
32 'remove-bookmark-stars': 'removeBookmarkStars_', 32 'remove-bookmark-stars': 'removeBookmarkStars_',
33 }, 33 },
34 34
35 /** @override */ 35 /** @override */
36 attached: function() { 36 attached: function() {
37 // It is possible (eg, when middle clicking the reload button) for all other 37 // It is possible (eg, when middle clicking the reload button) for all other
38 // resize events to fire before the list is attached and can be measured. 38 // resize events to fire before the list is attached and can be measured.
39 // Adding another resize here ensures it will get sized correctly. 39 // Adding another resize here ensures it will get sized correctly.
40 /** @type {IronListElement} */(this.$['infinite-list']).notifyResize(); 40 /** @type {IronListElement} */ (this.$['infinite-list']).notifyResize();
41 this.$['infinite-list'].scrollTarget = this; 41 this.$['infinite-list'].scrollTarget = this;
42 this.$['scroll-threshold'].scrollTarget = this; 42 this.$['scroll-threshold'].scrollTarget = this;
43 }, 43 },
44 44
45 /** 45 /**
46 * Remove bookmark star for history items with matching URLs. 46 * Remove bookmark star for history items with matching URLs.
47 * @param {{detail: !string}} e 47 * @param {{detail: !string}} e
48 * @private 48 * @private
49 */ 49 */
50 removeBookmarkStars_: function(e) { 50 removeBookmarkStars_: function(e) {
(...skipping 12 matching lines...) Expand all
63 * Adds the newly updated history results into historyData_. Adds new fields 63 * Adds the newly updated history results into historyData_. Adds new fields
64 * for each result. 64 * for each result.
65 * @param {!Array<!HistoryEntry>} historyResults The new history results. 65 * @param {!Array<!HistoryEntry>} historyResults The new history results.
66 * @param {boolean} incremental Whether the result is from loading more 66 * @param {boolean} incremental Whether the result is from loading more
67 * history, or a new search/list reload. 67 * history, or a new search/list reload.
68 * @param {boolean} finished True if there are no more results available and 68 * @param {boolean} finished True if there are no more results available and
69 * result loading should be disabled. 69 * result loading should be disabled.
70 */ 70 */
71 addNewResults: function(historyResults, incremental, finished) { 71 addNewResults: function(historyResults, incremental, finished) {
72 var results = historyResults.slice(); 72 var results = historyResults.slice();
73 /** @type {IronScrollThresholdElement} */(this.$['scroll-threshold']) 73 /** @type {IronScrollThresholdElement} */ (this.$['scroll-threshold'])
74 .clearTriggers(); 74 .clearTriggers();
75 75
76 if (!incremental) { 76 if (!incremental) {
77 this.resultLoadingDisabled_ = false; 77 this.resultLoadingDisabled_ = false;
78 if (this.historyData_) 78 if (this.historyData_)
79 this.splice('historyData_', 0, this.historyData_.length); 79 this.splice('historyData_', 0, this.historyData_.length);
80 this.fire('unselect-all'); 80 this.fire('unselect-all');
81 } 81 }
82 82
83 if (this.historyData_) { 83 if (this.historyData_) {
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 if (length == 0 || i > length - 1) 147 if (length == 0 || i > length - 1)
148 return false; 148 return false;
149 return i == length - 1 || 149 return i == length - 1 ||
150 this.historyData_[i].dateRelativeDay != 150 this.historyData_[i].dateRelativeDay !=
151 this.historyData_[i + 1].dateRelativeDay; 151 this.historyData_[i + 1].dateRelativeDay;
152 }, 152 },
153 153
154 /** 154 /**
155 * @private 155 * @private
156 */ 156 */
157 notifyListScroll_: function() { 157 notifyListScroll_: function() { this.fire('history-list-scrolled'); },
158 this.fire('history-list-scrolled');
159 },
160 158
161 /** 159 /**
162 * @param {number} index 160 * @param {number} index
163 * @return {string} 161 * @return {string}
164 * @private 162 * @private
165 */ 163 */
166 pathForItem_: function(index) { 164 pathForItem_: function(index) { return 'historyData_.' + index; },
167 return 'historyData_.' + index;
168 },
169 }); 165 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/md_history/history_item.js ('k') | chrome/browser/resources/md_history/history_list_behavior.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698