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 * @unrestricted | 5 * @unrestricted |
6 */ | 6 */ |
7 SDK.SecurityOriginManager = class extends SDK.SDKModel { | 7 SDK.SecurityOriginManager = class extends SDK.SDKModel { |
8 /** | 8 /** |
9 * @param {!SDK.Target} target | 9 * @param {!SDK.Target} target |
| 10 * @param {!Protocol.Dispatcher} dispatcher |
10 */ | 11 */ |
11 constructor(target) { | 12 constructor(target, dispatcher) { |
12 super(target); | 13 super(target, dispatcher); |
| 14 this._storageAgent = dispatcher.storageAgent(); |
13 | 15 |
14 /** @type {!Set<string>} */ | 16 /** @type {!Set<string>} */ |
15 this._securityOrigins = new Set(); | 17 this._securityOrigins = new Set(); |
16 this._mainSecurityOrigin = ''; | 18 this._mainSecurityOrigin = ''; |
17 } | 19 } |
18 | 20 |
19 /** | 21 /** |
20 * @param {!Set<string>} securityOrigins | 22 * @param {!Set<string>} securityOrigins |
21 */ | 23 */ |
22 updateSecurityOrigins(securityOrigins) { | 24 updateSecurityOrigins(securityOrigins) { |
(...skipping 25 matching lines...) Expand all Loading... |
48 return this._mainSecurityOrigin; | 50 return this._mainSecurityOrigin; |
49 } | 51 } |
50 | 52 |
51 /** | 53 /** |
52 * @param {string} securityOrigin | 54 * @param {string} securityOrigin |
53 */ | 55 */ |
54 setMainSecurityOrigin(securityOrigin) { | 56 setMainSecurityOrigin(securityOrigin) { |
55 this._mainSecurityOrigin = securityOrigin; | 57 this._mainSecurityOrigin = securityOrigin; |
56 this.dispatchEventToListeners(SDK.SecurityOriginManager.Events.MainSecurityO
riginChanged, securityOrigin); | 58 this.dispatchEventToListeners(SDK.SecurityOriginManager.Events.MainSecurityO
riginChanged, securityOrigin); |
57 } | 59 } |
| 60 |
| 61 /** |
| 62 * @param {string} securityOrigin |
| 63 * @param {string} dataTypes |
| 64 */ |
| 65 clearDataForSecurityOrigin(securityOrigin, dataTypes) { |
| 66 this._storageAgent.clearDataForOrigin(securityOrigin, dataTypes); |
| 67 } |
58 }; | 68 }; |
59 | 69 |
60 SDK.SDKModel.register(SDK.SecurityOriginManager, SDK.Target.Capability.None, fal
se); | 70 SDK.SDKModel.register(SDK.SecurityOriginManager, SDK.Target.Capability.None, fal
se); |
61 | 71 |
62 /** @enum {symbol} */ | 72 /** @enum {symbol} */ |
63 SDK.SecurityOriginManager.Events = { | 73 SDK.SecurityOriginManager.Events = { |
64 SecurityOriginAdded: Symbol('SecurityOriginAdded'), | 74 SecurityOriginAdded: Symbol('SecurityOriginAdded'), |
65 SecurityOriginRemoved: Symbol('SecurityOriginRemoved'), | 75 SecurityOriginRemoved: Symbol('SecurityOriginRemoved'), |
66 MainSecurityOriginChanged: Symbol('MainSecurityOriginChanged') | 76 MainSecurityOriginChanged: Symbol('MainSecurityOriginChanged') |
67 }; | 77 }; |
OLD | NEW |