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

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

Issue 2207323002: [MD History] Factor out a common HistoryListBehavior. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix nits Created 4 years, 4 months 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 // TODO(calamity): Support selection by refactoring selection out of
20 // history-list and into history-app.
21 Polymer({ 19 Polymer({
22 is: 'history-grouped-list', 20 is: 'history-grouped-list',
23 21
22 behaviors: [HistoryListBehavior],
23
24 properties: { 24 properties: {
25 // An array of history entries in reverse chronological order. 25 // An array of history entries in reverse chronological order.
26 historyData: { 26 historyData: {
27 type: Array, 27 type: Array,
28 }, 28 },
29 29
30 /** 30 /**
31 * @type {Array<HistoryGroup>} 31 * @type {Array<HistoryGroup>}
32 */ 32 */
33 groupedHistoryData_: { 33 groupedHistoryData_: {
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 * @private 149 * @private
150 */ 150 */
151 needsTimeGap_: function(groupIndex, domainIndex, itemIndex) { 151 needsTimeGap_: function(groupIndex, domainIndex, itemIndex) {
152 var visits = 152 var visits =
153 this.groupedHistoryData_[groupIndex].domains[domainIndex].visits; 153 this.groupedHistoryData_[groupIndex].domains[domainIndex].visits;
154 154
155 return md_history.HistoryItem.needsTimeGap( 155 return md_history.HistoryItem.needsTimeGap(
156 visits, itemIndex, this.searchedTerm); 156 visits, itemIndex, this.searchedTerm);
157 }, 157 },
158 158
159 hasResults_: function(historyDataLength) { 159 /**
160 return historyDataLength > 0; 160 * @param {number} groupIndex
161 * @param {number} domainIndex
162 * @param {number} itemIndex
163 * @return {string}
164 * @private
165 */
166 pathForItem_: function(groupIndex, domainIndex, itemIndex) {
167 return [
168 'groupedHistoryData_', groupIndex, 'domains', domainIndex, 'visits',
169 itemIndex
170 ].join('.');
161 }, 171 },
162 172
173 /**
174 * @param {HistoryDomain} domain
175 * @return {string}
176 * @private
177 */
163 getWebsiteIconStyle_: function(domain) { 178 getWebsiteIconStyle_: function(domain) {
164 return 'background-image: ' + 179 return 'background-image: ' +
165 cr.icon.getFaviconImageSet(domain.visits[0].url); 180 cr.icon.getFaviconImageSet(domain.visits[0].url);
166 }, 181 },
167 182
183 /**
184 * @param {boolean} expanded
185 * @return {string}
186 * @private
187 */
168 getDropdownIcon_: function(expanded) { 188 getDropdownIcon_: function(expanded) {
169 return expanded ? 'cr:expand-less' : 'cr:expand-more'; 189 return expanded ? 'cr:expand-less' : 'cr:expand-more';
170 }, 190 },
171
172 noResultsMessage_: function(searchedTerm) {
173 var messageId = searchedTerm !== '' ? 'noSearchResults' : 'noResults';
174 return loadTimeData.getString(messageId);
175 },
176 }); 191 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/md_history/grouped_list.html ('k') | chrome/browser/resources/md_history/history_item.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698