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

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

Issue 2404763002: Refactor overall test suite, use replaceApp in HistoryListTest (Closed)
Patch Set: Undo namespacing change Created 4 years, 1 month 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 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 'cr-toolbar-menu-promo-shown': 'onCrToolbarMenuPromoShown_', 100 'cr-toolbar-menu-promo-shown': 'onCrToolbarMenuPromoShown_',
101 'cr-toolbar-menu-tap': 'onCrToolbarMenuTap_', 101 'cr-toolbar-menu-tap': 'onCrToolbarMenuTap_',
102 'delete-selected': 'deleteSelected', 102 'delete-selected': 'deleteSelected',
103 'history-checkbox-select': 'checkboxSelected', 103 'history-checkbox-select': 'checkboxSelected',
104 'history-close-drawer': 'closeDrawer_', 104 'history-close-drawer': 'closeDrawer_',
105 'history-view-changed': 'historyViewChanged_', 105 'history-view-changed': 'historyViewChanged_',
106 'opened-changed': 'onOpenedChanged_', 106 'opened-changed': 'onOpenedChanged_',
107 'unselect-all': 'unselectAll', 107 'unselect-all': 'unselectAll',
108 }, 108 },
109 109
110 /** @private {?function(!Event)} */
111 onCanExecuteListener_: null,
112
113 /** @private {?function(!Event)} */
114 onCommandListener_: null,
115
110 /** @override */ 116 /** @override */
111 ready: function() { 117 attached: function() {
112 this.grouped_ = loadTimeData.getBoolean('groupByDomain'); 118 this.grouped_ = loadTimeData.getBoolean('groupByDomain');
113 119
114 cr.ui.decorate('command', cr.ui.Command); 120 cr.ui.decorate('command', cr.ui.Command);
115 document.addEventListener('canExecute', this.onCanExecute_.bind(this)); 121 this.onCanExecuteListener_ = this.onCanExecute_.bind(this);
Dan Beam 2016/11/03 18:07:51 nit: boundOnCanExecute_ seems to be the typical po
tsergeant 2016/11/03 22:34:32 Done.
116 document.addEventListener('command', this.onCommand_.bind(this)); 122 this.onCommandListener_ = this.onCommand_.bind(this);
123
124 document.addEventListener('canExecute', this.onCanExecuteListener_);
125 document.addEventListener('command', this.onCommandListener_);
126 },
127
128 /** @override */
129 detached: function() {
130 document.removeEventListener('canExecute', this.onCanExecuteListener_);
131 document.removeEventListener('command', this.onCommandListener_);
117 }, 132 },
118 133
119 onFirstRender: function() { 134 onFirstRender: function() {
120 setTimeout(function() { 135 setTimeout(function() {
121 chrome.send( 136 chrome.send(
122 'metricsHandler:recordTime', 137 'metricsHandler:recordTime',
123 ['History.ResultsRenderedTime', window.performance.now()]); 138 ['History.ResultsRenderedTime', window.performance.now()]);
124 }); 139 });
125 140
126 // Focus the search field on load. Done here to ensure the history page 141 // Focus the search field on load. Done here to ensure the history page
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 break; 391 break;
377 } 392 }
378 break; 393 break;
379 } 394 }
380 395
381 md_history.BrowserService.getInstance().recordHistogram( 396 md_history.BrowserService.getInstance().recordHistogram(
382 'History.HistoryPageView', histogramValue, HistoryPageViewHistogram.END 397 'History.HistoryPageView', histogramValue, HistoryPageViewHistogram.END
383 ); 398 );
384 }, 399 },
385 }); 400 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698