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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/resources/ServiceWorkersView.js

Issue 2553043003: [DevTools] Remove methods on Common.Event. (Closed)
Patch Set: rebased Created 4 years 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 (c) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 * @implements {SDK.TargetManager.Observer} 5 * @implements {SDK.TargetManager.Observer}
6 * @unrestricted 6 * @unrestricted
7 */ 7 */
8 Resources.ServiceWorkersView = class extends UI.VBox { 8 Resources.ServiceWorkersView = class extends UI.VBox {
9 constructor() { 9 constructor() {
10 super(true); 10 super(true);
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 */ 147 */
148 constructor(manager, subTargetsManager, section, registration) { 148 constructor(manager, subTargetsManager, section, registration) {
149 this._manager = manager; 149 this._manager = manager;
150 this._subTargetsManager = subTargetsManager; 150 this._subTargetsManager = subTargetsManager;
151 this._section = section; 151 this._section = section;
152 this._registration = registration; 152 this._registration = registration;
153 153
154 this._toolbar = section.createToolbar(); 154 this._toolbar = section.createToolbar();
155 this._toolbar.renderAsLinks(); 155 this._toolbar.renderAsLinks();
156 this._updateButton = new UI.ToolbarButton(Common.UIString('Update'), undefin ed, Common.UIString('Update')); 156 this._updateButton = new UI.ToolbarButton(Common.UIString('Update'), undefin ed, Common.UIString('Update'));
157 this._updateButton.addEventListener('click', this._updateButtonClicked.bind( this)); 157 this._updateButton.addEventListener(UI.ToolbarButton.Events.Click, this._upd ateButtonClicked, this);
158 this._toolbar.appendToolbarItem(this._updateButton); 158 this._toolbar.appendToolbarItem(this._updateButton);
159 this._pushButton = new UI.ToolbarButton(Common.UIString('Emulate push event' ), undefined, Common.UIString('Push')); 159 this._pushButton = new UI.ToolbarButton(Common.UIString('Emulate push event' ), undefined, Common.UIString('Push'));
160 this._pushButton.addEventListener('click', this._pushButtonClicked.bind(this )); 160 this._pushButton.addEventListener(UI.ToolbarButton.Events.Click, this._pushB uttonClicked, this);
161 this._toolbar.appendToolbarItem(this._pushButton); 161 this._toolbar.appendToolbarItem(this._pushButton);
162 this._syncButton = 162 this._syncButton =
163 new UI.ToolbarButton(Common.UIString('Emulate background sync event'), u ndefined, Common.UIString('Sync')); 163 new UI.ToolbarButton(Common.UIString('Emulate background sync event'), u ndefined, Common.UIString('Sync'));
164 this._syncButton.addEventListener('click', this._syncButtonClicked.bind(this )); 164 this._syncButton.addEventListener(UI.ToolbarButton.Events.Click, this._syncB uttonClicked, this);
165 this._toolbar.appendToolbarItem(this._syncButton); 165 this._toolbar.appendToolbarItem(this._syncButton);
166 this._deleteButton = 166 this._deleteButton =
167 new UI.ToolbarButton(Common.UIString('Unregister service worker'), undef ined, Common.UIString('Unregister')); 167 new UI.ToolbarButton(Common.UIString('Unregister service worker'), undef ined, Common.UIString('Unregister'));
168 this._deleteButton.addEventListener('click', this._unregisterButtonClicked.b ind(this)); 168 this._deleteButton.addEventListener(UI.ToolbarButton.Events.Click, this._unr egisterButtonClicked, this);
169 this._toolbar.appendToolbarItem(this._deleteButton); 169 this._toolbar.appendToolbarItem(this._deleteButton);
170 170
171 // Preserve the order. 171 // Preserve the order.
172 this._section.appendField(Common.UIString('Source')); 172 this._section.appendField(Common.UIString('Source'));
173 this._section.appendField(Common.UIString('Status')); 173 this._section.appendField(Common.UIString('Status'));
174 this._section.appendField(Common.UIString('Clients')); 174 this._section.appendField(Common.UIString('Clients'));
175 this._section.appendField(Common.UIString('Errors')); 175 this._section.appendField(Common.UIString('Errors'));
176 this._errorsList = this._wrapWidget(this._section.appendRow()); 176 this._errorsList = this._wrapWidget(this._section.appendRow());
177 this._errorsList.classList.add('service-worker-error-stack', 'monospace', 'h idden'); 177 this._errorsList.classList.add('service-worker-error-stack', 'monospace', 'h idden');
178 178
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 */ 311 */
312 _addError(error) { 312 _addError(error) {
313 var target = this._targetForVersionId(error.versionId); 313 var target = this._targetForVersionId(error.versionId);
314 var message = this._errorsList.createChild('div'); 314 var message = this._errorsList.createChild('div');
315 if (this._errorsList.childElementCount > 100) 315 if (this._errorsList.childElementCount > 100)
316 this._errorsList.firstElementChild.remove(); 316 this._errorsList.firstElementChild.remove();
317 message.appendChild(this._linkifier.linkifyScriptLocation(target, null, erro r.sourceURL, error.lineNumber)); 317 message.appendChild(this._linkifier.linkifyScriptLocation(target, null, erro r.sourceURL, error.lineNumber));
318 message.appendChild(createLabel('#' + error.versionId + ': ' + error.errorMe ssage, 'smallicon-error')); 318 message.appendChild(createLabel('#' + error.versionId + ': ' + error.errorMe ssage, 'smallicon-error'));
319 } 319 }
320 320
321 _unregisterButtonClicked() { 321 /**
322 * @param {!Common.Event} event
323 */
324 _unregisterButtonClicked(event) {
322 this._manager.deleteRegistration(this._registration.id); 325 this._manager.deleteRegistration(this._registration.id);
323 } 326 }
324 327
325 _updateButtonClicked() { 328 /**
329 * @param {!Common.Event} event
330 */
331 _updateButtonClicked(event) {
326 this._manager.updateRegistration(this._registration.id); 332 this._manager.updateRegistration(this._registration.id);
327 } 333 }
328 334
329 _pushButtonClicked() { 335 /**
336 * @param {!Common.Event} event
337 */
338 _pushButtonClicked(event) {
330 var data = 'Test push message from DevTools.'; 339 var data = 'Test push message from DevTools.';
331 this._manager.deliverPushMessage(this._registration.id, data); 340 this._manager.deliverPushMessage(this._registration.id, data);
332 } 341 }
333 342
334 _syncButtonClicked() { 343 /**
344 * @param {!Common.Event} event
345 */
346 _syncButtonClicked(event) {
335 var tag = 'test-tag-from-devtools'; 347 var tag = 'test-tag-from-devtools';
336 var lastChance = true; 348 var lastChance = true;
337 this._manager.dispatchSyncEvent(this._registration.id, tag, lastChance); 349 this._manager.dispatchSyncEvent(this._registration.id, tag, lastChance);
338 } 350 }
339 351
340 /** 352 /**
341 * @param {!Element} element 353 * @param {!Element} element
342 * @param {?SDK.TargetInfo} targetInfo 354 * @param {?SDK.TargetInfo} targetInfo
343 */ 355 */
344 _onClientInfo(element, targetInfo) { 356 _onClientInfo(element, targetInfo) {
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 shadowRoot.appendChild(contentElement); 430 shadowRoot.appendChild(contentElement);
419 return contentElement; 431 return contentElement;
420 } 432 }
421 433
422 _dispose() { 434 _dispose() {
423 this._linkifier.dispose(); 435 this._linkifier.dispose();
424 if (this._pendingUpdate) 436 if (this._pendingUpdate)
425 clearTimeout(this._pendingUpdate); 437 clearTimeout(this._pendingUpdate);
426 } 438 }
427 }; 439 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698