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

Side by Side Diff: chrome/browser/resources/md_history/grouped_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 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 /** 5 /**
6 * @typedef {{domain: string, 6 * @typedef {{domain: string,
7 * visits: !Array<HistoryEntry>, 7 * visits: !Array<HistoryEntry>,
8 * rendered: boolean, 8 * rendered: boolean,
9 * expanded: boolean}} 9 * expanded: boolean}}
10 */ 10 */
11 var HistoryDomain; 11 var HistoryDomain;
12 12
13 /** 13 /**
14 * @typedef {{title: string, 14 * @typedef {{title: string,
15 * domains: !Array<HistoryDomain>}} 15 * domains: !Array<HistoryDomain>}}
16 */ 16 */
17 var HistoryGroup; 17 var HistoryGroup;
18 18
19 Polymer({ 19 Polymer({
20 is: 'history-grouped-list', 20 is: 'history-grouped-list',
21 21
22 behaviors: [HistoryListBehavior], 22 behaviors: [HistoryListBehavior],
23 23
24 properties: { 24 properties: {
25 // An array of history entries in reverse chronological order. 25 searchedTerm: {
26 historyData: { 26 type: String,
27 type: Array, 27 value: '',
28 }, 28 },
29 29
30 /** 30 /**
31 * @type {Array<HistoryGroup>} 31 * @type {Array<HistoryGroup>}
32 */ 32 */
33 groupedHistoryData_: { 33 groupedHistoryData_: Array,
34 type: Array,
35 },
36 34
37 searchedTerm: { 35 // An array of history entries in reverse chronological order.
38 type: String, 36 historyData: Array,
39 value: ''
40 },
41
42 range: {
43 type: Number,
44 },
45 37
46 queryStartTime: String, 38 queryStartTime: String,
39
47 queryEndTime: String, 40 queryEndTime: String,
41
42 range: Number,
48 }, 43 },
49 44
50 observers: [ 45 observers: ['updateGroupedHistoryData_(range, historyData)'],
51 'updateGroupedHistoryData_(range, historyData)'
52 ],
53 46
54 /** 47 /**
55 * @param {!Array<!HistoryEntry>} results 48 * @param {!Array<!HistoryEntry>} results
56 * @param {boolean} incremental 49 * @param {boolean} incremental
57 * @param {boolean} finished 50 * @param {boolean} finished
58 */ 51 */
59 addNewResults: function(results, incremental, finished) { 52 addNewResults: function(results, incremental, finished) {
60 this.historyData = results; 53 this.historyData = results;
61 }, 54 },
62 55
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 } 92 }
100 93
101 if (this.range == HistoryRange.WEEK) { 94 if (this.range == HistoryRange.WEEK) {
102 // Group each day into a list of results. 95 // Group each day into a list of results.
103 var days = []; 96 var days = [];
104 var currentDayVisits = [this.historyData[0]]; 97 var currentDayVisits = [this.historyData[0]];
105 98
106 var pushCurrentDay = function() { 99 var pushCurrentDay = function() {
107 days.push({ 100 days.push({
108 title: this.searchedTerm ? currentDayVisits[0].dateShort : 101 title: this.searchedTerm ? currentDayVisits[0].dateShort :
109 currentDayVisits[0].dateRelativeDay, 102 currentDayVisits[0].dateRelativeDay,
110 domains: this.createHistoryDomains_(currentDayVisits), 103 domains: this.createHistoryDomains_(currentDayVisits),
111 }); 104 });
112 }.bind(this); 105 }.bind(this);
113 106
114 var visitsSameDay = function(a, b) { 107 var visitsSameDay = function(a, b) {
115 if (this.searchedTerm) 108 if (this.searchedTerm)
116 return a.dateShort == b.dateShort; 109 return a.dateShort == b.dateShort;
117 110
118 return a.dateRelativeDay == b.dateRelativeDay; 111 return a.dateRelativeDay == b.dateRelativeDay;
119 }.bind(this); 112 }.bind(this);
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 184
192 /** 185 /**
193 * @param {boolean} expanded 186 * @param {boolean} expanded
194 * @return {string} 187 * @return {string}
195 * @private 188 * @private
196 */ 189 */
197 getDropdownIcon_: function(expanded) { 190 getDropdownIcon_: function(expanded) {
198 return expanded ? 'cr:expand-less' : 'cr:expand-more'; 191 return expanded ? 'cr:expand-less' : 'cr:expand-more';
199 }, 192 },
200 }); 193 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/md_history/constants.js ('k') | chrome/browser/resources/md_history/history.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698