| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 /** |
| 6 * @constructor |
| 7 * @extends {WebInspector.Panel} |
| 8 * @implements {WebInspector.TargetManager.Observer} |
| 9 */ |
| 10 WebInspector.SecurityPanel = function() { |
| 11 WebInspector.Panel.call(this, "security"); |
| 12 this.registerRequiredCSS("security/securityPanel.css"); |
| 13 |
| 14 WebInspector.targetManager.addModelListener(WebInspector.SecurityManager, We
bInspector.SecurityManager.EventTypes.SecurityStateChanged, this._onSecurityStat
eChanged, this); |
| 15 |
| 16 this.element.appendChild(this._createSecurityStateSection()); |
| 17 } |
| 18 |
| 19 WebInspector.SecurityPanel.prototype = { |
| 20 _updateSecurityState: function (newSecurityState) |
| 21 { |
| 22 // Remove old state. |
| 23 // It's safe to call this even when this.securityState is undefined. |
| 24 this.lockIcon.classList.remove(this.securityState); |
| 25 |
| 26 // Add new state. |
| 27 this.securityState = newSecurityState; |
| 28 this.lockIcon.classList.add(this.securityState); |
| 29 this.securityStateText.textContent = this.securityState; |
| 30 }, |
| 31 |
| 32 _onSecurityStateChanged: function (event) |
| 33 { |
| 34 this._updateSecurityState(event.data); |
| 35 }, |
| 36 |
| 37 _createSecurityStateSection: function() |
| 38 { |
| 39 var securityStateSection = createElement("div"); |
| 40 |
| 41 this.lockIcon = createElementWithClass("div", "lock-icon"); |
| 42 securityStateSection.appendChild(this.lockIcon); |
| 43 |
| 44 this.securityStateText = createElementWithClass("div", "security-state")
; |
| 45 securityStateSection.appendChild(this.securityStateText); |
| 46 |
| 47 this._updateSecurityState("unknown"); |
| 48 |
| 49 return securityStateSection; |
| 50 }, |
| 51 |
| 52 /** |
| 53 * @override |
| 54 * @param {!WebInspector.Target} target |
| 55 */ |
| 56 targetAdded: function(target) |
| 57 { |
| 58 }, |
| 59 |
| 60 __proto__: WebInspector.Panel.prototype |
| 61 } |
| 62 |
| 63 /** |
| 64 * @return {!WebInspector.SecurityPanel} |
| 65 */ |
| 66 WebInspector.SecurityPanel._instance = function() |
| 67 { |
| 68 if (!WebInspector.SecurityPanel._instanceObject) |
| 69 WebInspector.SecurityPanel._instanceObject = new WebInspector.SecurityPa
nel(); |
| 70 return WebInspector.SecurityPanel._instanceObject; |
| 71 } |
| 72 |
| 73 /** |
| 74 * @constructor |
| 75 * @implements {WebInspector.PanelFactory} |
| 76 */ |
| 77 WebInspector.SecurityPanelFactory = function() |
| 78 { |
| 79 } |
| 80 |
| 81 WebInspector.SecurityPanelFactory.prototype = { |
| 82 /** |
| 83 * @override |
| 84 * @return {!WebInspector.Panel} |
| 85 */ |
| 86 createPanel: function() |
| 87 { |
| 88 return WebInspector.SecurityPanel._instance(); |
| 89 } |
| 90 } |
| OLD | NEW |