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) |
(...skipping 30 matching lines...) Expand all Loading... |
41 WebInspector.SecurityModel.fromTarget = function(target) | 41 WebInspector.SecurityModel.fromTarget = function(target) |
42 { | 42 { |
43 var model = /** @type {?WebInspector.SecurityModel} */ (target.model(WebInsp
ector.SecurityModel)); | 43 var model = /** @type {?WebInspector.SecurityModel} */ (target.model(WebInsp
ector.SecurityModel)); |
44 if (!model) | 44 if (!model) |
45 model = new WebInspector.SecurityModel(target); | 45 model = new WebInspector.SecurityModel(target); |
46 return model; | 46 return model; |
47 } | 47 } |
48 | 48 |
49 /** | 49 /** |
50 * @constructor | 50 * @constructor |
| 51 * @param {!SecurityAgent.SecurityState} securityState |
| 52 * @param {!Array<!SecurityAgent.SecurityStateExplanation>} explanations |
| 53 * @param {?SecurityAgent.MixedContentStatus} mixedContentStatus |
| 54 * @param {boolean} schemeIsCryptographic |
| 55 */ |
| 56 WebInspector.PageSecurityState = function (securityState, explanations, mixedCon
tentStatus, schemeIsCryptographic) { |
| 57 this.securityState = securityState; |
| 58 this.explanations = explanations; |
| 59 this.mixedContentStatus = mixedContentStatus; |
| 60 this.schemeIsCryptographic = schemeIsCryptographic; |
| 61 } |
| 62 |
| 63 /** |
| 64 * @constructor |
51 * @implements {SecurityAgent.Dispatcher} | 65 * @implements {SecurityAgent.Dispatcher} |
52 */ | 66 */ |
53 WebInspector.SecurityDispatcher = function(model) | 67 WebInspector.SecurityDispatcher = function(model) |
54 { | 68 { |
55 this._model = model; | 69 this._model = model; |
56 } | 70 } |
57 | 71 |
58 WebInspector.SecurityDispatcher.prototype = { | 72 WebInspector.SecurityDispatcher.prototype = { |
59 /** | 73 /** |
60 * @override | 74 * @override |
61 * @param {!SecurityAgent.SecurityState} securityState | 75 * @param {!SecurityAgent.SecurityState} securityState |
62 * @param {!Array<!SecurityAgent.SecurityStateExplanation>=} explanations | 76 * @param {!Array<!SecurityAgent.SecurityStateExplanation>=} explanations |
63 * @param {!SecurityAgent.MixedContentStatus=} mixedContentStatus | 77 * @param {!SecurityAgent.MixedContentStatus=} mixedContentStatus |
64 * @param {boolean=} schemeIsCryptographic | 78 * @param {boolean=} schemeIsCryptographic |
65 */ | 79 */ |
66 securityStateChanged: function(securityState, explanations, mixedContentStat
us, schemeIsCryptographic) | 80 securityStateChanged: function(securityState, explanations, mixedContentStat
us, schemeIsCryptographic) |
67 { | 81 { |
68 var data = {"securityState": securityState, "explanations": explanations
|| []}; | 82 var pageSecurityState = new WebInspector.PageSecurityState(securityState
, explanations || [], mixedContentStatus || null, schemeIsCryptographic || false
); |
69 if (schemeIsCryptographic && mixedContentStatus) { | 83 this._model.dispatchEventToListeners(WebInspector.SecurityModel.EventTyp
es.SecurityStateChanged, pageSecurityState); |
70 if (mixedContentStatus.ranInsecureContent) { | |
71 explanations.push({ | |
72 "securityState": mixedContentStatus.ranInsecureContentStyle, | |
73 "summary": WebInspector.UIString("Active Mixed Content"), | |
74 "description": WebInspector.UIString("You have recently allo
wed insecure content (such as scripts or iframes) to run on this site.") | |
75 }); | |
76 } else if (mixedContentStatus.displayedInsecureContent) { | |
77 explanations.push({ | |
78 "securityState": mixedContentStatus.displayedInsecureContent
Style, | |
79 "summary": WebInspector.UIString("Mixed Content"), | |
80 "description": WebInspector.UIString("The site includes HTTP
resources.") | |
81 }); | |
82 } | |
83 } | |
84 this._model.dispatchEventToListeners(WebInspector.SecurityModel.EventTyp
es.SecurityStateChanged, data); | |
85 } | 84 } |
86 } | 85 } |
OLD | NEW |