| 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.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); |
| 11 | 11 |
| 12 this._reportView = new UI.ReportView(Common.UIString('Service Workers')); | 12 this._reportView = new UI.ReportView(Common.UIString('Service Workers')); |
| 13 this._reportView.show(this.contentElement); | 13 this._reportView.show(this.contentElement); |
| 14 | 14 |
| 15 this._toolbar = this._reportView.createToolbar(); | 15 this._toolbar = this._reportView.createToolbar(); |
| 16 | 16 |
| 17 /** @type {!Map<!SDK.ServiceWorkerRegistration, !Resources.ServiceWorkersVie
w.Section>} */ | 17 /** @type {!Map<!SDK.ServiceWorkerRegistration, !Resources.ServiceWorkersVie
w.Section>} */ |
| 18 this._sections = new Map(); | 18 this._sections = new Map(); |
| 19 | 19 |
| 20 this._toolbar.appendToolbarItem(NetworkConditions.NetworkConditionsSelector.
createOfflineToolbarCheckbox()); | 20 this._toolbar.appendToolbarItem(NetworkConditions.NetworkConditionsSelector.
createOfflineToolbarCheckbox()); |
| 21 var forceUpdate = new UI.ToolbarCheckbox( | 21 var updateOnReloadSetting = Common.settings.createSetting('serviceWorkerUpda
teOnReload', false); |
| 22 Common.UIString('Update on reload'), Common.UIString('Force update Servi
ce Worker on page reload'), | 22 updateOnReloadSetting.setTitle(Common.UIString('Update on reload')); |
| 23 Common.settings.createSetting('serviceWorkerUpdateOnReload', false)); | 23 var forceUpdate = new UI.ToolbarSettingCheckbox( |
| 24 updateOnReloadSetting, Common.UIString('Force update Service Worker on p
age reload')); |
| 24 this._toolbar.appendToolbarItem(forceUpdate); | 25 this._toolbar.appendToolbarItem(forceUpdate); |
| 25 var fallbackToNetwork = new UI.ToolbarCheckbox( | 26 var bypassServiceWorkerSetting = Common.settings.createSetting('bypassServic
eWorker', false); |
| 26 Common.UIString('Bypass for network'), | 27 bypassServiceWorkerSetting.setTitle(Common.UIString('Bypass for network')); |
| 27 Common.UIString('Bypass Service Worker and load resources from the netwo
rk'), | 28 var fallbackToNetwork = new UI.ToolbarSettingCheckbox( |
| 28 Common.settings.createSetting('bypassServiceWorker', false)); | 29 bypassServiceWorkerSetting, Common.UIString('Bypass Service Worker and l
oad resources from the network')); |
| 29 this._toolbar.appendToolbarItem(fallbackToNetwork); | 30 this._toolbar.appendToolbarItem(fallbackToNetwork); |
| 30 this._toolbar.appendSpacer(); | 31 this._toolbar.appendSpacer(); |
| 31 this._showAllCheckbox = new UI.ToolbarCheckbox( | 32 this._showAllCheckbox = new UI.ToolbarCheckbox( |
| 32 Common.UIString('Show all'), Common.UIString('Show all Service Workers r
egardless of the origin')); | 33 Common.UIString('Show all'), Common.UIString('Show all Service Workers r
egardless of the origin')); |
| 33 this._showAllCheckbox.inputElement.addEventListener('change', this._updateSe
ctionVisibility.bind(this), false); | 34 this._showAllCheckbox.inputElement.addEventListener('change', this._updateSe
ctionVisibility.bind(this), false); |
| 34 this._toolbar.appendToolbarItem(this._showAllCheckbox); | 35 this._toolbar.appendToolbarItem(this._showAllCheckbox); |
| 35 | 36 |
| 36 /** @type {!Map<!SDK.Target, !Array<!Common.EventTarget.EventDescriptor>>}*/ | 37 /** @type {!Map<!SDK.Target, !Array<!Common.EventTarget.EventDescriptor>>}*/ |
| 37 this._eventListeners = new Map(); | 38 this._eventListeners = new Map(); |
| 38 SDK.targetManager.observeTargets(this); | 39 SDK.targetManager.observeTargets(this); |
| (...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 * @return {!Element} | 456 * @return {!Element} |
| 456 */ | 457 */ |
| 457 _wrapWidget(container) { | 458 _wrapWidget(container) { |
| 458 var shadowRoot = UI.createShadowRootWithCoreStyles(container); | 459 var shadowRoot = UI.createShadowRootWithCoreStyles(container); |
| 459 UI.appendStyle(shadowRoot, 'resources/serviceWorkersView.css'); | 460 UI.appendStyle(shadowRoot, 'resources/serviceWorkersView.css'); |
| 460 var contentElement = createElement('div'); | 461 var contentElement = createElement('div'); |
| 461 shadowRoot.appendChild(contentElement); | 462 shadowRoot.appendChild(contentElement); |
| 462 return contentElement; | 463 return contentElement; |
| 463 } | 464 } |
| 464 }; | 465 }; |
| OLD | NEW |