| 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 /** | 5 /** |
| 6 * @constructor | 6 * @constructor |
| 7 * @extends {WebInspector.VBox} | 7 * @extends {WebInspector.VBox} |
| 8 * @implements {WebInspector.TargetManager.Observer} | 8 * @implements {WebInspector.TargetManager.Observer} |
| 9 */ | 9 */ |
| 10 WebInspector.ServiceWorkersView = function() | 10 WebInspector.ServiceWorkersView = function() |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 var fallbackToNetwork = new WebInspector.ToolbarCheckbox(WebInspector.UIStri
ng("Bypass for network"), WebInspector.UIString("Bypass Service Worker and load
resources from the network"), WebInspector.settings.createSetting("bypassService
Worker", false)); | 25 var fallbackToNetwork = new WebInspector.ToolbarCheckbox(WebInspector.UIStri
ng("Bypass for network"), WebInspector.UIString("Bypass Service Worker and load
resources from the network"), WebInspector.settings.createSetting("bypassService
Worker", false)); |
| 26 this._toolbar.appendToolbarItem(fallbackToNetwork); | 26 this._toolbar.appendToolbarItem(fallbackToNetwork); |
| 27 this._toolbar.appendSpacer(); | 27 this._toolbar.appendSpacer(); |
| 28 this._showAllCheckbox = new WebInspector.ToolbarCheckbox(WebInspector.UIStri
ng("Show all"), WebInspector.UIString("Show all Service Workers regardless of th
e origin")); | 28 this._showAllCheckbox = new WebInspector.ToolbarCheckbox(WebInspector.UIStri
ng("Show all"), WebInspector.UIString("Show all Service Workers regardless of th
e origin")); |
| 29 this._showAllCheckbox.inputElement.addEventListener("change", this._updateSe
ctionVisibility.bind(this), false); | 29 this._showAllCheckbox.inputElement.addEventListener("change", this._updateSe
ctionVisibility.bind(this), false); |
| 30 this._toolbar.appendToolbarItem(this._showAllCheckbox); | 30 this._toolbar.appendToolbarItem(this._showAllCheckbox); |
| 31 | 31 |
| 32 /** @type {!Map<!WebInspector.Target, !Array<!WebInspector.EventTarget.Event
Descriptor>>}*/ | 32 /** @type {!Map<!WebInspector.Target, !Array<!WebInspector.EventTarget.Event
Descriptor>>}*/ |
| 33 this._eventListeners = new Map(); | 33 this._eventListeners = new Map(); |
| 34 WebInspector.targetManager.observeTargets(this); | 34 WebInspector.targetManager.observeTargets(this); |
| 35 } | 35 }; |
| 36 | 36 |
| 37 WebInspector.ServiceWorkersView.prototype = { | 37 WebInspector.ServiceWorkersView.prototype = { |
| 38 /** | 38 /** |
| 39 * @override | 39 * @override |
| 40 * @param {!WebInspector.Target} target | 40 * @param {!WebInspector.Target} target |
| 41 */ | 41 */ |
| 42 targetAdded: function(target) | 42 targetAdded: function(target) |
| 43 { | 43 { |
| 44 if (this._manager || !target.serviceWorkerManager) | 44 if (this._manager || !target.serviceWorkerManager) |
| 45 return; | 45 return; |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 _registrationDeleted: function(event) | 126 _registrationDeleted: function(event) |
| 127 { | 127 { |
| 128 var registration = /** @type {!WebInspector.ServiceWorkerRegistration} *
/ (event.data); | 128 var registration = /** @type {!WebInspector.ServiceWorkerRegistration} *
/ (event.data); |
| 129 var section = this._sections.get(registration); | 129 var section = this._sections.get(registration); |
| 130 if (section) | 130 if (section) |
| 131 section._section.remove(); | 131 section._section.remove(); |
| 132 this._sections.delete(registration); | 132 this._sections.delete(registration); |
| 133 }, | 133 }, |
| 134 | 134 |
| 135 __proto__: WebInspector.VBox.prototype | 135 __proto__: WebInspector.VBox.prototype |
| 136 } | 136 }; |
| 137 | 137 |
| 138 /** | 138 /** |
| 139 * @constructor | 139 * @constructor |
| 140 * @param {!WebInspector.ServiceWorkerManager} manager | 140 * @param {!WebInspector.ServiceWorkerManager} manager |
| 141 * @param {!WebInspector.SubTargetsManager} subTargetsManager | 141 * @param {!WebInspector.SubTargetsManager} subTargetsManager |
| 142 * @param {!WebInspector.ReportView.Section} section | 142 * @param {!WebInspector.ReportView.Section} section |
| 143 * @param {!WebInspector.ServiceWorkerRegistration} registration | 143 * @param {!WebInspector.ServiceWorkerRegistration} registration |
| 144 */ | 144 */ |
| 145 WebInspector.ServiceWorkersView.Section = function(manager, subTargetsManager, s
ection, registration) | 145 WebInspector.ServiceWorkersView.Section = function(manager, subTargetsManager, s
ection, registration) |
| 146 { | 146 { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 171 this._section.appendField(WebInspector.UIString("Errors")); | 171 this._section.appendField(WebInspector.UIString("Errors")); |
| 172 this._errorsList = this._wrapWidget(this._section.appendRow()); | 172 this._errorsList = this._wrapWidget(this._section.appendRow()); |
| 173 this._errorsList.classList.add("service-worker-error-stack", "monospace", "h
idden"); | 173 this._errorsList.classList.add("service-worker-error-stack", "monospace", "h
idden"); |
| 174 | 174 |
| 175 this._linkifier = new WebInspector.Linkifier(); | 175 this._linkifier = new WebInspector.Linkifier(); |
| 176 /** @type {!Map<string, !WebInspector.TargetInfo>} */ | 176 /** @type {!Map<string, !WebInspector.TargetInfo>} */ |
| 177 this._clientInfoCache = new Map(); | 177 this._clientInfoCache = new Map(); |
| 178 for (var error of registration.errors) | 178 for (var error of registration.errors) |
| 179 this._addError(error); | 179 this._addError(error); |
| 180 this._throttler = new WebInspector.Throttler(500); | 180 this._throttler = new WebInspector.Throttler(500); |
| 181 } | 181 }; |
| 182 | 182 |
| 183 WebInspector.ServiceWorkersView.Section.prototype = { | 183 WebInspector.ServiceWorkersView.Section.prototype = { |
| 184 _scheduleUpdate: function() | 184 _scheduleUpdate: function() |
| 185 { | 185 { |
| 186 if (WebInspector.ServiceWorkersView._noThrottle) { | 186 if (WebInspector.ServiceWorkersView._noThrottle) { |
| 187 this._update(); | 187 this._update(); |
| 188 return; | 188 return; |
| 189 } | 189 } |
| 190 this._throttler.schedule(this._update.bind(this)); | 190 this._throttler.schedule(this._update.bind(this)); |
| 191 }, | 191 }, |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 shadowRoot.appendChild(contentElement); | 426 shadowRoot.appendChild(contentElement); |
| 427 return contentElement; | 427 return contentElement; |
| 428 }, | 428 }, |
| 429 | 429 |
| 430 _dispose: function() | 430 _dispose: function() |
| 431 { | 431 { |
| 432 this._linkifier.dispose(); | 432 this._linkifier.dispose(); |
| 433 if (this._pendingUpdate) | 433 if (this._pendingUpdate) |
| 434 clearTimeout(this._pendingUpdate); | 434 clearTimeout(this._pendingUpdate); |
| 435 } | 435 } |
| 436 } | 436 }; |
| OLD | NEW |