| 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.PanelWithSidebar} | 7 * @extends {WebInspector.PanelWithSidebar} |
| 8 * @implements {WebInspector.TargetManager.Observer} | 8 * @implements {WebInspector.TargetManager.Observer} |
| 9 */ | 9 */ |
| 10 WebInspector.SecurityPanel = function() | 10 WebInspector.SecurityPanel = function() |
| 11 { | 11 { |
| 12 WebInspector.PanelWithSidebar.call(this, "security"); | 12 WebInspector.PanelWithSidebar.call(this, "security"); |
| 13 | 13 |
| 14 this._mainView = new WebInspector.SecurityMainView(this); | 14 this._mainView = new WebInspector.SecurityMainView(this); |
| 15 | 15 |
| 16 this._sidebarMainViewElement = new WebInspector.SecurityPanelSidebarTreeElem
ent(WebInspector.UIString("Overview"), this._setVisibleView.bind(this, this._mai
nView), "security-main-view-sidebar-tree-item", "lock-icon"); | 16 this._sidebarMainViewElement = new WebInspector.SecurityPanelSidebarTreeElem
ent(WebInspector.UIString("Overview"), this._setVisibleView.bind(this, this._mai
nView), "security-main-view-sidebar-tree-item", "lock-icon"); |
| 17 this._sidebarTree = new WebInspector.SecurityPanelSidebarTree(this._sidebarM
ainViewElement, this.showOrigin.bind(this)); | 17 this._sidebarTree = new WebInspector.SecurityPanelSidebarTree(this._sidebarM
ainViewElement, this.showOrigin.bind(this)); |
| 18 this.panelSidebarElement().appendChild(this._sidebarTree.element); | 18 this.panelSidebarElement().appendChild(this._sidebarTree.element); |
| 19 | 19 |
| 20 /** @type {!Map<!NetworkAgent.LoaderId, !WebInspector.NetworkRequest>} */ | 20 /** @type {!Map<!NetworkAgent.LoaderId, !WebInspector.NetworkRequest>} */ |
| 21 this._lastResponseReceivedForLoaderId = new Map(); | 21 this._lastResponseReceivedForLoaderId = new Map(); |
| 22 | 22 |
| 23 /** @type {!Map<!WebInspector.SecurityPanel.Origin, !WebInspector.SecurityPa
nel.OriginState>} */ | 23 /** @type {!Map<!WebInspector.SecurityPanel.Origin, !WebInspector.SecurityPa
nel.OriginState>} */ |
| 24 this._origins = new Map(); | 24 this._origins = new Map(); |
| 25 | 25 |
| 26 /** @type {!Map<!WebInspector.NetworkLogView.MixedContentFilterValues, numbe
r>} */ | 26 /** @type {!Map<!WebInspector.NetworkLogView.MixedContentFilterValues, numbe
r>} */ |
| 27 this._filterRequestCounts = new Map(); | 27 this._filterRequestCounts = new Map(); |
| 28 | 28 |
| 29 /** @type {!Map<!WebInspector.Target, !Array<!WebInspector.EventTarget.Event
Descriptor>>}*/ |
| 30 this._eventListeners = new Map(); |
| 29 WebInspector.targetManager.observeTargets(this, WebInspector.Target.Capabili
ty.Network); | 31 WebInspector.targetManager.observeTargets(this, WebInspector.Target.Capabili
ty.Network); |
| 30 } | 32 } |
| 31 | 33 |
| 32 /** @typedef {string} */ | 34 /** @typedef {string} */ |
| 33 WebInspector.SecurityPanel.Origin; | 35 WebInspector.SecurityPanel.Origin; |
| 34 | 36 |
| 35 /** | 37 /** |
| 36 * @typedef {Object} | 38 * @typedef {Object} |
| 37 * @property {!SecurityAgent.SecurityState} securityState - Current security sta
te of the origin. | 39 * @property {!SecurityAgent.SecurityState} securityState - Current security sta
te of the origin. |
| 38 * @property {?NetworkAgent.SecurityDetails} securityDetails - Security details
of the origin, if available. | 40 * @property {?NetworkAgent.SecurityDetails} securityDetails - Security details
of the origin, if available. |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 | 252 |
| 251 /** | 253 /** |
| 252 * @override | 254 * @override |
| 253 * @param {!WebInspector.Target} target | 255 * @param {!WebInspector.Target} target |
| 254 */ | 256 */ |
| 255 targetAdded: function(target) | 257 targetAdded: function(target) |
| 256 { | 258 { |
| 257 if (this._target) | 259 if (this._target) |
| 258 return; | 260 return; |
| 259 | 261 |
| 260 this._target = target; | 262 var listeners = []; |
| 261 | 263 var resourceTreeModel = WebInspector.ResourceTreeModel.fromTarget(target
); |
| 262 var resourceTreeModel = WebInspector.ResourceTreeModel.fromTarget(this._
target); | |
| 263 if (resourceTreeModel) { | 264 if (resourceTreeModel) { |
| 264 resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.Ev
ents.MainFrameNavigated, this._onMainFrameNavigated, this); | 265 listeners = listeners.concat([ |
| 265 resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.Ev
ents.InterstitialShown, this._onInterstitialShown, this); | 266 resourceTreeModel.addEventListener(WebInspector.ResourceTreeMode
l.Events.MainFrameNavigated, this._onMainFrameNavigated, this), |
| 266 resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.Ev
ents.InterstitialHidden, this._onInterstitialHidden, this); | 267 resourceTreeModel.addEventListener(WebInspector.ResourceTreeMode
l.Events.InterstitialShown, this._onInterstitialShown, this), |
| 268 resourceTreeModel.addEventListener(WebInspector.ResourceTreeMode
l.Events.InterstitialHidden, this._onInterstitialHidden, this), |
| 269 ]); |
| 267 } | 270 } |
| 268 | 271 |
| 269 var networkManager = WebInspector.NetworkManager.fromTarget(target); | 272 var networkManager = WebInspector.NetworkManager.fromTarget(target); |
| 270 networkManager.addEventListener(WebInspector.NetworkManager.Events.Respo
nseReceived, this._onResponseReceived, this); | 273 if (networkManager) { |
| 271 networkManager.addEventListener(WebInspector.NetworkManager.Events.Reque
stFinished, this._onRequestFinished, this); | 274 listeners = listeners.concat([ |
| 275 networkManager.addEventListener(WebInspector.NetworkManager.Even
ts.ResponseReceived, this._onResponseReceived, this), |
| 276 networkManager.addEventListener(WebInspector.NetworkManager.Even
ts.RequestFinished, this._onRequestFinished, this), |
| 277 ]); |
| 278 } |
| 272 | 279 |
| 273 var securityModel = WebInspector.SecurityModel.fromTarget(target); | 280 var securityModel = WebInspector.SecurityModel.fromTarget(target); |
| 274 securityModel.addEventListener(WebInspector.SecurityModel.Events.Securit
yStateChanged, this._onSecurityStateChanged, this); | 281 if (securityModel) { |
| 282 listeners = listeners.concat([ |
| 283 securityModel.addEventListener(WebInspector.SecurityModel.Events
.SecurityStateChanged, this._onSecurityStateChanged, this) |
| 284 ]); |
| 285 } |
| 286 |
| 287 this._target = target; |
| 288 this._eventListeners.set(target, listeners); |
| 275 }, | 289 }, |
| 276 | 290 |
| 277 /** | 291 /** |
| 278 * @override | 292 * @override |
| 279 * @param {!WebInspector.Target} target | 293 * @param {!WebInspector.Target} target |
| 280 */ | 294 */ |
| 281 targetRemoved: function(target) | 295 targetRemoved: function(target) |
| 282 { | 296 { |
| 297 if (this._target !== target) |
| 298 return; |
| 299 |
| 300 delete this._target; |
| 301 |
| 302 WebInspector.EventTarget.removeEventListeners(this._eventListeners.get(t
arget)); |
| 303 this._eventListeners.delete(target); |
| 283 }, | 304 }, |
| 284 | 305 |
| 285 /** | 306 /** |
| 286 * @param {!WebInspector.Event} event | 307 * @param {!WebInspector.Event} event |
| 287 */ | 308 */ |
| 288 _onMainFrameNavigated: function(event) | 309 _onMainFrameNavigated: function(event) |
| 289 { | 310 { |
| 290 var frame = /** type {!PageAgent.Frame}*/ (event.data); | 311 var frame = /** type {!PageAgent.Frame}*/ (event.data); |
| 291 var request = this._lastResponseReceivedForLoaderId.get(frame.loaderId); | 312 var request = this._lastResponseReceivedForLoaderId.get(frame.loaderId); |
| 292 | 313 |
| (...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1042 row.createChild("div").textContent = key; | 1063 row.createChild("div").textContent = key; |
| 1043 | 1064 |
| 1044 var valueDiv = row.createChild("div"); | 1065 var valueDiv = row.createChild("div"); |
| 1045 if (typeof value === "string") { | 1066 if (typeof value === "string") { |
| 1046 valueDiv.textContent = value; | 1067 valueDiv.textContent = value; |
| 1047 } else { | 1068 } else { |
| 1048 valueDiv.appendChild(value); | 1069 valueDiv.appendChild(value); |
| 1049 } | 1070 } |
| 1050 } | 1071 } |
| 1051 } | 1072 } |
| OLD | NEW |