| 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 19 matching lines...) Expand all Loading... |
| 30 targetAdded: function(target) | 30 targetAdded: function(target) |
| 31 { | 31 { |
| 32 if (this._target || !target.serviceWorkerManager) | 32 if (this._target || !target.serviceWorkerManager) |
| 33 return; | 33 return; |
| 34 this._target = target; | 34 this._target = target; |
| 35 this._manager = this._target.serviceWorkerManager; | 35 this._manager = this._target.serviceWorkerManager; |
| 36 | 36 |
| 37 this._toolbar.appendToolbarItem(WebInspector.NetworkConditionsSelector.c
reateOfflineToolbarCheckbox()); | 37 this._toolbar.appendToolbarItem(WebInspector.NetworkConditionsSelector.c
reateOfflineToolbarCheckbox()); |
| 38 var forceUpdate = new WebInspector.ToolbarCheckbox(WebInspector.UIString
("Update on reload"), WebInspector.UIString("Force update Service Worker on page
reload"), this._manager.forceUpdateOnReloadSetting()); | 38 var forceUpdate = new WebInspector.ToolbarCheckbox(WebInspector.UIString
("Update on reload"), WebInspector.UIString("Force update Service Worker on page
reload"), this._manager.forceUpdateOnReloadSetting()); |
| 39 this._toolbar.appendToolbarItem(forceUpdate); | 39 this._toolbar.appendToolbarItem(forceUpdate); |
| 40 var fallbackToNetwork = new WebInspector.ToolbarCheckbox(WebInspector.UI
String("Bypass for network"), WebInspector.UIString("Bypass Service Worker and l
oad resources from the network"), target.networkManager.bypassServiceWorkerSetti
ng()); | 40 var networkManager = this._target && WebInspector.NetworkManager.fromTar
get(this._target); |
| 41 this._toolbar.appendToolbarItem(fallbackToNetwork); | 41 if (networkManager) { |
| 42 this._toolbar.appendSpacer(); | 42 var fallbackToNetwork = new WebInspector.ToolbarCheckbox(WebInspecto
r.UIString("Bypass for network"), WebInspector.UIString("Bypass Service Worker a
nd load resources from the network"), networkManager.bypassServiceWorkerSetting(
)); |
| 43 this._toolbar.appendToolbarItem(fallbackToNetwork); |
| 44 this._toolbar.appendSpacer(); |
| 45 } |
| 43 this._showAllCheckbox = new WebInspector.ToolbarCheckbox(WebInspector.UI
String("Show all"), WebInspector.UIString("Show all Service Workers regardless o
f the origin")); | 46 this._showAllCheckbox = new WebInspector.ToolbarCheckbox(WebInspector.UI
String("Show all"), WebInspector.UIString("Show all Service Workers regardless o
f the origin")); |
| 44 this._showAllCheckbox.inputElement.addEventListener("change", this._upda
teSectionVisibility.bind(this), false); | 47 this._showAllCheckbox.inputElement.addEventListener("change", this._upda
teSectionVisibility.bind(this), false); |
| 45 this._toolbar.appendToolbarItem(this._showAllCheckbox); | 48 this._toolbar.appendToolbarItem(this._showAllCheckbox); |
| 46 | 49 |
| 47 for (var registration of this._manager.registrations().values()) | 50 for (var registration of this._manager.registrations().values()) |
| 48 this._updateRegistration(registration); | 51 this._updateRegistration(registration); |
| 49 | 52 |
| 50 this._manager.addEventListener(WebInspector.ServiceWorkerManager.Events.
RegistrationUpdated, this._registrationUpdated, this); | 53 this._manager.addEventListener(WebInspector.ServiceWorkerManager.Events.
RegistrationUpdated, this._registrationUpdated, this); |
| 51 this._manager.addEventListener(WebInspector.ServiceWorkerManager.Events.
RegistrationDeleted, this._registrationDeleted, this); | 54 this._manager.addEventListener(WebInspector.ServiceWorkerManager.Events.
RegistrationDeleted, this._registrationDeleted, this); |
| 52 this._manager.addEventListener(WebInspector.ServiceWorkerManager.Events.
RegistrationErrorAdded, this._registrationErrorAdded, this); | 55 this._manager.addEventListener(WebInspector.ServiceWorkerManager.Events.
RegistrationErrorAdded, this._registrationErrorAdded, this); |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 return contentElement; | 406 return contentElement; |
| 404 }, | 407 }, |
| 405 | 408 |
| 406 _dispose: function() | 409 _dispose: function() |
| 407 { | 410 { |
| 408 this._linkifier.dispose(); | 411 this._linkifier.dispose(); |
| 409 if (this._pendingUpdate) | 412 if (this._pendingUpdate) |
| 410 clearTimeout(this._pendingUpdate); | 413 clearTimeout(this._pendingUpdate); |
| 411 } | 414 } |
| 412 } | 415 } |
| OLD | NEW |