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

Unified Diff: components/payments/content/android/origin_security_checker_android.cc

Issue 2815763002: Prevent usage of web payments API over insecure HTTPS. (Closed)
Patch Set: Ganggui's comment. 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: components/payments/content/android/origin_security_checker_android.cc
diff --git a/components/payments/content/android/origin_security_checker_android.cc b/components/payments/content/android/origin_security_checker_android.cc
new file mode 100644
index 0000000000000000000000000000000000000000..574859b3a51b0a84f19f57eabb22304bd4d55366
--- /dev/null
+++ b/components/payments/content/android/origin_security_checker_android.cc
@@ -0,0 +1,41 @@
+// 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 "components/payments/content/android/origin_security_checker_android.h"
+
+#include "base/android/jni_string.h"
+#include "base/android/scoped_java_ref.h"
+#include "components/payments/content/origin_security_checker.h"
+#include "content/public/browser/web_contents.h"
+#include "jni/OriginSecurityChecker_jni.h"
+
+namespace payments {
+namespace {
+
+using ::base::android::JavaParamRef;
+using ::base::android::ConvertJavaStringToUTF8;
+
+} // namespace
+
+// static
+jboolean IsOriginSecure(JNIEnv* env,
+ const JavaParamRef<jclass>& jcaller,
+ const JavaParamRef<jstring>& jurl) {
+ return OriginSecurityChecker::IsOriginSecure(
+ GURL(ConvertJavaStringToUTF8(env, jurl)));
+}
+
+// static
+jboolean IsSchemeCryptographic(JNIEnv* env,
+ const JavaParamRef<jclass>& jcaller,
+ const JavaParamRef<jstring>& jurl) {
+ return OriginSecurityChecker::IsSchemeCryptographic(
+ GURL(ConvertJavaStringToUTF8(env, jurl)));
+}
+
+bool RegisterOriginSecurityChecker(JNIEnv* env) {
+ return RegisterNativesImpl(env);
+}
+
+} // namespace payments

Powered by Google App Engine
This is Rietveld 408576698