OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 /** | 4 /** |
5 * @implements {SDK.TargetManager.Observer} | 5 * @implements {SDK.TargetManager.Observer} |
6 * @unrestricted | 6 * @unrestricted |
7 */ | 7 */ |
8 Security.SecurityPanel = class extends UI.PanelWithSidebar { | 8 Security.SecurityPanel = class extends UI.PanelWithSidebar { |
9 constructor() { | 9 constructor() { |
10 super('security'); | 10 super('security'); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 */ | 45 */ |
46 static createCertificateViewerButton(text, panel) { | 46 static createCertificateViewerButton(text, panel) { |
47 /** | 47 /** |
48 * @param {!Event} e | 48 * @param {!Event} e |
49 */ | 49 */ |
50 function showCertificateViewer(e) { | 50 function showCertificateViewer(e) { |
51 e.consume(); | 51 e.consume(); |
52 panel.showCertificateViewer(); | 52 panel.showCertificateViewer(); |
53 } | 53 } |
54 | 54 |
55 return createTextButton(text, showCertificateViewer, 'security-certificate-b
utton'); | 55 return UI.createTextButton(text, showCertificateViewer, 'security-certificat
e-button'); |
56 } | 56 } |
57 | 57 |
58 /** | 58 /** |
59 * @param {string} text | 59 * @param {string} text |
60 * @param {string} origin | 60 * @param {string} origin |
61 * @return {!Element} | 61 * @return {!Element} |
62 */ | 62 */ |
63 static createCertificateViewerButton2(text, origin) { | 63 static createCertificateViewerButton2(text, origin) { |
64 /** | 64 /** |
65 * @param {!Event} e | 65 * @param {!Event} e |
66 */ | 66 */ |
67 function showCertificateViewer(e) { | 67 function showCertificateViewer(e) { |
68 function certificateCallback(names) { | 68 function certificateCallback(names) { |
69 InspectorFrontendHost.showCertificateViewer(names); | 69 InspectorFrontendHost.showCertificateViewer(names); |
70 } | 70 } |
71 | 71 |
72 e.consume(); | 72 e.consume(); |
73 SDK.multitargetNetworkManager.getCertificate(origin, certificateCallback); | 73 SDK.multitargetNetworkManager.getCertificate(origin, certificateCallback); |
74 } | 74 } |
75 | 75 |
76 return createTextButton(text, showCertificateViewer, 'security-certificate-b
utton'); | 76 return UI.createTextButton(text, showCertificateViewer, 'security-certificat
e-button'); |
77 } | 77 } |
78 | 78 |
79 /** | 79 /** |
80 * @param {!Protocol.Security.SecurityState} securityState | 80 * @param {!Protocol.Security.SecurityState} securityState |
81 */ | 81 */ |
82 setRanInsecureContentStyle(securityState) { | 82 setRanInsecureContentStyle(securityState) { |
83 this._ranInsecureContentStyle = securityState; | 83 this._ranInsecureContentStyle = securityState; |
84 } | 84 } |
85 | 85 |
86 /** | 86 /** |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 * @property {?Protocol.Network.SecurityDetails} securityDetails - Security deta
ils of the origin, if available. | 376 * @property {?Protocol.Network.SecurityDetails} securityDetails - Security deta
ils of the origin, if available. |
377 * @property {?Promise<>} certificateDetailsPromise - Certificate details of the
origin. | 377 * @property {?Promise<>} certificateDetailsPromise - Certificate details of the
origin. |
378 * @property {?Security.SecurityOriginView} originView - Current SecurityOriginV
iew corresponding to origin. | 378 * @property {?Security.SecurityOriginView} originView - Current SecurityOriginV
iew corresponding to origin. |
379 */ | 379 */ |
380 Security.SecurityPanel.OriginState; | 380 Security.SecurityPanel.OriginState; |
381 | 381 |
382 | 382 |
383 /** | 383 /** |
384 * @unrestricted | 384 * @unrestricted |
385 */ | 385 */ |
386 Security.SecurityPanelSidebarTree = class extends TreeOutlineInShadow { | 386 Security.SecurityPanelSidebarTree = class extends UI.TreeOutlineInShadow { |
387 /** | 387 /** |
388 * @param {!Security.SecurityPanelSidebarTreeElement} mainViewElement | 388 * @param {!Security.SecurityPanelSidebarTreeElement} mainViewElement |
389 * @param {function(!Security.SecurityPanel.Origin)} showOriginInPanel | 389 * @param {function(!Security.SecurityPanel.Origin)} showOriginInPanel |
390 */ | 390 */ |
391 constructor(mainViewElement, showOriginInPanel) { | 391 constructor(mainViewElement, showOriginInPanel) { |
392 super(); | 392 super(); |
393 this.registerRequiredCSS('security/sidebar.css'); | 393 this.registerRequiredCSS('security/sidebar.css'); |
394 this.registerRequiredCSS('security/lockIcon.css'); | 394 this.registerRequiredCSS('security/lockIcon.css'); |
395 this.appendChild(mainViewElement); | 395 this.appendChild(mainViewElement); |
396 | 396 |
397 this._showOriginInPanel = showOriginInPanel; | 397 this._showOriginInPanel = showOriginInPanel; |
398 this._mainOrigin = null; | 398 this._mainOrigin = null; |
399 | 399 |
400 /** @type {!Map<!Security.SecurityPanelSidebarTree.OriginGroupName, !TreeEle
ment>} */ | 400 /** @type {!Map<!Security.SecurityPanelSidebarTree.OriginGroupName, !UI.Tree
Element>} */ |
401 this._originGroups = new Map(); | 401 this._originGroups = new Map(); |
402 | 402 |
403 for (var key in Security.SecurityPanelSidebarTree.OriginGroupName) { | 403 for (var key in Security.SecurityPanelSidebarTree.OriginGroupName) { |
404 var originGroupName = Security.SecurityPanelSidebarTree.OriginGroupName[ke
y]; | 404 var originGroupName = Security.SecurityPanelSidebarTree.OriginGroupName[ke
y]; |
405 var originGroup = new TreeElement(originGroupName, true); | 405 var originGroup = new UI.TreeElement(originGroupName, true); |
406 originGroup.selectable = false; | 406 originGroup.selectable = false; |
407 originGroup.expand(); | 407 originGroup.expand(); |
408 originGroup.listItemElement.classList.add('security-sidebar-origins'); | 408 originGroup.listItemElement.classList.add('security-sidebar-origins'); |
409 this._originGroups.set(originGroupName, originGroup); | 409 this._originGroups.set(originGroupName, originGroup); |
410 this.appendChild(originGroup); | 410 this.appendChild(originGroup); |
411 } | 411 } |
412 this._clearOriginGroups(); | 412 this._clearOriginGroups(); |
413 | 413 |
414 // This message will be removed by clearOrigins() during the first new page
load after the panel was opened. | 414 // This message will be removed by clearOrigins() during the first new page
load after the panel was opened. |
415 var mainViewReloadMessage = new TreeElement(Common.UIString('Reload to view
details')); | 415 var mainViewReloadMessage = new UI.TreeElement(Common.UIString('Reload to vi
ew details')); |
416 mainViewReloadMessage.selectable = false; | 416 mainViewReloadMessage.selectable = false; |
417 mainViewReloadMessage.listItemElement.classList.add('security-main-view-relo
ad-message'); | 417 mainViewReloadMessage.listItemElement.classList.add('security-main-view-relo
ad-message'); |
418 this._originGroups.get(Security.SecurityPanelSidebarTree.OriginGroupName.Mai
nOrigin) | 418 this._originGroups.get(Security.SecurityPanelSidebarTree.OriginGroupName.Mai
nOrigin) |
419 .appendChild(mainViewReloadMessage); | 419 .appendChild(mainViewReloadMessage); |
420 | 420 |
421 /** @type {!Map<!Security.SecurityPanel.Origin, !Security.SecurityPanelSideb
arTreeElement>} */ | 421 /** @type {!Map<!Security.SecurityPanel.Origin, !Security.SecurityPanelSideb
arTreeElement>} */ |
422 this._elementsByOrigin = new Map(); | 422 this._elementsByOrigin = new Map(); |
423 } | 423 } |
424 | 424 |
425 /** | 425 /** |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
513 Security.SecurityPanelSidebarTree.OriginGroupName = { | 513 Security.SecurityPanelSidebarTree.OriginGroupName = { |
514 MainOrigin: Common.UIString('Main Origin'), | 514 MainOrigin: Common.UIString('Main Origin'), |
515 NonSecure: Common.UIString('Non-Secure Origins'), | 515 NonSecure: Common.UIString('Non-Secure Origins'), |
516 Secure: Common.UIString('Secure Origins'), | 516 Secure: Common.UIString('Secure Origins'), |
517 Unknown: Common.UIString('Unknown / Canceled') | 517 Unknown: Common.UIString('Unknown / Canceled') |
518 }; | 518 }; |
519 | 519 |
520 /** | 520 /** |
521 * @unrestricted | 521 * @unrestricted |
522 */ | 522 */ |
523 Security.SecurityPanelSidebarTreeElement = class extends TreeElement { | 523 Security.SecurityPanelSidebarTreeElement = class extends UI.TreeElement { |
524 /** | 524 /** |
525 * @param {string} text | 525 * @param {string} text |
526 * @param {function()} selectCallback | 526 * @param {function()} selectCallback |
527 * @param {string} className | 527 * @param {string} className |
528 * @param {string} cssPrefix | 528 * @param {string} cssPrefix |
529 */ | 529 */ |
530 constructor(text, selectCallback, className, cssPrefix) { | 530 constructor(text, selectCallback, className, cssPrefix) { |
531 super('', false); | 531 super('', false); |
532 this._selectCallback = selectCallback; | 532 this._selectCallback = selectCallback; |
533 this._cssPrefix = cssPrefix; | 533 this._cssPrefix = cssPrefix; |
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1042 var row = this._element.createChild('div', 'details-table-row'); | 1042 var row = this._element.createChild('div', 'details-table-row'); |
1043 row.createChild('div').textContent = key; | 1043 row.createChild('div').textContent = key; |
1044 | 1044 |
1045 var valueDiv = row.createChild('div'); | 1045 var valueDiv = row.createChild('div'); |
1046 if (typeof value === 'string') | 1046 if (typeof value === 'string') |
1047 valueDiv.textContent = value; | 1047 valueDiv.textContent = value; |
1048 else | 1048 else |
1049 valueDiv.appendChild(value); | 1049 valueDiv.appendChild(value); |
1050 } | 1050 } |
1051 }; | 1051 }; |
OLD | NEW |