| 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
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..f37579ed71d8073ccf0b9e6faf4312101a955128
|
| --- /dev/null
|
| +++ b/Source/devtools/front_end/security/SecurityPanel.js
|
| @@ -0,0 +1,90 @@
|
| +// Copyright 2015 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +/**
|
| + * @constructor
|
| + * @extends {WebInspector.Panel}
|
| + * @implements {WebInspector.TargetManager.Observer}
|
| + */
|
| +WebInspector.SecurityPanel = function() {
|
| + WebInspector.Panel.call(this, "security");
|
| + this.registerRequiredCSS("security/securityPanel.css");
|
| +
|
| + WebInspector.targetManager.addModelListener(WebInspector.SecurityManager, WebInspector.SecurityManager.EventTypes.SecurityStateChanged, this._onSecurityStateChanged, this);
|
| +
|
| + this.element.appendChild(this._createSecurityStateSection());
|
| +}
|
| +
|
| +WebInspector.SecurityPanel.prototype = {
|
| + _updateSecurityState: function (newSecurityState)
|
| + {
|
| + // Remove old state.
|
| + // It's safe to call this even when this.securityState is undefined.
|
| + this.lockIcon.classList.remove(this.securityState);
|
| +
|
| + // Add new state.
|
| + this.securityState = newSecurityState;
|
| + this.lockIcon.classList.add(this.securityState);
|
| + this.securityStateText.textContent = this.securityState;
|
| + },
|
| +
|
| + _onSecurityStateChanged: function (event)
|
| + {
|
| + this._updateSecurityState(event.data);
|
| + },
|
| +
|
| + _createSecurityStateSection: function()
|
| + {
|
| + var securityStateSection = createElement("div");
|
| +
|
| + this.lockIcon = createElementWithClass("div", "lock-icon");
|
| + securityStateSection.appendChild(this.lockIcon);
|
| +
|
| + this.securityStateText = createElementWithClass("div", "security-state");
|
| + securityStateSection.appendChild(this.securityStateText);
|
| +
|
| + this._updateSecurityState("unknown");
|
| +
|
| + return securityStateSection;
|
| + },
|
| +
|
| + /**
|
| + * @override
|
| + * @param {!WebInspector.Target} target
|
| + */
|
| + targetAdded: function(target)
|
| + {
|
| + },
|
| +
|
| + __proto__: WebInspector.Panel.prototype
|
| +}
|
| +
|
| +/**
|
| + * @return {!WebInspector.SecurityPanel}
|
| + */
|
| +WebInspector.SecurityPanel._instance = function()
|
| +{
|
| + if (!WebInspector.SecurityPanel._instanceObject)
|
| + WebInspector.SecurityPanel._instanceObject = new WebInspector.SecurityPanel();
|
| + return WebInspector.SecurityPanel._instanceObject;
|
| +}
|
| +
|
| +/**
|
| + * @constructor
|
| + * @implements {WebInspector.PanelFactory}
|
| + */
|
| +WebInspector.SecurityPanelFactory = function()
|
| +{
|
| +}
|
| +
|
| +WebInspector.SecurityPanelFactory.prototype = {
|
| + /**
|
| + * @override
|
| + * @return {!WebInspector.Panel}
|
| + */
|
| + createPanel: function()
|
| + {
|
| + return WebInspector.SecurityPanel._instance();
|
| + }
|
| +}
|
|
|