| OLD | NEW |
| 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 cr.define('md_history', function() { | 5 cr.define('md_history', function() { |
| 6 var lazyLoadPromise = null; | 6 var lazyLoadPromise = null; |
| 7 function ensureLazyLoaded() { | 7 function ensureLazyLoaded() { |
| 8 if (!lazyLoadPromise) { | 8 if (!lazyLoadPromise) { |
| 9 lazyLoadPromise = new Promise(function(resolve, reject) { | 9 lazyLoadPromise = new Promise(function(resolve, reject) { |
| 10 Polymer.Base.importHref( | 10 Polymer.Base.importHref( |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 focusToolbarSearchField: function() { this.$.toolbar.showSearchField(); }, | 231 focusToolbarSearchField: function() { this.$.toolbar.showSearchField(); }, |
| 232 | 232 |
| 233 /** | 233 /** |
| 234 * @param {Event} e | 234 * @param {Event} e |
| 235 * @private | 235 * @private |
| 236 */ | 236 */ |
| 237 onCanExecute_: function(e) { | 237 onCanExecute_: function(e) { |
| 238 e = /** @type {cr.ui.CanExecuteEvent} */(e); | 238 e = /** @type {cr.ui.CanExecuteEvent} */(e); |
| 239 switch (e.command.id) { | 239 switch (e.command.id) { |
| 240 case 'find-command': | 240 case 'find-command': |
| 241 case 'toggle-grouped': |
| 241 e.canExecute = true; | 242 e.canExecute = true; |
| 242 break; | 243 break; |
| 243 case 'slash-command': | 244 case 'slash-command': |
| 244 e.canExecute = !this.$.toolbar.searchField.isSearchFocused(); | 245 e.canExecute = !this.$.toolbar.searchField.isSearchFocused(); |
| 245 break; | 246 break; |
| 246 case 'delete-command': | 247 case 'delete-command': |
| 247 e.canExecute = this.$.toolbar.count > 0; | 248 e.canExecute = this.$.toolbar.count > 0; |
| 248 break; | 249 break; |
| 249 } | 250 } |
| 250 }, | 251 }, |
| 251 | 252 |
| 252 /** | 253 /** |
| 253 * @param {Event} e | 254 * @param {Event} e |
| 254 * @private | 255 * @private |
| 255 */ | 256 */ |
| 256 onCommand_: function(e) { | 257 onCommand_: function(e) { |
| 257 if (e.command.id == 'find-command' || e.command.id == 'slash-command') | 258 if (e.command.id == 'find-command' || e.command.id == 'slash-command') |
| 258 this.focusToolbarSearchField(); | 259 this.focusToolbarSearchField(); |
| 259 if (e.command.id == 'delete-command') | 260 if (e.command.id == 'delete-command') |
| 260 this.deleteSelected(); | 261 this.deleteSelected(); |
| 262 if (e.command.id == 'toggle-grouped') |
| 263 this.grouped_ = !this.grouped_; |
| 261 }, | 264 }, |
| 262 | 265 |
| 263 /** | 266 /** |
| 264 * @param {!Array<!ForeignSession>} sessionList Array of objects describing | 267 * @param {!Array<!ForeignSession>} sessionList Array of objects describing |
| 265 * the sessions from other devices. | 268 * the sessions from other devices. |
| 266 * @param {boolean} isTabSyncEnabled Is tab sync enabled for this profile? | 269 * @param {boolean} isTabSyncEnabled Is tab sync enabled for this profile? |
| 267 */ | 270 */ |
| 268 setForeignSessions: function(sessionList, isTabSyncEnabled) { | 271 setForeignSessions: function(sessionList, isTabSyncEnabled) { |
| 269 if (!isTabSyncEnabled) { | 272 if (!isTabSyncEnabled) { |
| 270 var syncedDeviceManagerElem = | 273 var syncedDeviceManagerElem = |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 break; | 397 break; |
| 395 } | 398 } |
| 396 break; | 399 break; |
| 397 } | 400 } |
| 398 | 401 |
| 399 md_history.BrowserService.getInstance().recordHistogram( | 402 md_history.BrowserService.getInstance().recordHistogram( |
| 400 'History.HistoryPageView', histogramValue, HistoryPageViewHistogram.END | 403 'History.HistoryPageView', histogramValue, HistoryPageViewHistogram.END |
| 401 ); | 404 ); |
| 402 }, | 405 }, |
| 403 }); | 406 }); |
| OLD | NEW |