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

Unified Diff: content/common/security_style_util.cc

Issue 2296953004: Send certificates to devtools when it's open instead of using certId (Closed)
Patch Set: self review Created 4 years, 3 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/common/security_style_util.h ('k') | content/public/common/resource_response_info.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/security_style_util.cc
diff --git a/content/common/security_style_util.cc b/content/common/security_style_util.cc
new file mode 100644
index 0000000000000000000000000000000000000000..dcb9eb84fcacaf32fee9c7c0b113f32f65a4fab8
--- /dev/null
+++ b/content/common/security_style_util.cc
@@ -0,0 +1,31 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/common/security_style_util.h"
+
+#include "url/gurl.h"
+
+namespace content {
+
+SecurityStyle GetSecurityStyleForResource(
+ const GURL& url,
+ bool has_certificate,
+ net::CertStatus cert_status) {
+ // 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() || !has_certificate)
+ return SECURITY_STYLE_UNAUTHENTICATED;
+
+ // Minor errors don't lower the security style to
+ // SECURITY_STYLE_AUTHENTICATION_BROKEN.
+ if (net::IsCertStatusError(cert_status) &&
+ !net::IsCertStatusMinorError(cert_status)) {
+ return SECURITY_STYLE_AUTHENTICATION_BROKEN;
+ }
+
+ return SECURITY_STYLE_AUTHENTICATED;
+}
+
+} // namespace content
« no previous file with comments | « content/common/security_style_util.h ('k') | content/public/common/resource_response_info.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698