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

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

Issue 2077483002: MD History: Add confirmation dialog when deleting items from the toolbar (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cr_refactor_dialog
Patch Set: Fix test Created 4 years, 5 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 Polymer({ 5 Polymer({
6 is: 'history-list', 6 is: 'history-list',
7 7
8 properties: { 8 properties: {
9 // The search term for the current query. Set when the query returns. 9 // The search term for the current query. Set when the query returns.
10 searchedTerm: { 10 searchedTerm: {
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 this.historyData_.splice(i, 1); 174 this.historyData_.splice(i, 1);
175 } 175 }
176 } 176 }
177 // notifySplices gives better performance than individually splicing as it 177 // notifySplices gives better performance than individually splicing as it
178 // batches all of the updates together. 178 // batches all of the updates together.
179 this.notifySplices('historyData_', splices); 179 this.notifySplices('historyData_', splices);
180 }, 180 },
181 181
182 /** 182 /**
183 * Performs a request to the backend to delete all selected items. If 183 * Performs a request to the backend to delete all selected items. If
184 * successful, removes them from the view. 184 * successful, removes them from the view. Does not prompt the user before
185 * deleting -- see <history-list-container> for a version of this method which
186 * does prompt.
185 */ 187 */
186 deleteSelected: function() { 188 deleteSelected: function() {
187 var toBeRemoved = this.historyData_.filter(function(item) { 189 var toBeRemoved = this.historyData_.filter(function(item) {
188 return item.selected; 190 return item.selected;
189 }); 191 });
190 md_history.BrowserService.getInstance() 192 md_history.BrowserService.getInstance()
191 .deleteItems(toBeRemoved) 193 .deleteItems(toBeRemoved)
192 .then(function(items) { 194 .then(function(items) {
193 this.removeDeletedHistory_(items); 195 this.removeDeletedHistory_(items);
194 this.fire('unselect-all'); 196 this.fire('unselect-all');
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 267
266 /** 268 /**
267 * @param {number} index 269 * @param {number} index
268 * @return {boolean} 270 * @return {boolean}
269 * @private 271 * @private
270 */ 272 */
271 isFirstItem_: function(index) { 273 isFirstItem_: function(index) {
272 return index == 0; 274 return index == 0;
273 } 275 }
274 }); 276 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698