| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 { | 37 { |
| 38 WebInspector.SDKObject.call(this, target); | 38 WebInspector.SDKObject.call(this, target); |
| 39 target.registerServiceWorkerDispatcher(new WebInspector.ServiceWorkerDispatc
her(this)); | 39 target.registerServiceWorkerDispatcher(new WebInspector.ServiceWorkerDispatc
her(this)); |
| 40 this._lastAnonymousTargetId = 0; | 40 this._lastAnonymousTargetId = 0; |
| 41 this._agent = target.serviceWorkerAgent(); | 41 this._agent = target.serviceWorkerAgent(); |
| 42 /** @type {!Map.<string, !WebInspector.ServiceWorker>} */ | 42 /** @type {!Map.<string, !WebInspector.ServiceWorker>} */ |
| 43 this._workers = new Map(); | 43 this._workers = new Map(); |
| 44 /** @type {!Map.<string, !WebInspector.ServiceWorkerRegistration>} */ | 44 /** @type {!Map.<string, !WebInspector.ServiceWorkerRegistration>} */ |
| 45 this._registrations = new Map(); | 45 this._registrations = new Map(); |
| 46 this.enable(); | 46 this.enable(); |
| 47 |
| 47 this._forceUpdateSetting = WebInspector.settings.createSetting("serviceWorke
rUpdateOnReload", false); | 48 this._forceUpdateSetting = WebInspector.settings.createSetting("serviceWorke
rUpdateOnReload", false); |
| 48 if (this._forceUpdateSetting.get()) | 49 if (this._forceUpdateSetting.get()) |
| 49 this._forceUpdateSettingChanged(); | 50 this._forceUpdateSettingChanged(); |
| 50 this._forceUpdateSetting.addChangeListener(this._forceUpdateSettingChanged,
this); | 51 this._forceUpdateSetting.addChangeListener(this._forceUpdateSettingChanged,
this); |
| 52 |
| 53 this._fallbackToNetworkSetting = WebInspector.settings.createSetting("servic
eWorkerFallbackToNetwork", false); |
| 54 if (this._fallbackToNetworkSetting.get()) |
| 55 this._fallbackToNetworkSettingChanged(); |
| 56 this._fallbackToNetworkSetting.addChangeListener(this._fallbackToNetworkSett
ingChanged, this); |
| 51 } | 57 } |
| 52 | 58 |
| 53 WebInspector.ServiceWorkerManager.Events = { | 59 WebInspector.ServiceWorkerManager.Events = { |
| 54 WorkersUpdated: "WorkersUpdated", | 60 WorkersUpdated: "WorkersUpdated", |
| 55 RegistrationUpdated: "RegistrationUpdated", | 61 RegistrationUpdated: "RegistrationUpdated", |
| 56 RegistrationDeleted: "RegistrationDeleted" | 62 RegistrationDeleted: "RegistrationDeleted" |
| 57 } | 63 } |
| 58 | 64 |
| 59 WebInspector.ServiceWorkerManager.prototype = { | 65 WebInspector.ServiceWorkerManager.prototype = { |
| 60 enable: function() | 66 enable: function() |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 }, | 338 }, |
| 333 | 339 |
| 334 /** | 340 /** |
| 335 * @return {!WebInspector.Setting} | 341 * @return {!WebInspector.Setting} |
| 336 */ | 342 */ |
| 337 forceUpdateOnReloadSetting: function() | 343 forceUpdateOnReloadSetting: function() |
| 338 { | 344 { |
| 339 return this._forceUpdateSetting; | 345 return this._forceUpdateSetting; |
| 340 }, | 346 }, |
| 341 | 347 |
| 348 /** |
| 349 * @return {!WebInspector.Setting} |
| 350 */ |
| 351 fallbackToNetworkSetting: function() |
| 352 { |
| 353 return this._fallbackToNetworkSetting; |
| 354 }, |
| 355 |
| 342 _forceUpdateSettingChanged: function() | 356 _forceUpdateSettingChanged: function() |
| 343 { | 357 { |
| 344 this._agent.setForceUpdateOnPageLoad(this._forceUpdateSetting.get()); | 358 this._agent.setUpdateOnPageLoad(this._forceUpdateSetting.get()); |
| 359 }, |
| 360 |
| 361 _fallbackToNetworkSettingChanged: function() |
| 362 { |
| 363 this._agent.setFallbackToNetwork(this._fallbackToNetworkSetting.get()); |
| 345 }, | 364 }, |
| 346 | 365 |
| 347 __proto__: WebInspector.SDKObject.prototype | 366 __proto__: WebInspector.SDKObject.prototype |
| 348 } | 367 } |
| 349 | 368 |
| 350 /** | 369 /** |
| 351 * @constructor | 370 * @constructor |
| 352 * @param {!WebInspector.ServiceWorkerManager} manager | 371 * @param {!WebInspector.ServiceWorkerManager} manager |
| 353 * @param {string} workerId | 372 * @param {string} workerId |
| 354 * @param {string} url | 373 * @param {string} url |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 797 }, | 816 }, |
| 798 | 817 |
| 799 /** | 818 /** |
| 800 * @return {boolean} | 819 * @return {boolean} |
| 801 */ | 820 */ |
| 802 _shouldBeRemoved: function() | 821 _shouldBeRemoved: function() |
| 803 { | 822 { |
| 804 return this._isRedundant() && (!this._hasErrorLog() || this._deleting); | 823 return this._isRedundant() && (!this._hasErrorLog() || this._deleting); |
| 805 } | 824 } |
| 806 } | 825 } |
| OLD | NEW |