| Index: content/browser/ssl/ssl_policy.cc
|
| diff --git a/content/browser/ssl/ssl_policy.cc b/content/browser/ssl/ssl_policy.cc
|
| index 88044094fb5f61df5082f43e39f0cb60c0d473e2..f0384442be3fd7052d541a7c80c614e1e12ce5c6 100644
|
| --- a/content/browser/ssl/ssl_policy.cc
|
| +++ b/content/browser/ssl/ssl_policy.cc
|
| @@ -19,12 +19,11 @@
|
| #include "content/browser/ssl/ssl_request_info.h"
|
| #include "content/browser/web_contents/web_contents_impl.h"
|
| #include "content/public/browser/content_browser_client.h"
|
| -#include "content/public/browser/web_contents.h"
|
| #include "content/public/common/resource_type.h"
|
| #include "content/public/common/ssl_status.h"
|
| #include "content/public/common/url_constants.h"
|
| #include "net/ssl/ssl_info.h"
|
| -#include "url/gurl.h"
|
| +
|
|
|
| namespace content {
|
|
|
| @@ -139,22 +138,37 @@
|
| }
|
|
|
| void SSLPolicy::UpdateEntry(NavigationEntryImpl* entry,
|
| - WebContents* web_contents) {
|
| + WebContentsImpl* web_contents) {
|
| DCHECK(entry);
|
|
|
| InitializeEntryIfNeeded(entry);
|
|
|
| - if (entry->GetSSL().security_style == SECURITY_STYLE_UNAUTHENTICATED)
|
| + if (!entry->GetURL().SchemeIsCryptographic())
|
| return;
|
|
|
| if (!web_contents->DisplayedInsecureContent())
|
| entry->GetSSL().content_status &= ~SSLStatus::DISPLAYED_INSECURE_CONTENT;
|
|
|
| + // An HTTPS response may not have a certificate for some reason. When that
|
| + // happens, use the unauthenticated (HTTP) rather than the authentication
|
| + // broken security style so that we can detect this error condition.
|
| + if (!entry->GetSSL().cert_id) {
|
| + entry->GetSSL().security_style = SECURITY_STYLE_UNAUTHENTICATED;
|
| + return;
|
| + }
|
| +
|
| if (web_contents->DisplayedInsecureContent())
|
| entry->GetSSL().content_status |= SSLStatus::DISPLAYED_INSECURE_CONTENT;
|
|
|
| - if (entry->GetSSL().security_style == SECURITY_STYLE_AUTHENTICATION_BROKEN)
|
| - return;
|
| + if (net::IsCertStatusError(entry->GetSSL().cert_status)) {
|
| + // Minor errors don't lower the security style to
|
| + // SECURITY_STYLE_AUTHENTICATION_BROKEN.
|
| + if (!net::IsCertStatusMinorError(entry->GetSSL().cert_status)) {
|
| + entry->GetSSL().security_style =
|
| + SECURITY_STYLE_AUTHENTICATION_BROKEN;
|
| + }
|
| + return;
|
| + }
|
|
|
| SiteInstance* site_instance = entry->site_instance();
|
| // Note that |site_instance| can be NULL here because NavigationEntries don't
|
| @@ -168,25 +182,6 @@
|
| entry->GetSSL().content_status |= SSLStatus::RAN_INSECURE_CONTENT;
|
| return;
|
| }
|
| -}
|
| -
|
| -// Static
|
| -SecurityStyle SSLPolicy::GetSecurityStyleForResource(const GURL& url,
|
| - const SSLStatus& ssl) {
|
| - // An HTTPS response may not have a certificate for some reason. When that
|
| - // happens, use the unauthenticated (HTTP) rather than the authentication
|
| - // broken security style so that we can detect this error condition.
|
| - if (!url.SchemeIsCryptographic() || !ssl.cert_id)
|
| - return SECURITY_STYLE_UNAUTHENTICATED;
|
| -
|
| - // Minor errors don't lower the security style to
|
| - // SECURITY_STYLE_AUTHENTICATION_BROKEN.
|
| - if (net::IsCertStatusError(ssl.cert_status) &&
|
| - !net::IsCertStatusMinorError(ssl.cert_status)) {
|
| - return SECURITY_STYLE_AUTHENTICATION_BROKEN;
|
| - }
|
| -
|
| - return SECURITY_STYLE_AUTHENTICATED;
|
| }
|
|
|
| void SSLPolicy::OnAllowCertificate(scoped_refptr<SSLCertErrorHandler> handler,
|
| @@ -256,8 +251,9 @@
|
| if (entry->GetSSL().security_style != SECURITY_STYLE_UNKNOWN)
|
| return;
|
|
|
| - entry->GetSSL().security_style =
|
| - GetSecurityStyleForResource(entry->GetURL(), entry->GetSSL());
|
| + entry->GetSSL().security_style = entry->GetURL().SchemeIsCryptographic()
|
| + ? SECURITY_STYLE_AUTHENTICATED
|
| + : SECURITY_STYLE_UNAUTHENTICATED;
|
| }
|
|
|
| void SSLPolicy::OriginRanInsecureContent(const std::string& origin, int pid) {
|
|
|