Chromium Code Reviews| 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 _onSecurityStateChanged: function (event) | |
| 21 { | |
| 22 document.getElementById("lock-icon").className = ""; | |
|
dgozman
2015/06/03 10:12:35
Instead of lookup, just save elements to a field.
lgarron
2015/06/11 22:54:47
Done.
| |
| 23 document.getElementById("lock-icon").classList.add(event.data); | |
| 24 | |
| 25 document.getElementById("security-state").innerHTML = event.data; | |
| 26 }, | |
| 27 | |
| 28 createSecurityStateSection: function() | |
| 29 { | |
| 30 var securityStateSection = document.createElement("div"); | |
| 31 | |
| 32 var lockIcon = document.createElement("div"); | |
|
dgozman
2015/06/03 10:12:35
Do not use |document|. Lookup utility method in pl
lgarron
2015/06/11 22:54:47
Done.
| |
| 33 lockIcon.id = "lock-icon"; | |
| 34 lockIcon.classList.add("HTTP"); | |
| 35 securityStateSection.appendChild(lockIcon); | |
| 36 | |
| 37 var securityState = document.createElement("div"); | |
| 38 securityState.innerHTML = "N/A"; | |
|
dgozman
2015/06/03 10:12:35
No innerHTML, use textContent.
lgarron
2015/06/11 22:54:47
Cool, that's what I was looking for. Done.
| |
| 39 securityState.id = "security-state"; | |
| 40 securityStateSection.appendChild(securityState); | |
| 41 | |
| 42 return securityStateSection; | |
| 43 }, | |
| 44 | |
| 45 /** | |
| 46 * @override | |
| 47 * @param {!WebInspector.Target} target | |
| 48 */ | |
| 49 targetAdded: function(target) | |
| 50 { | |
| 51 }, | |
| 52 | |
| 53 __proto__: WebInspector.Panel.prototype | |
| 54 } | |
| 55 | |
| 56 | |
| 57 WebInspector.SecurityPanel.show = function() | |
|
dgozman
2015/06/03 10:12:35
You don't need this.
lgarron
2015/06/11 22:54:47
Done.
| |
| 58 { | |
| 59 WebInspector.inspectorView.setCurrentPanel(WebInspector.SecurityPanel._insta nce()); | |
| 60 } | |
| 61 | |
| 62 /** | |
| 63 * @return {!WebInspector.SecurityPanel} | |
| 64 */ | |
| 65 WebInspector.SecurityPanel._instance = function() | |
| 66 { | |
| 67 if (!WebInspector.SecurityPanel._instanceObject) | |
| 68 WebInspector.SecurityPanel._instanceObject = new WebInspector.SecurityPa nel(); | |
| 69 return WebInspector.SecurityPanel._instanceObject; | |
| 70 } | |
| 71 | |
| 72 /** | |
| 73 * @constructor | |
| 74 * @implements {WebInspector.PanelFactory} | |
| 75 */ | |
| 76 WebInspector.SecurityPanelFactory = function() | |
| 77 { | |
| 78 } | |
| 79 | |
| 80 WebInspector.SecurityPanelFactory.prototype = { | |
| 81 /** | |
| 82 * @override | |
| 83 * @return {!WebInspector.Panel} | |
| 84 */ | |
| 85 createPanel: function() | |
| 86 { | |
| 87 return WebInspector.SecurityPanel._instance(); | |
| 88 } | |
| 89 } | |
| OLD | NEW |