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

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

Issue 2542533004: Override DevTools security summary when a Safe Browsing warning shows. (Closed)
Patch Set: Address review feedback Created 4 years 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
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/security/SecurityModel.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 {boolean} schemeIsCryptographic
95 * @param {!Array<!Protocol.Security.SecurityStateExplanation>} explanations 96 * @param {!Array<!Protocol.Security.SecurityStateExplanation>} explanations
96 * @param {?Protocol.Security.InsecureContentStatus} insecureContentStatus 97 * @param {?Protocol.Security.InsecureContentStatus} insecureContentStatus
97 * @param {boolean} schemeIsCryptographic 98 * @param {?string} summary
98 */ 99 */
99 _updateSecurityState(newSecurityState, explanations, insecureContentStatus, sc hemeIsCryptographic) { 100 _updateSecurityState(newSecurityState, schemeIsCryptographic, explanations, in secureContentStatus, summary) {
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, schemeIsCryptographic, explanations, insecureContentSt atus, summary);
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 schemeIsCryptographic = /** @type {boolean} */ (data.schemeIsCryptograph ic);
110 var explanations = /** @type {!Array<!Protocol.Security.SecurityStateExplana tion>} */ (data.explanations); 113 var explanations = /** @type {!Array<!Protocol.Security.SecurityStateExplana tion>} */ (data.explanations);
111 var insecureContentStatus = /** @type {?Protocol.Security.InsecureContentSta tus} */ (data.insecureContentStatus); 114 var insecureContentStatus = /** @type {?Protocol.Security.InsecureContentSta tus} */ (data.insecureContentStatus);
112 var schemeIsCryptographic = /** @type {boolean} */ (data.schemeIsCryptograph ic); 115 var summary = /** @type {?string} */ (data.summary);
113 this._updateSecurityState(securityState, explanations, insecureContentStatus , schemeIsCryptographic); 116 this._updateSecurityState(securityState, schemeIsCryptographic, explanations , insecureContentStatus, summary);
114 } 117 }
115 118
116 selectAndSwitchToMainView() { 119 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. 120 // 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(true); 121 this._sidebarMainViewElement.select(true);
119 } 122 }
120 /** 123 /**
121 * @param {!Security.SecurityPanel.Origin} origin 124 * @param {!Security.SecurityPanel.Origin} origin
122 */ 125 */
123 showOrigin(origin) { 126 showOrigin(origin) {
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 if (explanation.hasCertificate) { 634 if (explanation.hasCertificate) {
632 text.appendChild( 635 text.appendChild(
633 Security.SecurityPanel.createCertificateViewerButton(Common.UIString(' View certificate'), this._panel)); 636 Security.SecurityPanel.createCertificateViewerButton(Common.UIString(' View certificate'), this._panel));
634 } 637 }
635 638
636 return text; 639 return text;
637 } 640 }
638 641
639 /** 642 /**
640 * @param {!Protocol.Security.SecurityState} newSecurityState 643 * @param {!Protocol.Security.SecurityState} newSecurityState
644 * @param {boolean} schemeIsCryptographic
641 * @param {!Array<!Protocol.Security.SecurityStateExplanation>} explanations 645 * @param {!Array<!Protocol.Security.SecurityStateExplanation>} explanations
642 * @param {?Protocol.Security.InsecureContentStatus} insecureContentStatus 646 * @param {?Protocol.Security.InsecureContentStatus} insecureContentStatus
643 * @param {boolean} schemeIsCryptographic 647 * @param {?string} summary
644 */ 648 */
645 updateSecurityState(newSecurityState, explanations, insecureContentStatus, sch emeIsCryptographic) { 649 updateSecurityState(newSecurityState, schemeIsCryptographic, explanations, ins ecureContentStatus, summary) {
646 // Remove old state. 650 // Remove old state.
647 // It's safe to call this even when this._securityState is undefined. 651 // It's safe to call this even when this._securityState is undefined.
648 this._summarySection.classList.remove('security-summary-' + this._securitySt ate); 652 this._summarySection.classList.remove('security-summary-' + this._securitySt ate);
649 653
650 // Add new state. 654 // Add new state.
651 this._securityState = newSecurityState; 655 this._securityState = newSecurityState;
652 this._summarySection.classList.add('security-summary-' + this._securityState ); 656 this._summarySection.classList.add('security-summary-' + this._securityState );
653 var summaryExplanationStrings = { 657 var summaryExplanationStrings = {
654 'unknown': Common.UIString('The security of this page is unknown.'), 658 'unknown': Common.UIString('The security of this page is unknown.'),
655 'insecure': Common.UIString('This page is not secure (broken HTTPS).'), 659 'insecure': Common.UIString('This page is not secure (broken HTTPS).'),
656 'neutral': Common.UIString('This page is not secure.'), 660 'neutral': Common.UIString('This page is not secure.'),
657 'secure': Common.UIString('This page is secure (valid HTTPS).') 661 'secure': Common.UIString('This page is secure (valid HTTPS).')
658 }; 662 };
659 this._summaryText.textContent = summaryExplanationStrings[this._securityStat e]; 663
664 // Use override summary if present, otherwise use base explanation
665 this._summaryText.textContent = summary || summaryExplanationStrings[this._s ecurityState];
660 666
661 this._explanations = explanations, this._insecureContentStatus = insecureCon tentStatus; 667 this._explanations = explanations, this._insecureContentStatus = insecureCon tentStatus;
662 this._schemeIsCryptographic = schemeIsCryptographic; 668 this._schemeIsCryptographic = schemeIsCryptographic;
663 669
664 this._panel.setRanInsecureContentStyle(insecureContentStatus.ranInsecureCont entStyle); 670 this._panel.setRanInsecureContentStyle(insecureContentStatus.ranInsecureCont entStyle);
665 this._panel.setDisplayedInsecureContentStyle(insecureContentStatus.displayed InsecureContentStyle); 671 this._panel.setDisplayedInsecureContentStyle(insecureContentStatus.displayed InsecureContentStyle);
666 672
667 this.refreshExplanations(); 673 this.refreshExplanations();
668 } 674 }
669 675
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
1036 var row = this._element.createChild('div', 'details-table-row'); 1042 var row = this._element.createChild('div', 'details-table-row');
1037 row.createChild('div').textContent = key; 1043 row.createChild('div').textContent = key;
1038 1044
1039 var valueDiv = row.createChild('div'); 1045 var valueDiv = row.createChild('div');
1040 if (typeof value === 'string') 1046 if (typeof value === 'string')
1041 valueDiv.textContent = value; 1047 valueDiv.textContent = value;
1042 else 1048 else
1043 valueDiv.appendChild(value); 1049 valueDiv.appendChild(value);
1044 } 1050 }
1045 }; 1051 };
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/security/SecurityModel.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698