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

Side by Side Diff: chrome/browser/resources/md_history/list_container.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 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 queryState.searchTerm, queryState.groupedOffset, queryState.range, 76 queryState.searchTerm, queryState.groupedOffset, queryState.range,
77 lastVisitTime, maxResults 77 lastVisitTime, maxResults
78 ]); 78 ]);
79 }, 79 },
80 80
81 unselectAllItems: function(count) { 81 unselectAllItems: function(count) {
82 /** @type {HistoryListElement} */ (this.$['infinite-list']) 82 /** @type {HistoryListElement} */ (this.$['infinite-list'])
83 .unselectAllItems(count); 83 .unselectAllItems(count);
84 }, 84 },
85 85
86 /**
87 * Delete all the currently selected history items. Will prompt the user with
88 * a dialog to confirm that the deletion should be performed.
89 */
86 deleteSelected: function() { 90 deleteSelected: function() {
calamity 2016/07/08 06:05:50 promptDeleteSelected perhaps? promptDeletion? I j
tsergeant 2016/07/08 06:37:27 Done.
87 /** @type {HistoryListElement} */ (this.$['infinite-list']) 91 if (!loadTimeData.getBoolean('allowDeletingHistory'))
88 .deleteSelected(); 92 return;
calamity 2016/07/08 06:05:50 nit: newline here.
tsergeant 2016/07/08 06:37:27 Done.
93 this.$.dialog.open();
89 }, 94 },
90 95
91 /** 96 /**
92 * @param {string} searchTerm 97 * @param {string} searchTerm
93 * @private 98 * @private
94 */ 99 */
95 searchTermChanged_: function(searchTerm) { this.queryHistory(false); }, 100 searchTermChanged_: function(searchTerm) { this.queryHistory(false); },
96 101
97 /** 102 /**
98 * @param {HistoryRange} range 103 * @param {HistoryRange} range
(...skipping 25 matching lines...) Expand all
124 // Sets the default values for these fields to prevent undefined types. 129 // Sets the default values for these fields to prevent undefined types.
125 results[i].selected = false; 130 results[i].selected = false;
126 results[i].readableTimestamp = 131 results[i].readableTimestamp =
127 info.term == '' ? results[i].dateTimeOfDay : results[i].dateShort; 132 info.term == '' ? results[i].dateTimeOfDay : results[i].dateShort;
128 133
129 if (results[i].dateRelativeDay != currentDate) { 134 if (results[i].dateRelativeDay != currentDate) {
130 currentDate = results[i].dateRelativeDay; 135 currentDate = results[i].dateRelativeDay;
131 } 136 }
132 } 137 }
133 }, 138 },
139
140 /** @private */
141 onDialogConfirmTap_: function() {
142 this.$['infinite-list'].deleteSelected();
143 this.$.dialog.close();
144 },
145
146 /** @private */
147 onDialogCancelTap_: function() {
148 this.$.dialog.close();
149 }
134 }); 150 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698