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

Unified Diff: chrome/browser/payments/ssl_validity_checker.cc

Issue 2815763002: Prevent usage of web payments API over insecure HTTPS. (Closed)
Patch Set: Fix typo Created 3 years, 8 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
Index: chrome/browser/payments/ssl_validity_checker.cc
diff --git a/chrome/browser/payments/ssl_validity_checker.cc b/chrome/browser/payments/ssl_validity_checker.cc
new file mode 100644
index 0000000000000000000000000000000000000000..0edd4e8feed4bff031b4d22988ab6ce5d0681cc0
--- /dev/null
+++ b/chrome/browser/payments/ssl_validity_checker.cc
@@ -0,0 +1,29 @@
+// Copyright 2017 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 "chrome/browser/payments/ssl_validity_checker.h"
+
+#include "base/logging.h"
+#include "chrome/browser/ssl/security_state_tab_helper.h"
+#include "components/security_state/core/security_state.h"
+
+namespace payments {
+
+// static
+bool SslValidityChecker::IsSslCertificateValid(
+ content::WebContents* web_contents) {
+ DCHECK(web_contents);
+ SecurityStateTabHelper::CreateForWebContents(web_contents);
+ SecurityStateTabHelper* helper =
+ SecurityStateTabHelper::FromWebContents(web_contents);
+ DCHECK(helper);
+ security_state::SecurityInfo security_info;
+ helper->GetSecurityInfo(&security_info);
+ return security_info.security_level == security_state::EV_SECURE ||
+ security_info.security_level == security_state::SECURE ||
+ security_info.security_level ==
+ security_state::SECURE_WITH_POLICY_INSTALLED_CERT;
+}
+
+} // namespace payments

Powered by Google App Engine
This is Rietveld 408576698