| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/payments/content/android/payment_manifest_parser_android.h" | 5 #include "components/payments/content/android/payment_manifest_parser_android.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/android/jni_array.h" | 9 #include "base/android/jni_array.h" |
| 10 #include "base/android/jni_string.h" | 10 #include "base/android/jni_string.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 // Can trigger synchronous deletion of PaymentManifestParserAndroid. | 34 // Can trigger synchronous deletion of PaymentManifestParserAndroid. |
| 35 Java_ManifestParseCallback_onManifestParseFailure(env, jcallback_); | 35 Java_ManifestParseCallback_onManifestParseFailure(env, jcallback_); |
| 36 return; | 36 return; |
| 37 } | 37 } |
| 38 | 38 |
| 39 base::android::ScopedJavaLocalRef<jobjectArray> juris = | 39 base::android::ScopedJavaLocalRef<jobjectArray> juris = |
| 40 Java_PaymentManifestParser_createWebAppManifestUris( | 40 Java_PaymentManifestParser_createWebAppManifestUris( |
| 41 env, web_app_manifest_urls.size()); | 41 env, web_app_manifest_urls.size()); |
| 42 | 42 |
| 43 for (size_t i = 0; i < web_app_manifest_urls.size(); ++i) { | 43 for (size_t i = 0; i < web_app_manifest_urls.size(); ++i) { |
| 44 DCHECK(Java_PaymentManifestParser_addUri( | 44 bool is_valid_uri = Java_PaymentManifestParser_addUri( |
| 45 env, juris.obj(), base::checked_cast<int>(i), | 45 env, juris.obj(), base::checked_cast<int>(i), |
| 46 base::android::ConvertUTF8ToJavaString( | 46 base::android::ConvertUTF8ToJavaString( |
| 47 env, web_app_manifest_urls[i].spec()))); | 47 env, web_app_manifest_urls[i].spec())); |
| 48 DCHECK(is_valid_uri); |
| 48 } | 49 } |
| 49 | 50 |
| 50 // Can trigger synchronous deletion of PaymentManifestParserAndroid. | 51 // Can trigger synchronous deletion of PaymentManifestParserAndroid. |
| 51 Java_ManifestParseCallback_onPaymentMethodManifestParseSuccess( | 52 Java_ManifestParseCallback_onPaymentMethodManifestParseSuccess( |
| 52 env, jcallback_, juris.obj()); | 53 env, jcallback_, juris.obj()); |
| 53 } | 54 } |
| 54 | 55 |
| 55 // Copies web app manifest into Java. | 56 // Copies web app manifest into Java. |
| 56 void OnWebAppManifestParsed( | 57 void OnWebAppManifestParsed( |
| 57 std::vector<mojom::WebAppManifestSectionPtr> manifest) { | 58 std::vector<mojom::WebAppManifestSectionPtr> manifest) { |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 } | 143 } |
| 143 | 144 |
| 144 // Caller owns the result. | 145 // Caller owns the result. |
| 145 jlong CreatePaymentManifestParserAndroid( | 146 jlong CreatePaymentManifestParserAndroid( |
| 146 JNIEnv* env, | 147 JNIEnv* env, |
| 147 const base::android::JavaParamRef<jclass>& jcaller) { | 148 const base::android::JavaParamRef<jclass>& jcaller) { |
| 148 return reinterpret_cast<jlong>(new PaymentManifestParserAndroid); | 149 return reinterpret_cast<jlong>(new PaymentManifestParserAndroid); |
| 149 } | 150 } |
| 150 | 151 |
| 151 } // namespace payments | 152 } // namespace payments |
| OLD | NEW |