Chromium Code Reviews| OLD | NEW |
|---|---|
| 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.SDKModelObserver<!SDK.ServiceWorkerManager>} | 5 * @implements {SDK.SDKModelObserver<!SDK.ServiceWorkerManager>} |
| 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 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 280 | 280 |
| 281 var clientsList = this._wrapWidget(this._section.appendField(Common.UIStri ng('Clients'))); | 281 var clientsList = this._wrapWidget(this._section.appendField(Common.UIStri ng('Clients'))); |
| 282 clientsList.removeChildren(); | 282 clientsList.removeChildren(); |
| 283 this._section.setFieldVisible(Common.UIString('Clients'), active.controlle dClients.length); | 283 this._section.setFieldVisible(Common.UIString('Clients'), active.controlle dClients.length); |
| 284 for (var client of active.controlledClients) { | 284 for (var client of active.controlledClients) { |
| 285 var clientLabelText = clientsList.createChild('div', 'service-worker-cli ent'); | 285 var clientLabelText = clientsList.createChild('div', 'service-worker-cli ent'); |
| 286 if (this._clientInfoCache.has(client)) { | 286 if (this._clientInfoCache.has(client)) { |
| 287 this._updateClientInfo( | 287 this._updateClientInfo( |
| 288 clientLabelText, /** @type {!Protocol.Target.TargetInfo} */ (this. _clientInfoCache.get(client))); | 288 clientLabelText, /** @type {!Protocol.Target.TargetInfo} */ (this. _clientInfoCache.get(client))); |
| 289 } | 289 } |
| 290 this._manager.target().targetAgent().getTargetInfo(client, this._onClien tInfo.bind(this, clientLabelText)); | 290 this._manager.target().targetAgent().getTargetInfo(client).then(this._on ClientInfo.bind(this, clientLabelText)); |
|
pfeldman
2017/05/23 19:10:25
You changed a random call site, but what does it a
| |
| 291 } | 291 } |
| 292 } | 292 } |
| 293 | 293 |
| 294 if (waiting) { | 294 if (waiting) { |
| 295 var waitingEntry = versionsStack.createChild('div', 'service-worker-versio n'); | 295 var waitingEntry = versionsStack.createChild('div', 'service-worker-versio n'); |
| 296 waitingEntry.createChild('div', 'service-worker-waiting-circle'); | 296 waitingEntry.createChild('div', 'service-worker-waiting-circle'); |
| 297 waitingEntry.createChild('span').textContent = Common.UIString('#%s waitin g to activate', waiting.id); | 297 waitingEntry.createChild('span').textContent = Common.UIString('#%s waitin g to activate', waiting.id); |
| 298 createLink(waitingEntry, Common.UIString('skipWaiting'), this._skipButtonC licked.bind(this)); | 298 createLink(waitingEntry, Common.UIString('skipWaiting'), this._skipButtonC licked.bind(this)); |
| 299 waitingEntry.createChild('div', 'service-worker-subtitle').textContent = | 299 waitingEntry.createChild('div', 'service-worker-subtitle').textContent = |
| 300 Common.UIString('Received %s', new Date(waiting.scriptResponseTime * 1 000).toLocaleString()); | 300 Common.UIString('Received %s', new Date(waiting.scriptResponseTime * 1 000).toLocaleString()); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 375 * @param {!Common.Event} event | 375 * @param {!Common.Event} event |
| 376 */ | 376 */ |
| 377 _syncButtonClicked(event) { | 377 _syncButtonClicked(event) { |
| 378 var tag = 'test-tag-from-devtools'; | 378 var tag = 'test-tag-from-devtools'; |
| 379 var lastChance = true; | 379 var lastChance = true; |
| 380 this._manager.dispatchSyncEvent(this._registration.id, tag, lastChance); | 380 this._manager.dispatchSyncEvent(this._registration.id, tag, lastChance); |
| 381 } | 381 } |
| 382 | 382 |
| 383 /** | 383 /** |
| 384 * @param {!Element} element | 384 * @param {!Element} element |
| 385 * @param {?Protocol.Error} error | |
| 386 * @param {?Protocol.Target.TargetInfo} targetInfo | 385 * @param {?Protocol.Target.TargetInfo} targetInfo |
| 387 */ | 386 */ |
| 388 _onClientInfo(element, error, targetInfo) { | 387 _onClientInfo(element, targetInfo) { |
| 389 if (error || !targetInfo) | 388 if (!targetInfo) |
| 390 return; | 389 return; |
| 391 this._clientInfoCache.set(targetInfo.targetId, targetInfo); | 390 this._clientInfoCache.set(targetInfo.targetId, targetInfo); |
| 392 this._updateClientInfo(element, targetInfo); | 391 this._updateClientInfo(element, targetInfo); |
| 393 } | 392 } |
| 394 | 393 |
| 395 /** | 394 /** |
| 396 * @param {!Element} element | 395 * @param {!Element} element |
| 397 * @param {!Protocol.Target.TargetInfo} targetInfo | 396 * @param {!Protocol.Target.TargetInfo} targetInfo |
| 398 */ | 397 */ |
| 399 _updateClientInfo(element, targetInfo) { | 398 _updateClientInfo(element, targetInfo) { |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 456 * @return {!Element} | 455 * @return {!Element} |
| 457 */ | 456 */ |
| 458 _wrapWidget(container) { | 457 _wrapWidget(container) { |
| 459 var shadowRoot = UI.createShadowRootWithCoreStyles(container); | 458 var shadowRoot = UI.createShadowRootWithCoreStyles(container); |
| 460 UI.appendStyle(shadowRoot, 'resources/serviceWorkersView.css'); | 459 UI.appendStyle(shadowRoot, 'resources/serviceWorkersView.css'); |
| 461 var contentElement = createElement('div'); | 460 var contentElement = createElement('div'); |
| 462 shadowRoot.appendChild(contentElement); | 461 shadowRoot.appendChild(contentElement); |
| 463 return contentElement; | 462 return contentElement; |
| 464 } | 463 } |
| 465 }; | 464 }; |
| OLD | NEW |