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

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

Issue 2255033002: [MD History] Copy stats from the old history page. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@sidebar_stats
Patch Set: rebase 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 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 this.getSelectedList_().unselectAllItems(count); 96 this.getSelectedList_().unselectAllItems(count);
97 }, 97 },
98 98
99 /** 99 /**
100 * Delete all the currently selected history items. Will prompt the user with 100 * Delete all the currently selected history items. Will prompt the user with
101 * a dialog to confirm that the deletion should be performed. 101 * a dialog to confirm that the deletion should be performed.
102 */ 102 */
103 deleteSelectedWithPrompt: function() { 103 deleteSelectedWithPrompt: function() {
104 if (!loadTimeData.getBoolean('allowDeletingHistory')) 104 if (!loadTimeData.getBoolean('allowDeletingHistory'))
105 return; 105 return;
106
107 var browserService = md_history.BrowserService.getInstance();
108 browserService.recordAction('RemoveSelected');
109 if (this.searchTerm != '')
110 browserService.recordAction('SearchResultRemove');
106 this.$.dialog.get().then(function(dialog) { 111 this.$.dialog.get().then(function(dialog) {
107 dialog.showModal(); 112 dialog.showModal();
108 }); 113 });
109 }, 114 },
110 115
111 /** 116 /**
112 * @param {HistoryRange} range 117 * @param {HistoryRange} range
113 * @private 118 * @private
114 */ 119 */
115 groupedRangeChanged_: function(range, oldRange) { 120 groupedRangeChanged_: function(range, oldRange) {
(...skipping 28 matching lines...) Expand all
144 info.term == '' ? results[i].dateTimeOfDay : results[i].dateShort; 149 info.term == '' ? results[i].dateTimeOfDay : results[i].dateShort;
145 150
146 if (results[i].dateRelativeDay != currentDate) { 151 if (results[i].dateRelativeDay != currentDate) {
147 currentDate = results[i].dateRelativeDay; 152 currentDate = results[i].dateRelativeDay;
148 } 153 }
149 } 154 }
150 }, 155 },
151 156
152 /** @private */ 157 /** @private */
153 onDialogConfirmTap_: function() { 158 onDialogConfirmTap_: function() {
159 md_history.BrowserService.getInstance().recordAction(
160 'ConfirmRemoveSelected');
161
154 this.getSelectedList_().deleteSelected(); 162 this.getSelectedList_().deleteSelected();
155 var dialog = assert(this.$.dialog.getIfExists()); 163 var dialog = assert(this.$.dialog.getIfExists());
156 dialog.close(); 164 dialog.close();
157 }, 165 },
158 166
159 /** @private */ 167 /** @private */
160 onDialogCancelTap_: function() { 168 onDialogCancelTap_: function() {
169 md_history.BrowserService.getInstance().recordAction(
170 'CancelRemoveSelected');
171
161 var dialog = assert(this.$.dialog.getIfExists()); 172 var dialog = assert(this.$.dialog.getIfExists());
162 dialog.close(); 173 dialog.close();
163 }, 174 },
164 175
165 /** 176 /**
166 * Closes the overflow menu. 177 * Closes the overflow menu.
167 * @private 178 * @private
168 */ 179 */
169 closeMenu_: function() { 180 closeMenu_: function() {
170 var menu = this.$.sharedMenu.getIfExists(); 181 var menu = this.$.sharedMenu.getIfExists();
(...skipping 11 matching lines...) Expand all
182 toggleMenu_: function(e) { 193 toggleMenu_: function(e) {
183 var target = e.detail.target; 194 var target = e.detail.target;
184 return this.$.sharedMenu.get().then(function(menu) { 195 return this.$.sharedMenu.get().then(function(menu) {
185 /** @type {CrSharedMenuElement} */(menu).toggleMenu( 196 /** @type {CrSharedMenuElement} */(menu).toggleMenu(
186 target, e.detail); 197 target, e.detail);
187 }); 198 });
188 }, 199 },
189 200
190 /** @private */ 201 /** @private */
191 onMoreFromSiteTap_: function() { 202 onMoreFromSiteTap_: function() {
203 md_history.BrowserService.getInstance().recordAction(
204 'EntryMenuShowMoreFromSite');
205
192 var menu = assert(this.$.sharedMenu.getIfExists()); 206 var menu = assert(this.$.sharedMenu.getIfExists());
193 this.fire('search-domain', {domain: menu.itemData.item.domain}); 207 this.fire('search-domain', {domain: menu.itemData.item.domain});
194 menu.closeMenu(); 208 menu.closeMenu();
195 }, 209 },
196 210
197 /** @private */ 211 /** @private */
198 onRemoveFromHistoryTap_: function() { 212 onRemoveFromHistoryTap_: function() {
213 var browserService = md_history.BrowserService.getInstance();
214 browserService.recordAction('EntryMenuRemoveFromHistory');
199 var menu = assert(this.$.sharedMenu.getIfExists()); 215 var menu = assert(this.$.sharedMenu.getIfExists());
200 var itemData = menu.itemData; 216 var itemData = menu.itemData;
201 md_history.BrowserService.getInstance() 217 browserService.deleteItems([itemData.item])
202 .deleteItems([itemData.item])
203 .then(function(items) { 218 .then(function(items) {
204 this.getSelectedList_().removeItemsByPath([itemData.path]); 219 this.getSelectedList_().removeItemsByPath([itemData.path]);
205 // This unselect-all is to reset the toolbar when deleting a selected 220 // This unselect-all is to reset the toolbar when deleting a selected
206 // item. TODO(tsergeant): Make this automatic based on observing list 221 // item. TODO(tsergeant): Make this automatic based on observing list
207 // modifications. 222 // modifications.
208 this.fire('unselect-all'); 223 this.fire('unselect-all');
209 }.bind(this)); 224 }.bind(this));
210 menu.closeMenu(); 225 menu.closeMenu();
211 }, 226 },
212 227
213 /** 228 /**
214 * @return {HTMLElement} 229 * @return {HTMLElement}
215 * @private 230 * @private
216 */ 231 */
217 getSelectedList_: function() { 232 getSelectedList_: function() {
218 return this.$.content.selectedItem; 233 return this.$.content.selectedItem;
219 }, 234 },
220 }); 235 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698