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

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

Issue 2573323002: Revert of [DevTools] Remove methods on Common.Event. (Closed)
Patch Set: 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(UI.ToolbarButton.Events.Click, this._upd ateButtonClicked, this); 157 this._updateButton.addEventListener('click', this._updateButtonClicked.bind( 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(UI.ToolbarButton.Events.Click, this._pushB uttonClicked, this); 160 this._pushButton.addEventListener('click', this._pushButtonClicked.bind(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(UI.ToolbarButton.Events.Click, this._syncB uttonClicked, this); 164 this._syncButton.addEventListener('click', this._syncButtonClicked.bind(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(UI.ToolbarButton.Events.Click, this._unr egisterButtonClicked, this); 168 this._deleteButton.addEventListener('click', this._unregisterButtonClicked.b ind(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 /** 321 _unregisterButtonClicked() {
322 * @param {!Common.Event} event
323 */
324 _unregisterButtonClicked(event) {
325 this._manager.deleteRegistration(this._registration.id); 322 this._manager.deleteRegistration(this._registration.id);
326 } 323 }
327 324
328 /** 325 _updateButtonClicked() {
329 * @param {!Common.Event} event
330 */
331 _updateButtonClicked(event) {
332 this._manager.updateRegistration(this._registration.id); 326 this._manager.updateRegistration(this._registration.id);
333 } 327 }
334 328
335 /** 329 _pushButtonClicked() {
336 * @param {!Common.Event} event
337 */
338 _pushButtonClicked(event) {
339 var data = 'Test push message from DevTools.'; 330 var data = 'Test push message from DevTools.';
340 this._manager.deliverPushMessage(this._registration.id, data); 331 this._manager.deliverPushMessage(this._registration.id, data);
341 } 332 }
342 333
343 /** 334 _syncButtonClicked() {
344 * @param {!Common.Event} event
345 */
346 _syncButtonClicked(event) {
347 var tag = 'test-tag-from-devtools'; 335 var tag = 'test-tag-from-devtools';
348 var lastChance = true; 336 var lastChance = true;
349 this._manager.dispatchSyncEvent(this._registration.id, tag, lastChance); 337 this._manager.dispatchSyncEvent(this._registration.id, tag, lastChance);
350 } 338 }
351 339
352 /** 340 /**
353 * @param {!Element} element 341 * @param {!Element} element
354 * @param {?SDK.TargetInfo} targetInfo 342 * @param {?SDK.TargetInfo} targetInfo
355 */ 343 */
356 _onClientInfo(element, targetInfo) { 344 _onClientInfo(element, targetInfo) {
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 shadowRoot.appendChild(contentElement); 418 shadowRoot.appendChild(contentElement);
431 return contentElement; 419 return contentElement;
432 } 420 }
433 421
434 _dispose() { 422 _dispose() {
435 this._linkifier.dispose(); 423 this._linkifier.dispose();
436 if (this._pendingUpdate) 424 if (this._pendingUpdate)
437 clearTimeout(this._pendingUpdate); 425 clearTimeout(this._pendingUpdate);
438 } 426 }
439 }; 427 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698