Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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 /** | 5 /** |
| 6 * @constructor | 6 * @constructor |
| 7 * @extends {WebInspector.SDKModel} | 7 * @extends {WebInspector.SDKModel} |
| 8 * @param {!WebInspector.Target} target | 8 * @param {!WebInspector.Target} target |
| 9 */ | 9 */ |
| 10 WebInspector.SecurityModel = function(target) | 10 WebInspector.SecurityModel = function(target) |
| 11 { | 11 { |
| 12 WebInspector.SDKModel.call(this, WebInspector.SecurityModel, target); | 12 WebInspector.SDKModel.call(this, WebInspector.SecurityModel, target); |
| 13 this._dispatcher = new WebInspector.SecurityDispatcher(this); | 13 this._dispatcher = new WebInspector.SecurityDispatcher(this); |
| 14 this._securityAgent = target.securityAgent(); | 14 this._securityAgent = target.securityAgent(); |
| 15 target.registerSecurityDispatcher(this._dispatcher); | 15 target.registerSecurityDispatcher(this._dispatcher); |
| 16 this._securityAgent.enable(); | 16 this._securityAgent.enable(); |
| 17 | 17 |
| 18 this._securityState = "unknown"; | 18 this._securityState = /** @type {!SecurityAgent.SecurityState} */ ("unknown" ); |
| 19 } | 19 } |
| 20 | 20 |
| 21 WebInspector.SecurityModel.EventTypes = { | 21 WebInspector.SecurityModel.EventTypes = { |
| 22 SecurityStateChanged: "SecurityStateChanged" | 22 SecurityStateChanged: "SecurityStateChanged" |
| 23 } | 23 } |
| 24 | 24 |
| 25 /** @typedef {!{ | |
|
dgozman
2015/06/18 10:50:48
Just put this in a single line.
lgarron
2015/06/18 18:16:18
Done.
| |
| 26 securityState: SecurityAgent.SecurityState, | |
| 27 summary: string, | |
| 28 description: string | |
| 29 }} | |
| 30 */ | |
| 31 WebInspector.SecurityModel.SecurityStateExplanation; | |
| 32 | |
| 25 WebInspector.SecurityModel.prototype = { | 33 WebInspector.SecurityModel.prototype = { |
| 26 /** | 34 /** |
| 27 * @return {!SecurityAgent.SecurityState} securityState | 35 * @return {!SecurityAgent.SecurityState} securityState |
| 28 */ | 36 */ |
| 29 securityState: function() | 37 securityState: function() |
| 30 { | 38 { |
| 31 return /** @type {!SecurityAgent.SecurityState} */ (this._securityState) ; | 39 return /** @type {!SecurityAgent.SecurityState} */ (this._securityState) ; |
| 32 }, | 40 }, |
| 33 | 41 |
| 34 __proto__: WebInspector.SDKModel.prototype | 42 __proto__: WebInspector.SDKModel.prototype |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 48 | 56 |
| 49 /** | 57 /** |
| 50 * @constructor | 58 * @constructor |
| 51 * @implements {SecurityAgent.Dispatcher} | 59 * @implements {SecurityAgent.Dispatcher} |
| 52 */ | 60 */ |
| 53 WebInspector.SecurityDispatcher = function(model) | 61 WebInspector.SecurityDispatcher = function(model) |
| 54 { | 62 { |
| 55 this._model = model; | 63 this._model = model; |
| 56 } | 64 } |
| 57 | 65 |
| 66 /** @typedef {!{ | |
|
dgozman
2015/06/18 10:50:48
We don't usually typdef events, since you will cas
lgarron
2015/06/18 18:16:17
Done.
| |
| 67 securityState: !SecurityAgent.SecurityState, | |
| 68 explanations: !Array<!WebInspector.SecurityModel.SecurityStateExplanatio n> | |
| 69 }} | |
| 70 */ | |
| 71 WebInspector.SecurityDispatcher.SecurityStateChangedEvent; | |
| 72 | |
| 58 WebInspector.SecurityDispatcher.prototype = { | 73 WebInspector.SecurityDispatcher.prototype = { |
| 59 /** | 74 /** |
| 60 * @override | 75 * @override |
| 61 * @param {!SecurityAgent.SecurityState} securityState | 76 * @param {!SecurityAgent.SecurityState} securityState |
| 77 * @param {!Array<!WebInspector.SecurityModel.SecurityStateExplanation>=} ex planations | |
| 62 */ | 78 */ |
| 63 securityStateChanged: function(securityState) | 79 securityStateChanged: function(securityState, explanations) |
| 64 { | 80 { |
| 65 this._model._securityState = securityState; | 81 var event = /** @type {!WebInspector.SecurityDispatcher.SecurityStateCha ngedEvent} */ ({ |
| 66 this._model.dispatchEventToListeners(WebInspector.SecurityModel.EventTyp es.SecurityStateChanged, securityState); | 82 "securityState": securityState, |
| 83 "explanations": explanations || [] | |
| 84 }); | |
| 85 this._model.dispatchEventToListeners(WebInspector.SecurityModel.EventTyp es.SecurityStateChanged, event); | |
|
dgozman
2015/06/18 10:50:48
event->data
lgarron
2015/06/18 18:16:18
Good point. Done.
| |
| 67 } | 86 } |
| 68 } | 87 } |
| OLD | NEW |