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

Side by Side Diff: components/payments/content/android/payment_details_validation_android.cc

Issue 2811593009: [Payments] move //components/payments/content/*.mojom files to //components/payments/mojom (Closed)
Patch Set: Reland after updating chrome_content_browser_client.cc to fix android build 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 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_details_validation_android .h" 5 #include "components/payments/content/android/payment_details_validation_android .h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <cstring> 9 #include <cstring>
10 #include <string> 10 #include <string>
11 #include <utility> 11 #include <utility>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/android/jni_android.h" 14 #include "base/android/jni_android.h"
15 #include "components/payments/content/payment_details_validation.h" 15 #include "components/payments/content/payment_details_validation.h"
16 #include "components/payments/content/payment_request.mojom.h" 16 #include "components/payments/mojom/payment_request.mojom.h"
17 #include "jni/PaymentValidator_jni.h" 17 #include "jni/PaymentValidator_jni.h"
18 18
19 namespace payments { 19 namespace payments {
20 20
21 jboolean ValidatePaymentDetails( 21 jboolean ValidatePaymentDetails(
22 JNIEnv* env, 22 JNIEnv* env,
23 const base::android::JavaParamRef<jclass>& jcaller, 23 const base::android::JavaParamRef<jclass>& jcaller,
24 const base::android::JavaParamRef<jobject>& buffer) { 24 const base::android::JavaParamRef<jobject>& buffer) {
25 jbyte* buf_in = static_cast<jbyte*>(env->GetDirectBufferAddress(buffer)); 25 jbyte* buf_in = static_cast<jbyte*>(env->GetDirectBufferAddress(buffer));
26 jlong buf_size = env->GetDirectBufferCapacity(buffer); 26 jlong buf_size = env->GetDirectBufferCapacity(buffer);
27 std::vector<uint8_t> mojo_buffer(buf_size); 27 std::vector<uint8_t> mojo_buffer(buf_size);
28 memcpy(&mojo_buffer[0], buf_in, buf_size); 28 memcpy(&mojo_buffer[0], buf_in, buf_size);
29 mojom::PaymentDetailsPtr details; 29 mojom::PaymentDetailsPtr details;
30 if (!mojom::PaymentDetails::Deserialize(std::move(mojo_buffer), &details)) 30 if (!mojom::PaymentDetails::Deserialize(std::move(mojo_buffer), &details))
31 return false; 31 return false;
32 std::string unused_error_message; 32 std::string unused_error_message;
33 return validatePaymentDetails(details, &unused_error_message); 33 return validatePaymentDetails(details, &unused_error_message);
34 } 34 }
35 35
36 bool RegisterPaymentValidator(JNIEnv* env) { 36 bool RegisterPaymentValidator(JNIEnv* env) {
37 return RegisterNativesImpl(env); 37 return RegisterNativesImpl(env);
38 } 38 }
39 39
40 } // namespace payments 40 } // namespace payments
OLDNEW
« no previous file with comments | « components/payments/content/android/BUILD.gn ('k') | components/payments/content/payment_app.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698