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

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

Issue 2543633009: [Devtools] Template fromTarget() function calls to model (Closed)
Patch Set: fix Created 4 years 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(SDK.SecurityOriginManager, target); 12 super(SDK.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 /** 18 /**
19 * @param {!SDK.Target} target 19 * @param {!SDK.Target} target
20 * @return {!SDK.SecurityOriginManager} 20 * @return {!SDK.SecurityOriginManager}
21 */ 21 */
22 static fromTarget(target) { 22 static fromTarget(target) {
23 var securityOriginManager = 23 var securityOriginManager = target.model(SDK.SecurityOriginManager);
24 /** @type {?SDK.SecurityOriginManager} */ (target.model(SDK.SecurityOrig inManager));
25 if (!securityOriginManager) 24 if (!securityOriginManager)
26 securityOriginManager = new SDK.SecurityOriginManager(target); 25 securityOriginManager = new SDK.SecurityOriginManager(target);
27 return securityOriginManager; 26 return securityOriginManager;
28 } 27 }
29 28
30 /** 29 /**
31 * @param {string} securityOrigin 30 * @param {string} securityOrigin
32 */ 31 */
33 addSecurityOrigin(securityOrigin) { 32 addSecurityOrigin(securityOrigin) {
34 var currentCount = this._securityOriginCounter.get(securityOrigin); 33 var currentCount = this._securityOriginCounter.get(securityOrigin);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 this.dispatchEventToListeners(SDK.SecurityOriginManager.Events.MainSecurityO riginChanged, securityOrigin); 74 this.dispatchEventToListeners(SDK.SecurityOriginManager.Events.MainSecurityO riginChanged, securityOrigin);
76 } 75 }
77 }; 76 };
78 77
79 /** @enum {symbol} */ 78 /** @enum {symbol} */
80 SDK.SecurityOriginManager.Events = { 79 SDK.SecurityOriginManager.Events = {
81 SecurityOriginAdded: Symbol('SecurityOriginAdded'), 80 SecurityOriginAdded: Symbol('SecurityOriginAdded'),
82 SecurityOriginRemoved: Symbol('SecurityOriginRemoved'), 81 SecurityOriginRemoved: Symbol('SecurityOriginRemoved'),
83 MainSecurityOriginChanged: Symbol('MainSecurityOriginChanged') 82 MainSecurityOriginChanged: Symbol('MainSecurityOriginChanged')
84 }; 83 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698