Chromium Code Reviews| Index: chrome/browser/payments/android/component_jni_registrar.cc |
| diff --git a/chrome/browser/payments/android/component_jni_registrar.cc b/chrome/browser/payments/android/component_jni_registrar.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..494fd43915ff3124dadaab379d60aa928949f9b8 |
| --- /dev/null |
| +++ b/chrome/browser/payments/android/component_jni_registrar.cc |
| @@ -0,0 +1,34 @@ |
| +// 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 "components/payments/payment_details_validation.h" |
| +#include "components/payments/payment_request.mojom.h" |
| +#include "jni/PaymentValidator_jni.h" |
| + |
| +namespace payments { |
|
please use gerrit instead
2016/10/27 17:14:25
Anonymous namespace should provide better encapsul
Kevin Bailey
2016/10/27 22:17:53
JNI picked this namespace. The functions need to b
|
| + |
| +jlong Init(JNIEnv* env, const base::android::JavaParamRef<jclass>& jcaller) { |
| + return (jlong)0; |
| +} |
| + |
| +jboolean ValidatePaymentDetails( |
| + JNIEnv* env, |
| + const base::android::JavaParamRef<jclass>& jcaller, |
| + const base::android::JavaParamRef<jobject>& buffer) { |
| + jbyte* buf_in = static_cast<jbyte*>(env->GetDirectBufferAddress(buffer)); |
| + jlong buf_size = env->GetDirectBufferCapacity(buffer); |
| + mojo::Array<uint8_t> mojo_buffer = mojo::Array<uint8_t>::New(buf_size); |
| + memcpy(&mojo_buffer[0], buf_in, buf_size); |
| + blink::mojom::PaymentDetailsPtr details; |
| + if (!blink::mojom::PaymentDetails::Deserialize(std::move(mojo_buffer), |
| + &details)) |
| + return false; |
| + return payments::validatePaymentDetails(details); |
| +} |
| + |
| +} // namespace payments |
| + |
| +bool RegisterPaymentValidator(JNIEnv* env) { |
| + return payments::RegisterNativesImpl(env); |
|
please use gerrit instead
2016/10/27 17:14:25
Where is this payments::RegisterNativesImpl() defi
Kevin Bailey
2016/10/27 22:17:53
With the latest changes, it's here:
out/*/gen/com
|
| +} |