WebInspector.SecurityModel=function(target)
{WebInspector.SDKModel.call(this,WebInspector.SecurityModel,target);this._dispatcher=new WebInspector.SecurityDispatcher(this);this._securityAgent=target.securityAgent();target.registerSecurityDispatcher(this._dispatcher);this._securityAgent.enable();this._securityState=SecurityAgent.SecurityState.Unknown;}
WebInspector.SecurityModel.EventTypes={SecurityStateChanged:"SecurityStateChanged"}
WebInspector.SecurityModel.prototype={securityState:function()
{return(this._securityState);},__proto__:WebInspector.SDKModel.prototype}
WebInspector.SecurityModel.fromTarget=function(target)
{var model=(target.model(WebInspector.SecurityModel));if(!model)
model=new WebInspector.SecurityModel(target);return model;}
WebInspector.SecurityDispatcher=function(model)
{this._model=model;}
WebInspector.SecurityDispatcher.prototype={securityStateChanged:function(securityState,explanations)
{var data={"securityState":securityState,"explanations":explanations||[]};this._model.dispatchEventToListeners(WebInspector.SecurityModel.EventTypes.SecurityStateChanged,data);}};WebInspector.SecurityPanel=function(){WebInspector.PanelWithSidebar.call(this,"security");this.registerRequiredCSS("security/securityPanel.css");this.registerRequiredCSS("security/lockIcon.css");var sidebarTree=new TreeOutlineInShadow();sidebarTree.element.classList.add("sidebar-tree");this.panelSidebarElement().appendChild(sidebarTree.element);sidebarTree.registerRequiredCSS("security/lockIcon.css");this.setDefaultFocusedElement(sidebarTree.element);this._sidebarMainViewElement=new WebInspector.SecurityMainViewSidebarTreeElement(this);sidebarTree.appendChild(this._sidebarMainViewElement);this._mainView=new WebInspector.SecurityMainView();this.showMainView();WebInspector.targetManager.observeTargets(this);}
WebInspector.SecurityPanel.prototype={_updateSecurityState:function(newSecurityState,explanations)
{this._sidebarMainViewElement.setSecurityState(newSecurityState);this._mainView.updateSecurityState(newSecurityState,explanations);},_onSecurityStateChanged:function(event)
{var securityState=(event.data.securityState);var explanations=(event.data.explanations);this._updateSecurityState(securityState,explanations);},showMainView:function()
{this._setVisibleView(this._mainView);},_setVisibleView:function(view)
{if(this._visibleView===view)
return;if(this._visibleView)
this._visibleView.detach();this._visibleView=view;if(view)
this.splitWidget().setMainWidget(view);},targetAdded:function(target)
{if(!this._target){this._target=target;this._securityModel=WebInspector.SecurityModel.fromTarget(target);this._securityModel.addEventListener(WebInspector.SecurityModel.EventTypes.SecurityStateChanged,this._onSecurityStateChanged,this);this._updateSecurityState(this._securityModel.securityState(),[]);}},targetRemoved:function(target)
{if(target===this._target){this._securityModel.removeEventListener(WebInspector.SecurityModel.EventTypes.SecurityStateChanged,this._onSecurityStateChanged,this);delete this._securityModel;delete this._target;this._updateSecurityState(SecurityAgent.SecurityState.Unknown,[]);}},__proto__:WebInspector.PanelWithSidebar.prototype}
WebInspector.SecurityPanel._instance=function()
{if(!WebInspector.SecurityPanel._instanceObject)
WebInspector.SecurityPanel._instanceObject=new WebInspector.SecurityPanel();return WebInspector.SecurityPanel._instanceObject;}
WebInspector.SecurityMainViewSidebarTreeElement=function(panel)
{this._panel=panel;this.small=true;WebInspector.SidebarTreeElement.call(this,"security-sidebar-tree-item",WebInspector.UIString("Overview"));this.iconElement.classList.add("lock-icon");}
WebInspector.SecurityMainViewSidebarTreeElement.prototype={onattach:function()
{WebInspector.SidebarTreeElement.prototype.onattach.call(this);},setSecurityState:function(newSecurityState)
{for(var className of this.iconElement.classList)
if(className.indexOf("lock-icon-")===0)
this.iconElement.classList.remove(className);this.iconElement.classList.add("lock-icon-"+newSecurityState);},onselect:function()
{this._panel.showMainView();return true;},__proto__:WebInspector.SidebarTreeElement.prototype}
WebInspector.SecurityPanelFactory=function()
{}
WebInspector.SecurityPanelFactory.prototype={createPanel:function()
{return WebInspector.SecurityPanel._instance();}}
WebInspector.SecurityMainView=function()
{WebInspector.VBox.call(this);this.setMinimumSize(100,100);this.element.classList.add("security-main-view");var securityStateSection=this.element.createChild("div");this._lockIcon=securityStateSection.createChild("div","lock-icon");this._securityStateText=securityStateSection.createChild("div","security-state");securityStateSection.createChild("hr");this._securityExplanations=securityStateSection.createChild("div","security-explanations");}
WebInspector.SecurityMainView.prototype={_addExplanation:function(explanation)
{var explanationDiv=this._securityExplanations.createChild("div","security-explanation");var explanationLockIcon=explanationDiv.createChild("div","lock-icon");explanationLockIcon.classList.add("lock-icon-"+explanation.securityState);explanationDiv.createChild("div","explanation-title").textContent=explanation.summary;explanationDiv.createChild("div","explanation-text").textContent=explanation.description;},updateSecurityState:function(newSecurityState,explanations)
{this._lockIcon.classList.remove("lock-icon-"+this._securityState);this._securityState=newSecurityState;this._lockIcon.classList.add("lock-icon-"+this._securityState);this._securityStateText.textContent=WebInspector.UIString("Page security state: %s",this._securityState);this._securityExplanations.removeChildren();for(var explanation of explanations)
this._addExplanation(explanation);},__proto__:WebInspector.VBox.prototype};Runtime.cachedResources["security/lockIcon.css"]="/* Copyright (c) 2015 The Chromium Authors. All rights reserved.\n * Use of this source code is governed by a BSD-style license that can be\n * found in the LICENSE file.\n */\n\n.lock-icon {\n    background-size: cover;\n    height: 16px;\n    width: 16px;\n}\n\n.lock-icon-unknown {\n    background-image: url(Images/securityStateHttp.png);\n}\n\n.lock-icon-http {\n    background-image: url(Images/securityStateHttp.png);\n}\n\n.lock-icon-insecure {\n    background-image: url(Images/securityStateInsecure.png);\n}\n\n.lock-icon-warning {\n    background-image: url(Images/securityStateWarning.png);\n}\n\n.lock-icon-secure {\n    background-image: url(Images/securityStateSecure.png);\n}\n\n\n@media (-webkit-min-device-pixel-ratio: 1.5) {\n    .lock-icon-unknown {\n        background-image: url(Images/securityStateHttp_2x.png);\n    }\n\n    .lock-icon-http {\n        background-image: url(Images/securityStateHttp_2x.png);\n    }\n\n    .lock-icon-insecure {\n        background-image: url(Images/securityStateInsecure_2x.png);\n    }\n\n    .lock-icon-warning {\n        background-image: url(Images/securityStateWarning_2x.png);\n    }\n\n    .lock-icon-secure {\n        background-image: url(Images/securityStateSecure_2x.png);\n    }\n}\n\n.sidebar-tree-item .lock-icon {\n    float: left;\n    margin-right: 2px;\n}\n/*# sourceURL=security/lockIcon.css */";Runtime.cachedResources["security/securityPanel.css"]="/* Copyright (c) 2015 The Chromium Authors. All rights reserved.\n * Use of this source code is governed by a BSD-style license that can be\n * found in the LICENSE file.\n */\n\n.security-main-view {\n    -webkit-user-select: text;\n    margin: 1em;\n}\n\n.security-main-view .lock-icon {\n    display: inline-block;\n    margin: 0.2em;\n    vertical-align: middle;\n}\n\n.security-main-view .security-state {\n    display: inline-block;\n    font-size: 1.2em;\n    font-weight: bold;\n    margin: 0.2em;\n    vertical-align: middle;\n}\n\n.security-explanation {\n    margin: 16px 0px;\n}\n\n.security-explanation .lock-icon {\n    display: inline-block;\n    vertical-align: bottom;\n}\n\n.security-explanation .explanation-title {\n    display: inline-block;\n    font-size: 1.2em;\n    font-weight: bold;\n    margin-left: 4px;\n}\n\n.security-explanation .explanation-text {\n    margin: 4px 0px;\n}\n/*# sourceURL=security/securityPanel.css */";