Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 /** | |
| 6 * @constructor | |
| 7 * @extends {WebInspector.SDKModel} | |
| 8 * @param {!WebInspector.Target} target | |
| 9 */ | |
| 10 WebInspector.SecurityModel = function(target) | |
| 11 { | |
| 12 WebInspector.SDKModel.call(this, WebInspector.SecurityModel, target); | |
| 13 this._dispatcher = new WebInspector.SecurityDispatcher(this); | |
| 14 this._securityAgent = target.securityAgent(); | |
| 15 target.registerSecurityDispatcher(this._dispatcher); | |
| 16 this._securityAgent.enable(); | |
| 17 | |
| 18 this._securityState = "unknown"; | |
| 19 } | |
| 20 | |
| 21 WebInspector.SecurityModel.EventTypes = { | |
| 22 SecurityStateChanged: "SecurityStateChanged" | |
| 23 } | |
| 24 | |
| 25 WebInspector.SecurityModel.prototype = { | |
| 26 /** | |
| 27 * @return {!SecurityAgent.SecurityState} securityState | |
| 28 */ | |
| 29 securityState: function() { | |
|
dgozman
2015/06/16 13:42:58
{ on next line.
| |
| 30 return /** @type {!SecurityAgent.SecurityState} */ (this._securityState) ; | |
| 31 }, | |
| 32 | |
| 33 __proto__: WebInspector.SDKModel.prototype | |
| 34 } | |
| 35 | |
| 36 /** | |
| 37 * @param {!WebInspector.Target} target | |
| 38 * @return {?WebInspector.SecurityModel} | |
| 39 */ | |
| 40 WebInspector.SecurityModel.fromTarget = function(target) | |
| 41 { | |
| 42 var model = /** @type {?WebInspector.SecurityModel} */ (target.model(WebInsp ector.SecurityModel)); | |
| 43 if (!model) | |
| 44 model = new WebInspector.SecurityModel(target); | |
| 45 return model; | |
| 46 } | |
| 47 | |
| 48 /** | |
| 49 * @constructor | |
| 50 * @implements {SecurityAgent.Dispatcher} | |
| 51 */ | |
| 52 WebInspector.SecurityDispatcher = function(manager) | |
|
dgozman
2015/06/16 13:42:58
manager->model
lgarron
2015/06/16 19:25:43
Done.
| |
| 53 { | |
| 54 this._manager = manager; | |
| 55 } | |
| 56 | |
| 57 WebInspector.SecurityDispatcher.prototype = { | |
| 58 /** | |
| 59 * @override | |
| 60 * @param {!SecurityAgent.SecurityState} securityState | |
| 61 */ | |
| 62 securityStateChanged: function(securityState) | |
| 63 { | |
| 64 this._manager._securityState = securityState; | |
| 65 this._manager.dispatchEventToListeners(WebInspector.SecurityModel.EventT ypes.SecurityStateChanged, securityState); | |
| 66 } | |
| 67 } | |
| OLD | NEW |