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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
85 | 85 |
86 /** | 86 /** |
87 * @param {!Protocol.Security.SecurityState} securityState | 87 * @param {!Protocol.Security.SecurityState} securityState |
88 */ | 88 */ |
89 setDisplayedInsecureContentStyle(securityState) { | 89 setDisplayedInsecureContentStyle(securityState) { |
90 this._displayedInsecureContentStyle = securityState; | 90 this._displayedInsecureContentStyle = securityState; |
91 } | 91 } |
92 | 92 |
93 /** | 93 /** |
94 * @param {!Protocol.Security.SecurityState} newSecurityState | 94 * @param {!Protocol.Security.SecurityState} newSecurityState |
95 * @param {?string} summaryOverride | |
dgozman
2016/12/09 20:57:39
string
| |
96 * @param {boolean} schemeIsCryptographic | |
95 * @param {!Array<!Protocol.Security.SecurityStateExplanation>} explanations | 97 * @param {!Array<!Protocol.Security.SecurityStateExplanation>} explanations |
96 * @param {?Protocol.Security.InsecureContentStatus} insecureContentStatus | 98 * @param {?Protocol.Security.InsecureContentStatus} insecureContentStatus |
97 * @param {boolean} schemeIsCryptographic | |
98 */ | 99 */ |
99 _updateSecurityState(newSecurityState, explanations, insecureContentStatus, sc hemeIsCryptographic) { | 100 _updateSecurityState(newSecurityState, summaryOverride, schemeIsCryptographic, explanations, insecureContentStatus) { |
100 this._sidebarMainViewElement.setSecurityState(newSecurityState); | 101 this._sidebarMainViewElement.setSecurityState(newSecurityState); |
101 this._mainView.updateSecurityState(newSecurityState, explanations, insecureC ontentStatus, schemeIsCryptographic); | 102 this._mainView.updateSecurityState( |
103 newSecurityState, summaryOverride, schemeIsCryptographic, explanations, insecureContentStatus); | |
102 } | 104 } |
103 | 105 |
104 /** | 106 /** |
105 * @param {!Common.Event} event | 107 * @param {!Common.Event} event |
106 */ | 108 */ |
107 _onSecurityStateChanged(event) { | 109 _onSecurityStateChanged(event) { |
108 var data = /** @type {!Security.PageSecurityState} */ (event.data); | 110 var data = /** @type {!Security.PageSecurityState} */ (event.data); |
109 var securityState = /** @type {!Protocol.Security.SecurityState} */ (data.se curityState); | 111 var securityState = /** @type {!Protocol.Security.SecurityState} */ (data.se curityState); |
112 var summaryOverride = /** @type {string} */ (data.summaryOverride); | |
113 var schemeIsCryptographic = /** @type {boolean} */ (data.schemeIsCryptograph ic); | |
110 var explanations = /** @type {!Array<!Protocol.Security.SecurityStateExplana tion>} */ (data.explanations); | 114 var explanations = /** @type {!Array<!Protocol.Security.SecurityStateExplana tion>} */ (data.explanations); |
111 var insecureContentStatus = /** @type {?Protocol.Security.InsecureContentSta tus} */ (data.insecureContentStatus); | 115 var insecureContentStatus = /** @type {?Protocol.Security.InsecureContentSta tus} */ (data.insecureContentStatus); |
112 var schemeIsCryptographic = /** @type {boolean} */ (data.schemeIsCryptograph ic); | 116 this._updateSecurityState( |
113 this._updateSecurityState(securityState, explanations, insecureContentStatus , schemeIsCryptographic); | 117 securityState, summaryOverride, schemeIsCryptographic, explanations, ins ecureContentStatus); |
114 } | 118 } |
115 | 119 |
116 selectAndSwitchToMainView() { | 120 selectAndSwitchToMainView() { |
117 // The sidebar element will trigger displaying the main view. Rather than ma king a redundant call to display the main view, we rely on this. | 121 // The sidebar element will trigger displaying the main view. Rather than ma king a redundant call to display the main view, we rely on this. |
118 this._sidebarMainViewElement.select(); | 122 this._sidebarMainViewElement.select(); |
119 } | 123 } |
120 /** | 124 /** |
121 * @param {!Security.SecurityPanel.Origin} origin | 125 * @param {!Security.SecurityPanel.Origin} origin |
122 */ | 126 */ |
123 showOrigin(origin) { | 127 showOrigin(origin) { |
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
631 if (explanation.hasCertificate) { | 635 if (explanation.hasCertificate) { |
632 text.appendChild( | 636 text.appendChild( |
633 Security.SecurityPanel.createCertificateViewerButton(Common.UIString(' View certificate'), this._panel)); | 637 Security.SecurityPanel.createCertificateViewerButton(Common.UIString(' View certificate'), this._panel)); |
634 } | 638 } |
635 | 639 |
636 return text; | 640 return text; |
637 } | 641 } |
638 | 642 |
639 /** | 643 /** |
640 * @param {!Protocol.Security.SecurityState} newSecurityState | 644 * @param {!Protocol.Security.SecurityState} newSecurityState |
645 * @param {?string} summaryOverride | |
dgozman
2016/12/09 20:57:39
string
| |
646 * @param {boolean} schemeIsCryptographic | |
641 * @param {!Array<!Protocol.Security.SecurityStateExplanation>} explanations | 647 * @param {!Array<!Protocol.Security.SecurityStateExplanation>} explanations |
642 * @param {?Protocol.Security.InsecureContentStatus} insecureContentStatus | 648 * @param {?Protocol.Security.InsecureContentStatus} insecureContentStatus |
643 * @param {boolean} schemeIsCryptographic | |
644 */ | 649 */ |
645 updateSecurityState(newSecurityState, explanations, insecureContentStatus, sch emeIsCryptographic) { | 650 updateSecurityState(newSecurityState, summaryOverride, schemeIsCryptographic, explanations, insecureContentStatus) { |
646 // Remove old state. | 651 // Remove old state. |
647 // It's safe to call this even when this._securityState is undefined. | 652 // It's safe to call this even when this._securityState is undefined. |
648 this._summarySection.classList.remove('security-summary-' + this._securitySt ate); | 653 this._summarySection.classList.remove('security-summary-' + this._securitySt ate); |
649 | 654 |
650 // Add new state. | 655 // Add new state. |
651 this._securityState = newSecurityState; | 656 this._securityState = newSecurityState; |
652 this._summarySection.classList.add('security-summary-' + this._securityState ); | 657 this._summarySection.classList.add('security-summary-' + this._securityState ); |
653 var summaryExplanationStrings = { | 658 var summaryExplanationStrings = { |
654 'unknown': Common.UIString('The security of this page is unknown.'), | 659 'unknown': Common.UIString('The security of this page is unknown.'), |
655 'insecure': Common.UIString('This page is not secure (broken HTTPS).'), | 660 'insecure': Common.UIString('This page is not secure (broken HTTPS).'), |
656 'neutral': Common.UIString('This page is not secure.'), | 661 'neutral': Common.UIString('This page is not secure.'), |
657 'secure': Common.UIString('This page is secure (valid HTTPS).') | 662 'secure': Common.UIString('This page is secure (valid HTTPS).') |
658 }; | 663 }; |
659 this._summaryText.textContent = summaryExplanationStrings[this._securityStat e]; | 664 |
665 // Use override summary if present, otherwise use base explanation | |
666 this._summaryText.textContent = summaryOverride || summaryExplanationStrings [this._securityState]; | |
dgozman
2016/12/09 20:57:39
It's always present, just use it.
We can also remo
| |
660 | 667 |
661 this._explanations = explanations, this._insecureContentStatus = insecureCon tentStatus; | 668 this._explanations = explanations, this._insecureContentStatus = insecureCon tentStatus; |
662 this._schemeIsCryptographic = schemeIsCryptographic; | 669 this._schemeIsCryptographic = schemeIsCryptographic; |
663 | 670 |
664 this._panel.setRanInsecureContentStyle(insecureContentStatus.ranInsecureCont entStyle); | 671 this._panel.setRanInsecureContentStyle(insecureContentStatus.ranInsecureCont entStyle); |
665 this._panel.setDisplayedInsecureContentStyle(insecureContentStatus.displayed InsecureContentStyle); | 672 this._panel.setDisplayedInsecureContentStyle(insecureContentStatus.displayed InsecureContentStyle); |
666 | 673 |
667 this.refreshExplanations(); | 674 this.refreshExplanations(); |
668 } | 675 } |
669 | 676 |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1036 var row = this._element.createChild('div', 'details-table-row'); | 1043 var row = this._element.createChild('div', 'details-table-row'); |
1037 row.createChild('div').textContent = key; | 1044 row.createChild('div').textContent = key; |
1038 | 1045 |
1039 var valueDiv = row.createChild('div'); | 1046 var valueDiv = row.createChild('div'); |
1040 if (typeof value === 'string') | 1047 if (typeof value === 'string') |
1041 valueDiv.textContent = value; | 1048 valueDiv.textContent = value; |
1042 else | 1049 else |
1043 valueDiv.appendChild(value); | 1050 valueDiv.appendChild(value); |
1044 } | 1051 } |
1045 }; | 1052 }; |
OLD | NEW |