Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(217)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/sdk/SecurityOriginManager.js

Issue 2782773002: [DevTools] Remove SDKModels' fromTarget methods (Closed)
Patch Set: addressed review comments Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 */ 10 */
11 constructor(target) { 11 constructor(target) {
12 super(target); 12 super(target);
13 13
14 /** @type {!Set<string>} */ 14 /** @type {!Set<string>} */
15 this._securityOrigins = new Set(); 15 this._securityOrigins = new Set();
16 this._mainSecurityOrigin = ''; 16 this._mainSecurityOrigin = '';
17 } 17 }
18 18
19 /** 19 /**
20 * @param {!SDK.Target} target
21 * @return {!SDK.SecurityOriginManager}
22 */
23 static fromTarget(target) {
24 return /** @type {!SDK.SecurityOriginManager} */ (target.model(SDK.SecurityO riginManager));
25 }
26
27 /**
28 * @param {!Set<string>} securityOrigins 20 * @param {!Set<string>} securityOrigins
29 */ 21 */
30 updateSecurityOrigins(securityOrigins) { 22 updateSecurityOrigins(securityOrigins) {
31 var oldOrigins = this._securityOrigins; 23 var oldOrigins = this._securityOrigins;
32 this._securityOrigins = securityOrigins; 24 this._securityOrigins = securityOrigins;
33 25
34 for (var origin of oldOrigins) { 26 for (var origin of oldOrigins) {
35 if (!this._securityOrigins.has(origin)) 27 if (!this._securityOrigins.has(origin))
36 this.dispatchEventToListeners(SDK.SecurityOriginManager.Events.SecurityO riginRemoved, origin); 28 this.dispatchEventToListeners(SDK.SecurityOriginManager.Events.SecurityO riginRemoved, origin);
37 } 29 }
(...skipping 28 matching lines...) Expand all
66 }; 58 };
67 59
68 SDK.SDKModel.register(SDK.SecurityOriginManager, SDK.Target.Capability.None, fal se); 60 SDK.SDKModel.register(SDK.SecurityOriginManager, SDK.Target.Capability.None, fal se);
69 61
70 /** @enum {symbol} */ 62 /** @enum {symbol} */
71 SDK.SecurityOriginManager.Events = { 63 SDK.SecurityOriginManager.Events = {
72 SecurityOriginAdded: Symbol('SecurityOriginAdded'), 64 SecurityOriginAdded: Symbol('SecurityOriginAdded'),
73 SecurityOriginRemoved: Symbol('SecurityOriginRemoved'), 65 SecurityOriginRemoved: Symbol('SecurityOriginRemoved'),
74 MainSecurityOriginChanged: Symbol('MainSecurityOriginChanged') 66 MainSecurityOriginChanged: Symbol('MainSecurityOriginChanged')
75 }; 67 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698