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

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

Issue 2239623002: [MD History] Add shift-selection to the history lists. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@reshadow
Patch Set: Set => Array 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 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 cr.define('md_history', function() { 5 cr.define('md_history', function() {
6 var HistoryItem = Polymer({ 6 var HistoryItem = Polymer({
7 is: 'history-item', 7 is: 'history-item',
8 8
9 properties: { 9 properties: {
10 // Underlying HistoryEntry data for this item. Contains read-only fields 10 // Underlying HistoryEntry data for this item. Contains read-only fields
(...skipping 19 matching lines...) Expand all
30 30
31 numberOfItems: {type: Number}, 31 numberOfItems: {type: Number},
32 32
33 // The path of this history item inside its parent. 33 // The path of this history item inside its parent.
34 path: String, 34 path: String,
35 }, 35 },
36 36
37 /** 37 /**
38 * When a history-item is selected the toolbar is notified and increases 38 * When a history-item is selected the toolbar is notified and increases
39 * or decreases its count of selected items accordingly. 39 * or decreases its count of selected items accordingly.
40 * @param {MouseEvent} e
40 * @private 41 * @private
41 */ 42 */
42 onCheckboxSelected_: function() { 43 onCheckboxSelected_: function(e) {
43 // TODO(calamity): Fire this event whenever |selected| changes. 44 // TODO(calamity): Fire this event whenever |selected| changes.
44 this.fire('history-checkbox-select', { 45 this.fire('history-checkbox-select', {
45 element: this, 46 element: this,
46 countAddition: this.$.checkbox.checked ? 1 : -1 47 shiftKey: e.shiftKey,
47 }); 48 });
49 e.preventDefault();
50 },
51
52 /*
53 * @param {MouseEvent} e
54 * @private
55 */
56 onCheckboxMousedown_: function(e) {
57 // Prevent shift clicking a checkbox from selecting text.
58 e.preventDefault();
tsergeant 2016/08/15 04:49:50 You should probably only preventDefault when shift
calamity 2016/08/15 07:18:40 Done.
48 }, 59 },
49 60
50 /** 61 /**
51 * Remove bookmark of current item when bookmark-star is clicked. 62 * Remove bookmark of current item when bookmark-star is clicked.
52 * @private 63 * @private
53 */ 64 */
54 onRemoveBookmarkTap_: function() { 65 onRemoveBookmarkTap_: function() {
55 if (!this.item.starred) 66 if (!this.item.starred)
56 return; 67 return;
57 68
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 147
137 if (searchedTerm) 148 if (searchedTerm)
138 return currentItem.dateShort != nextItem.dateShort; 149 return currentItem.dateShort != nextItem.dateShort;
139 150
140 return currentItem.time - nextItem.time > BROWSING_GAP_TIME && 151 return currentItem.time - nextItem.time > BROWSING_GAP_TIME &&
141 currentItem.dateRelativeDay == nextItem.dateRelativeDay; 152 currentItem.dateRelativeDay == nextItem.dateRelativeDay;
142 }; 153 };
143 154
144 return { HistoryItem: HistoryItem }; 155 return { HistoryItem: HistoryItem };
145 }); 156 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698