| 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() |
| 30 { |
| 31 return /** @type {!SecurityAgent.SecurityState} */ (this._securityState)
; |
| 32 }, |
| 33 |
| 34 __proto__: WebInspector.SDKModel.prototype |
| 35 } |
| 36 |
| 37 /** |
| 38 * @param {!WebInspector.Target} target |
| 39 * @return {?WebInspector.SecurityModel} |
| 40 */ |
| 41 WebInspector.SecurityModel.fromTarget = function(target) |
| 42 { |
| 43 var model = /** @type {?WebInspector.SecurityModel} */ (target.model(WebInsp
ector.SecurityModel)); |
| 44 if (!model) |
| 45 model = new WebInspector.SecurityModel(target); |
| 46 return model; |
| 47 } |
| 48 |
| 49 /** |
| 50 * @constructor |
| 51 * @implements {SecurityAgent.Dispatcher} |
| 52 */ |
| 53 WebInspector.SecurityDispatcher = function(model) |
| 54 { |
| 55 this._model = model; |
| 56 } |
| 57 |
| 58 WebInspector.SecurityDispatcher.prototype = { |
| 59 /** |
| 60 * @override |
| 61 * @param {!SecurityAgent.SecurityState} securityState |
| 62 */ |
| 63 securityStateChanged: function(securityState) |
| 64 { |
| 65 this._model._securityState = securityState; |
| 66 this._model.dispatchEventToListeners(WebInspector.SecurityModel.EventTyp
es.SecurityStateChanged, securityState); |
| 67 } |
| 68 } |
| OLD | NEW |