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

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

Issue 2409063003: MD History: Select items when tapping anywhere inside the item (Closed)
Patch Set: Remove <a> test Created 4 years, 1 month 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 /** 5 /**
6 * @param {!Element} root 6 * @param {!Element} root
7 * @param {?Element} boundary 7 * @param {?Element} boundary
8 * @param {cr.ui.FocusRow.Delegate} delegate 8 * @param {cr.ui.FocusRow.Delegate} delegate
9 * @constructor 9 * @constructor
10 * @extends {cr.ui.FocusRow} 10 * @extends {cr.ui.FocusRow}
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 161
162 /** 162 /**
163 * @private 163 * @private
164 */ 164 */
165 onDomChange_: function() { 165 onDomChange_: function() {
166 if (this.row_) 166 if (this.row_)
167 this.row_.addItems(); 167 this.row_.addItems();
168 }, 168 },
169 169
170 /** 170 /**
171 * When a history-item is selected the toolbar is notified and increases 171 * Toggle item selection whenever the checkbox or any non-interactive part
172 * or decreases its count of selected items accordingly. 172 * of the item is clicked.
173 * @param {MouseEvent} e 173 * @param {MouseEvent} e
174 * @private 174 * @private
175 */ 175 */
176 onCheckboxSelected_: function(e) { 176 onItemClick_: function(e) {
177 // TODO(calamity): Fire this event whenever |selected| changes. 177 for (var i = 0; i < e.path.length; i++) {
178 var elem = e.path[i];
179 if (elem.id != 'checkbox' &&
180 (elem.nodeName == 'A' || elem.nodeName == 'BUTTON')) {
181 return;
182 }
183 }
184
185 if (this.selectionNotAllowed_())
186 return;
187
178 this.fire('history-checkbox-select', { 188 this.fire('history-checkbox-select', {
179 element: this, 189 element: this,
180 shiftKey: e.shiftKey, 190 shiftKey: e.shiftKey,
181 }); 191 });
182 e.preventDefault();
183 }, 192 },
184 193
185 /** 194 /**
186 * @param {MouseEvent} e 195 * @param {MouseEvent} e
187 * @private 196 * @private
188 */ 197 */
189 onCheckboxMousedown_: function(e) { 198 onItemMousedown_: function(e) {
190 // Prevent shift clicking a checkbox from selecting text. 199 // Prevent shift clicking a checkbox from selecting text.
191 if (e.shiftKey) 200 if (e.shiftKey)
192 e.preventDefault(); 201 e.preventDefault();
193 }, 202 },
194 203
195 /** 204 /**
196 * @private 205 * @private
197 * @return {string} 206 * @return {string}
198 */ 207 */
199 getEntrySummary_: function() { 208 getEntrySummary_: function() {
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 * @return {string} The title for a page of search results. 346 * @return {string} The title for a page of search results.
338 */ 347 */
339 HistoryItem.searchResultsTitle = function(numberOfResults, searchTerm) { 348 HistoryItem.searchResultsTitle = function(numberOfResults, searchTerm) {
340 var resultId = numberOfResults == 1 ? 'searchResult' : 'searchResults'; 349 var resultId = numberOfResults == 1 ? 'searchResult' : 'searchResults';
341 return loadTimeData.getStringF('foundSearchResults', numberOfResults, 350 return loadTimeData.getStringF('foundSearchResults', numberOfResults,
342 loadTimeData.getString(resultId), searchTerm); 351 loadTimeData.getString(resultId), searchTerm);
343 }; 352 };
344 353
345 return { HistoryItem: HistoryItem }; 354 return { HistoryItem: HistoryItem };
346 }); 355 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/md_history/history_item.html ('k') | chrome/test/data/webui/md_history/history_item_test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698