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 |