Chromium Code Reviews| Index: third_party/WebKit/Source/devtools/front_end/security/SecurityPanel.js |
| diff --git a/third_party/WebKit/Source/devtools/front_end/security/SecurityPanel.js b/third_party/WebKit/Source/devtools/front_end/security/SecurityPanel.js |
| index 0d797c63e570feb58010aab49c274a46cab5ffd4..be44cda59c65d203899d56be2673abcb48529e5f 100644 |
| --- a/third_party/WebKit/Source/devtools/front_end/security/SecurityPanel.js |
| +++ b/third_party/WebKit/Source/devtools/front_end/security/SecurityPanel.js |
| @@ -95,10 +95,11 @@ Security.SecurityPanel = class extends UI.PanelWithSidebar { |
| * @param {!Array<!Protocol.Security.SecurityStateExplanation>} explanations |
| * @param {?Protocol.Security.InsecureContentStatus} insecureContentStatus |
| * @param {boolean} schemeIsCryptographic |
| + * @param {boolean} interstitialIsShowing |
| */ |
| - _updateSecurityState(newSecurityState, explanations, insecureContentStatus, schemeIsCryptographic) { |
| + _updateSecurityState(newSecurityState, explanations, insecureContentStatus, schemeIsCryptographic, interstitialIsShowing) { |
| this._sidebarMainViewElement.setSecurityState(newSecurityState); |
| - this._mainView.updateSecurityState(newSecurityState, explanations, insecureContentStatus, schemeIsCryptographic); |
| + this._mainView.updateSecurityState(newSecurityState, explanations, insecureContentStatus, schemeIsCryptographic, interstitialIsShowing); |
| } |
| /** |
| @@ -110,13 +111,22 @@ Security.SecurityPanel = class extends UI.PanelWithSidebar { |
| var explanations = /** @type {!Array<!Protocol.Security.SecurityStateExplanation>} */ (data.explanations); |
| var insecureContentStatus = /** @type {?Protocol.Security.InsecureContentStatus} */ (data.insecureContentStatus); |
| var schemeIsCryptographic = /** @type {boolean} */ (data.schemeIsCryptographic); |
| - this._updateSecurityState(securityState, explanations, insecureContentStatus, schemeIsCryptographic); |
| + var interstitialIsShowing = /** @type {boolean} */ (data.interstitialIsShowing); |
| + this._updateSecurityState(securityState, explanations, insecureContentStatus, schemeIsCryptographic, interstitialIsShowing); |
| } |
| selectAndSwitchToMainView() { |
| // The sidebar element will trigger displaying the main view. Rather than making a redundant call to display the main view, we rely on this. |
| this._sidebarMainViewElement.select(); |
| } |
| + |
| + /** |
| + * @param {boolean} hidden |
| + */ |
| + toggleOriginsList(hidden) { |
| + this._sidebarTree.toggleOriginsList(hidden); |
| + } |
| + |
| /** |
| * @param {!Security.SecurityPanel.Origin} origin |
| */ |
| @@ -287,9 +297,9 @@ Security.SecurityPanel = class extends UI.PanelWithSidebar { |
| resourceTreeModel.addEventListener( |
| SDK.ResourceTreeModel.Events.MainFrameNavigated, this._onMainFrameNavigated, this), |
| resourceTreeModel.addEventListener( |
| - SDK.ResourceTreeModel.Events.InterstitialShown, this._onInterstitialShown, this), |
| + SDK.ResourceTreeModel.Events.InterstitialShown, this.onInterstitialShown, this), |
| resourceTreeModel.addEventListener( |
| - SDK.ResourceTreeModel.Events.InterstitialHidden, this._onInterstitialHidden, this), |
| + SDK.ResourceTreeModel.Events.InterstitialHidden, this.onInterstitialHidden, this), |
| ]); |
| } |
| @@ -348,7 +358,7 @@ Security.SecurityPanel = class extends UI.PanelWithSidebar { |
| } |
| } |
| - _onInterstitialShown() { |
| + onInterstitialShown() { |
| // The panel might have been displaying the origin view on the |
| // previously loaded page. When showing an interstitial, switch |
| // back to the Overview view. |
| @@ -356,7 +366,7 @@ Security.SecurityPanel = class extends UI.PanelWithSidebar { |
| this._sidebarTree.toggleOriginsList(true /* hidden */); |
| } |
| - _onInterstitialHidden() { |
| + onInterstitialHidden() { |
| this._sidebarTree.toggleOriginsList(false /* hidden */); |
| } |
| }; |
| @@ -390,6 +400,7 @@ Security.SecurityPanelSidebarTree = class extends TreeOutlineInShadow { |
| this._showOriginInPanel = showOriginInPanel; |
| this._mainOrigin = null; |
| + this._originsAreHidden = false; |
| /** @type {!Map<!Security.SecurityPanelSidebarTree.OriginGroupName, !TreeElement>} */ |
| this._originGroups = new Map(); |
| @@ -420,6 +431,7 @@ Security.SecurityPanelSidebarTree = class extends TreeOutlineInShadow { |
| * @param {boolean} hidden |
| */ |
| toggleOriginsList(hidden) { |
| + this._originsAreHidden = hidden; |
| for (var key in Security.SecurityPanelSidebarTree.OriginGroupName) { |
| var originGroupName = Security.SecurityPanelSidebarTree.OriginGroupName[key]; |
| var group = this._originGroups.get(originGroupName); |
| @@ -481,7 +493,7 @@ Security.SecurityPanelSidebarTree = class extends TreeOutlineInShadow { |
| oldParent.hidden = true; |
| } |
| newParent.appendChild(originElement); |
| - newParent.hidden = false; |
| + newParent.hidden = this._originsAreHidden; |
|
estark
2016/11/21 22:42:06
This is the drive-by bug fix I mentioned in the CL
|
| } |
| } |
| @@ -638,8 +650,9 @@ Security.SecurityMainView = class extends UI.VBox { |
| * @param {!Array<!Protocol.Security.SecurityStateExplanation>} explanations |
| * @param {?Protocol.Security.InsecureContentStatus} insecureContentStatus |
| * @param {boolean} schemeIsCryptographic |
| + * @param {boolean} interstitialIsShowing |
| */ |
| - updateSecurityState(newSecurityState, explanations, insecureContentStatus, schemeIsCryptographic) { |
| + updateSecurityState(newSecurityState, explanations, insecureContentStatus, schemeIsCryptographic, interstitialIsShowing) { |
| // Remove old state. |
| // It's safe to call this even when this._securityState is undefined. |
| this._summarySection.classList.remove('security-summary-' + this._securityState); |
| @@ -662,6 +675,12 @@ Security.SecurityMainView = class extends UI.VBox { |
| this._panel.setDisplayedInsecureContentStyle(insecureContentStatus.displayedInsecureContentStyle); |
| this.refreshExplanations(); |
| + |
| + // If an interstitial is showing, show the Overview view and hide the origins list. |
| + if (interstitialIsShowing) |
| + this._panel.onInterstitialShown(); |
| + else |
| + this._panel.onInterstitialHidden(); |
| } |
| refreshExplanations() { |