Chromium Code Reviews| Index: Source/devtools/front_end/sdk/SecurityManager.js |
| diff --git a/Source/devtools/front_end/sdk/SecurityManager.js b/Source/devtools/front_end/sdk/SecurityManager.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..2cc5f051158ae76a3322febcc78483d73570611b |
| --- /dev/null |
| +++ b/Source/devtools/front_end/sdk/SecurityManager.js |
| @@ -0,0 +1,49 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +/** |
| + * @constructor |
| + * @extends {WebInspector.SDKModel} |
| + * @param {!WebInspector.Target} target |
| + */ |
| +WebInspector.SecurityManager = function(target) |
|
dgozman
2015/06/03 10:12:35
Move this to security module, do not add to sdk.
lgarron
2015/06/11 22:54:46
What is the reason to add something to sdk vs. not
dgozman
2015/06/12 06:20:22
If the thing is self-contained, and nobody depends
|
| +{ |
| + WebInspector.SDKModel.call(this, WebInspector.SecurityManager, target); |
| + this._dispatcher = new WebInspector.SecurityDispatcher(this); |
| + this._target = target; |
| + this._securityAgent = target.securityAgent(); |
| + target.registerSecurityDispatcher(this._dispatcher); |
| + this._securityAgent.enable(); |
| +} |
| + |
| +WebInspector.SecurityManager.EventTypes = { |
| + SecurityStateChanged: "SecurityStateChanged" |
| +} |
| + |
| +WebInspector.SecurityManager.prototype = { |
| + targetAdded: function () {}, |
| + __proto__: WebInspector.SDKModel.prototype |
| +} |
| + |
| +/** |
| + * @constructor |
| + * @implements {SecurityAgent.Dispatcher} |
| + */ |
| +WebInspector.SecurityDispatcher = function(manager) |
| +{ |
| + this._manager = manager; |
| +} |
| + |
| +WebInspector.SecurityDispatcher.prototype = { |
| + /** |
| + * @override |
| + * @param {!SecurityAgent.SecurityState} securityState |
| + */ |
| + securityStateChanged: function(securityState) |
| + { |
| + // console.log("DISPATCHING security state", securityState); |
| + this._manager.dispatchEventToListeners(WebInspector.SecurityManager.EventTypes.SecurityStateChanged, securityState); |
| + return; |
| + } |
| +} |