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

Unified Diff: content/browser/ssl/ssl_policy.cc

Issue 1259253009: Revert of Attach a SecurityStyle to each request in ResourceLoader (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/ssl/ssl_policy.h ('k') | content/common/ssl_status_serialization.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « content/browser/ssl/ssl_policy.h ('k') | content/common/ssl_status_serialization.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698