Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(948)

Unified Diff: Source/devtools/front_end/security/SecurityPanel.js

Issue 1311013007: Add model listeners in the Security panel constructor (instead of in targetAdded). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/security/SecurityPanel.js
diff --git a/Source/devtools/front_end/security/SecurityPanel.js b/Source/devtools/front_end/security/SecurityPanel.js
index 166d8aa84258b5fcb5123b40355ac0b759f95b4e..da81c396a25dcdd2ada438246bc08a45af1dd923 100644
--- a/Source/devtools/front_end/security/SecurityPanel.js
+++ b/Source/devtools/front_end/security/SecurityPanel.js
@@ -34,6 +34,9 @@ WebInspector.SecurityPanel = function()
this._origins = new Map();
// TODO(lgarron): add event listeners to call _clear() once we figure out how to clear the panel properly (https://crbug.com/522762).
+ WebInspector.targetManager.addModelListener(WebInspector.NetworkManager, WebInspector.NetworkManager.EventTypes.ResponseReceivedSecurityDetails, this._onResponseReceivedSecurityDetails, this);
+ WebInspector.targetManager.addModelListener(WebInspector.SecurityModel, WebInspector.SecurityModel.EventTypes.SecurityStateChanged, this._onSecurityStateChanged, this);
+
WebInspector.targetManager.observeTargets(this);
}
@@ -164,16 +167,7 @@ WebInspector.SecurityPanel.prototype = {
*/
targetAdded: function(target)
{
- if (!this._target) {
- this._target = target;
- this._securityModel = WebInspector.SecurityModel.fromTarget(target);
- this._securityModel.addEventListener(WebInspector.SecurityModel.EventTypes.SecurityStateChanged, this._onSecurityStateChanged, this);
- this._updateSecurityState(this._securityModel.securityState(), []);
-
- this._origins.clear();
- this._networkManager = target.networkManager;
- this._networkManager.addEventListener(WebInspector.NetworkManager.EventTypes.ResponseReceivedSecurityDetails, this._onResponseReceivedSecurityDetails, this);
- }
+ WebInspector.SecurityModel.fromTarget(target);
},
/**
@@ -182,14 +176,6 @@ WebInspector.SecurityPanel.prototype = {
*/
targetRemoved: function(target)
{
- if (target === this._target) {
- this._securityModel.removeEventListener(WebInspector.SecurityModel.EventTypes.SecurityStateChanged, this._onSecurityStateChanged, this);
- delete this._securityModel;
- this._networkManager.removeEventListener(WebInspector.NetworkManager.EventTypes.ResponseReceivedSecurityDetails, this._onResponseReceivedSecurityDetails, this);
- delete this._networkManager;
- delete this._target;
- this._clear();
- }
},
_clear: function()
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698