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