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

Side by Side Diff: Source/devtools/front_end/security/SecurityPanel.js

Issue 1159163005: Add a minimal Security panel to DevTools (behind a hidden experiment). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Move SecurityManager back to sdk/ while Target.js still uses it. 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 unified diff | Download patch
OLDNEW
(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}
dgozman 2015/06/15 16:58:42 You don't need this.
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);
dgozman 2015/06/15 16:58:41 Will you have security for different frames or wor
lgarron 2015/06/15 22:38:08 We might someday, but it's fine not to have them f
dgozman 2015/06/16 13:42:58 Oh, I see. Then you should bring back TargetManage
15
16 this.element.appendChild(this._createSecurityStateSection());
dgozman 2015/06/15 16:58:41 I'd inline it here.
17 }
18
19 WebInspector.SecurityPanel.prototype = {
20 _updateSecurityState: function (newSecurityState)
dgozman 2015/06/15 16:58:41 No space after "function" anywhere, please.
dgozman 2015/06/15 16:58:41 JSDoc please.
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;
dgozman 2015/06/15 16:58:41 this._securityState
28 this.lockIcon.classList.add(this.securityState);
29 this.securityStateText.textContent = this.securityState;
30 },
31
32 _onSecurityStateChanged: function (event)
dgozman 2015/06/15 16:58:42 JSDoc please.
33 {
34 this._updateSecurityState(event.data);
35 },
36
37 _createSecurityStateSection: function()
dgozman 2015/06/15 16:58:42 JSDoc please.
38 {
39 var securityStateSection = createElement("div");
40
41 this.lockIcon = createElementWithClass("div", "lock-icon");
dgozman 2015/06/15 16:58:42 this._lockIcon since it's private.
42 securityStateSection.appendChild(this.lockIcon);
dgozman 2015/06/15 16:58:42 Shortcut code: |this._lockIcon = securityStateSect
43
44 this.securityStateText = createElementWithClass("div", "security-state") ;
dgozman 2015/06/15 16:58:42 this._securityStateText
45 securityStateSection.appendChild(this.securityStateText);
dgozman 2015/06/15 16:58:42 createChild
46
47 this._updateSecurityState("unknown");
dgozman 2015/06/15 16:58:41 Better move the default "unknown" state into model
lgarron 2015/06/15 22:38:08 Sounds like a good use for a securityState() gette
48
49 return securityStateSection;
50 },
51
52 /**
53 * @override
54 * @param {!WebInspector.Target} target
55 */
56 targetAdded: function(target)
dgozman 2015/06/15 16:58:41 Remove.
57 {
58 },
59
60 /**
61 * @override
62 * @param {!WebInspector.Target} target
63 */
64 targetRemoved: function(target)
dgozman 2015/06/15 16:58:41 Remove.
65 {
66 },
67
68 __proto__: WebInspector.Panel.prototype
69 }
70
71 /**
72 * @return {!WebInspector.SecurityPanel}
73 */
74 WebInspector.SecurityPanel._instance = function()
75 {
76 if (!WebInspector.SecurityPanel._instanceObject)
77 WebInspector.SecurityPanel._instanceObject = new WebInspector.SecurityPa nel();
78 return WebInspector.SecurityPanel._instanceObject;
79 }
80
81 /**
82 * @constructor
83 * @implements {WebInspector.PanelFactory}
84 */
85 WebInspector.SecurityPanelFactory = function()
86 {
87 }
88
89 WebInspector.SecurityPanelFactory.prototype = {
90 /**
91 * @override
92 * @return {!WebInspector.Panel}
93 */
94 createPanel: function()
95 {
96 return WebInspector.SecurityPanel._instance();
97 }
98 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698