Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "components/payments/payment_details_validation.h" | |
| 6 #include "components/payments/payment_request.mojom.h" | |
| 7 #include "jni/PaymentValidator_jni.h" | |
| 8 | |
| 9 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
| |
| 10 | |
| 11 jlong Init(JNIEnv* env, const base::android::JavaParamRef<jclass>& jcaller) { | |
| 12 return (jlong)0; | |
| 13 } | |
| 14 | |
| 15 jboolean ValidatePaymentDetails( | |
| 16 JNIEnv* env, | |
| 17 const base::android::JavaParamRef<jclass>& jcaller, | |
| 18 const base::android::JavaParamRef<jobject>& buffer) { | |
| 19 jbyte* buf_in = static_cast<jbyte*>(env->GetDirectBufferAddress(buffer)); | |
| 20 jlong buf_size = env->GetDirectBufferCapacity(buffer); | |
| 21 mojo::Array<uint8_t> mojo_buffer = mojo::Array<uint8_t>::New(buf_size); | |
| 22 memcpy(&mojo_buffer[0], buf_in, buf_size); | |
| 23 blink::mojom::PaymentDetailsPtr details; | |
| 24 if (!blink::mojom::PaymentDetails::Deserialize(std::move(mojo_buffer), | |
| 25 &details)) | |
| 26 return false; | |
| 27 return payments::validatePaymentDetails(details); | |
| 28 } | |
| 29 | |
| 30 } // namespace payments | |
| 31 | |
| 32 bool RegisterPaymentValidator(JNIEnv* env) { | |
| 33 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
| |
| 34 } | |
| OLD | NEW |