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

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

Issue 2371363002: [MD History] Fix item selection when deleting via menu item. (Closed)
Patch Set: Created 4 years, 2 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 Polymer({ 5 Polymer({
6 is: 'history-list-container', 6 is: 'history-list-container',
7 7
8 properties: { 8 properties: {
9 // The path of the currently selected page. 9 // The path of the currently selected page.
10 selectedPage_: String, 10 selectedPage_: String,
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 }, 231 },
232 232
233 /** @private */ 233 /** @private */
234 onRemoveFromHistoryTap_: function() { 234 onRemoveFromHistoryTap_: function() {
235 var browserService = md_history.BrowserService.getInstance(); 235 var browserService = md_history.BrowserService.getInstance();
236 browserService.recordAction('EntryMenuRemoveFromHistory'); 236 browserService.recordAction('EntryMenuRemoveFromHistory');
237 var menu = assert(this.$.sharedMenu.getIfExists()); 237 var menu = assert(this.$.sharedMenu.getIfExists());
238 var itemData = menu.itemData; 238 var itemData = menu.itemData;
239 browserService.deleteItems([itemData.item]) 239 browserService.deleteItems([itemData.item])
240 .then(function(items) { 240 .then(function(items) {
241 this.getSelectedList_().removeItemsByPath([itemData.path]);
242 // This unselect-all is to reset the toolbar when deleting a selected 241 // This unselect-all is to reset the toolbar when deleting a selected
tsergeant 2016/09/29 01:45:01 While you're here, can you please update this comm
calamity 2016/09/29 03:06:23 Done.
243 // item. TODO(tsergeant): Make this automatic based on observing list 242 // item. TODO(tsergeant): Make this automatic based on observing list
244 // modifications. 243 // modifications.
245 this.fire('unselect-all'); 244 this.fire('unselect-all');
245 this.getSelectedList_().removeItemsByPath([itemData.path]);
246 246
247 var index = itemData.index; 247 var index = itemData.index;
248 if (index == undefined) 248 if (index == undefined)
249 return; 249 return;
250 250
251 var browserService = md_history.BrowserService.getInstance(); 251 var browserService = md_history.BrowserService.getInstance();
252 browserService.recordHistogram( 252 browserService.recordHistogram(
253 'HistoryPage.RemoveEntryPosition', index, 253 'HistoryPage.RemoveEntryPosition', index,
254 UMA_MAX_BUCKET_VALUE); 254 UMA_MAX_BUCKET_VALUE);
255 if (index <= UMA_MAX_SUBSET_BUCKET_VALUE) { 255 if (index <= UMA_MAX_SUBSET_BUCKET_VALUE) {
256 browserService.recordHistogram( 256 browserService.recordHistogram(
257 'HistoryPage.RemoveEntryPositionSubset', index, 257 'HistoryPage.RemoveEntryPositionSubset', index,
258 UMA_MAX_SUBSET_BUCKET_VALUE); 258 UMA_MAX_SUBSET_BUCKET_VALUE);
259 } 259 }
260 }.bind(this)); 260 }.bind(this));
261 menu.closeMenu(); 261 menu.closeMenu();
262 }, 262 },
263 263
264 /** 264 /**
265 * @return {HTMLElement} 265 * @return {HTMLElement}
266 * @private 266 * @private
267 */ 267 */
268 getSelectedList_: function() { return this.$.content.selectedItem; }, 268 getSelectedList_: function() { return this.$.content.selectedItem; },
269 }); 269 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/md_history/app.crisper.js ('k') | chrome/test/data/webui/md_history/history_list_test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698