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

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

Issue 1179353002: Surface lock icon explanations in the DevTools Security panel. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Additional linter annotations. Created 5 years, 6 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
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 9e4b5dbdf04ef5668e6d0f033cc5e3d5e288c3d2..e859158e873286149dc66f7a65c73ba090f7d364 100644
--- a/Source/devtools/front_end/security/SecurityPanel.js
+++ b/Source/devtools/front_end/security/SecurityPanel.js
@@ -15,15 +15,28 @@ WebInspector.SecurityPanel = function() {
var securityStateSection = this.element.createChild("div");
this._lockIcon = securityStateSection.createChild("div", "lock-icon");
this._securityStateText = securityStateSection.createChild("div", "security-state");
+ securityStateSection.createChild("hr");
dgozman 2015/06/18 10:50:49 This is ok for now, but as you add more content we
lgarron 2015/06/18 18:16:18 Acknowledged. (I tried a few ideas like div border
+ this._securityExplanations = securityStateSection.createChild("div", "security-explanations");
WebInspector.targetManager.observeTargets(this);
}
WebInspector.SecurityPanel.prototype = {
+
+ _addExplanation: function(explanation) {
dgozman 2015/06/18 10:50:49 JSDoc please.
lgarron 2015/06/18 18:16:18 Done.
+ var explanationDiv = this._securityExplanations.createChild("div", "security-explanation");
+
+ var explanationLockIcon = explanationDiv.createChild("div", "lock-icon");
+ explanationLockIcon.classList.add("lock-icon-" + explanation.securityState);
+ explanationDiv.createChild("div", "explanation-title").textContent = explanation.summary;
+ explanationDiv.createChild("div", "explanation-text").textContent = explanation.description;
+ },
+
/**
* @param {!SecurityAgent.SecurityState} newSecurityState
+ * @param {!Array<!WebInspector.SecurityModel.SecurityStateExplanation>} explanations
*/
- _updateSecurityState: function(newSecurityState)
+ _updateSecurityState: function(newSecurityState, explanations)
{
// Remove old state.
// It's safe to call this even when this._securityState is undefined.
@@ -32,7 +45,10 @@ WebInspector.SecurityPanel.prototype = {
// Add new state.
this._securityState = newSecurityState;
this._lockIcon.classList.add("lock-icon-" + this._securityState);
- this._securityStateText.textContent = this._securityState;
+ this._securityStateText.textContent = "Page security state: " + this._securityState;
dgozman 2015/06/18 10:50:49 Wrap all user-visible text in WebInspector.UIStrin
lgarron 2015/06/18 18:16:18 Done. (We have our own [vs]printf? Awesome! 😎)
+
+ this._securityExplanations.removeChildren();
+ explanations.map(this._addExplanation.bind(this));
dgozman 2015/06/18 10:50:49 We usually use for..of for this.
lgarron 2015/06/18 18:16:18 Done. (I did not know that for...of was introduced
},
/**
@@ -40,8 +56,8 @@ WebInspector.SecurityPanel.prototype = {
*/
_onSecurityStateChanged: function(event)
{
- var securityState = /** @type {!SecurityAgent.SecurityState} */ (event.data);
- this._updateSecurityState(securityState);
+ var eventData = /** @type {!WebInspector.SecurityDispatcher.SecurityStateChangedEvent} */ (event.data);
+ this._updateSecurityState(eventData.securityState, eventData.explanations);
},
/**
@@ -54,7 +70,7 @@ WebInspector.SecurityPanel.prototype = {
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._updateSecurityState(this._securityModel.securityState(), []);
}
},
@@ -68,7 +84,7 @@ WebInspector.SecurityPanel.prototype = {
this._securityModel.removeEventListener(WebInspector.SecurityModel.EventTypes.SecurityStateChanged, this._onSecurityStateChanged, this);
delete this._securityModel;
delete this._target;
- this._updateSecurityState(/** @type {!SecurityAgent.SecurityState} */ ("unknown"));
+ this._updateSecurityState(/** @type {!SecurityAgent.SecurityState} */ ("unknown"), []);
}
},

Powered by Google App Engine
This is Rietveld 408576698