| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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.SDKModel} | 7 * @extends {WebInspector.SDKModel} |
| 8 * @param {!WebInspector.Target} target | 8 * @param {!WebInspector.Target} target |
| 9 */ | 9 */ |
| 10 WebInspector.SecurityOriginManager = function(target) | 10 WebInspector.SecurityOriginManager = function(target) |
| 11 { | 11 { |
| 12 WebInspector.SDKModel.call(this, WebInspector.SecurityOriginManager, target)
; | 12 WebInspector.SDKModel.call(this, WebInspector.SecurityOriginManager, target)
; |
| 13 | 13 |
| 14 this._securityOriginCounter = new Map(); | 14 this._securityOriginCounter = new Map(); |
| 15 this._mainSecurityOrigin = ""; | 15 this._mainSecurityOrigin = ""; |
| 16 } | 16 }; |
| 17 | 17 |
| 18 /** @enum {symbol} */ | 18 /** @enum {symbol} */ |
| 19 WebInspector.SecurityOriginManager.Events = { | 19 WebInspector.SecurityOriginManager.Events = { |
| 20 SecurityOriginAdded: Symbol("SecurityOriginAdded"), | 20 SecurityOriginAdded: Symbol("SecurityOriginAdded"), |
| 21 SecurityOriginRemoved: Symbol("SecurityOriginRemoved"), | 21 SecurityOriginRemoved: Symbol("SecurityOriginRemoved"), |
| 22 MainSecurityOriginChanged: Symbol("MainSecurityOriginChanged") | 22 MainSecurityOriginChanged: Symbol("MainSecurityOriginChanged") |
| 23 } | 23 }; |
| 24 | 24 |
| 25 /** | 25 /** |
| 26 * @param {!WebInspector.Target} target | 26 * @param {!WebInspector.Target} target |
| 27 * @return {!WebInspector.SecurityOriginManager} | 27 * @return {!WebInspector.SecurityOriginManager} |
| 28 */ | 28 */ |
| 29 WebInspector.SecurityOriginManager.fromTarget = function(target) | 29 WebInspector.SecurityOriginManager.fromTarget = function(target) |
| 30 { | 30 { |
| 31 var securityOriginManager = /** @type {?WebInspector.SecurityOriginManager}
*/ (target.model(WebInspector.SecurityOriginManager)); | 31 var securityOriginManager = /** @type {?WebInspector.SecurityOriginManager}
*/ (target.model(WebInspector.SecurityOriginManager)); |
| 32 if (!securityOriginManager) | 32 if (!securityOriginManager) |
| 33 securityOriginManager = new WebInspector.SecurityOriginManager(target); | 33 securityOriginManager = new WebInspector.SecurityOriginManager(target); |
| 34 return securityOriginManager; | 34 return securityOriginManager; |
| 35 } | 35 }; |
| 36 | 36 |
| 37 WebInspector.SecurityOriginManager.prototype = { | 37 WebInspector.SecurityOriginManager.prototype = { |
| 38 /** | 38 /** |
| 39 * @param {string} securityOrigin | 39 * @param {string} securityOrigin |
| 40 */ | 40 */ |
| 41 addSecurityOrigin: function(securityOrigin) | 41 addSecurityOrigin: function(securityOrigin) |
| 42 { | 42 { |
| 43 var currentCount = this._securityOriginCounter.get(securityOrigin); | 43 var currentCount = this._securityOriginCounter.get(securityOrigin); |
| 44 if (!currentCount) { | 44 if (!currentCount) { |
| 45 this._securityOriginCounter.set(securityOrigin, 1); | 45 this._securityOriginCounter.set(securityOrigin, 1); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 /** | 82 /** |
| 83 * @param {string} securityOrigin | 83 * @param {string} securityOrigin |
| 84 */ | 84 */ |
| 85 setMainSecurityOrigin: function(securityOrigin) | 85 setMainSecurityOrigin: function(securityOrigin) |
| 86 { | 86 { |
| 87 this._mainSecurityOrigin = securityOrigin; | 87 this._mainSecurityOrigin = securityOrigin; |
| 88 this.dispatchEventToListeners(WebInspector.SecurityOriginManager.Events.
MainSecurityOriginChanged, securityOrigin); | 88 this.dispatchEventToListeners(WebInspector.SecurityOriginManager.Events.
MainSecurityOriginChanged, securityOrigin); |
| 89 }, | 89 }, |
| 90 | 90 |
| 91 __proto__: WebInspector.SDKModel.prototype | 91 __proto__: WebInspector.SDKModel.prototype |
| 92 } | 92 }; |
| OLD | NEW |