Chromium Code Reviews| 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 "chrome/browser/payments/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" |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/memory/ptr_util.h" | 13 #include "base/memory/ptr_util.h" |
| 14 #include "base/numerics/safe_conversions.h" | 14 #include "base/numerics/safe_conversions.h" |
| 15 #include "chrome/browser/payments/android/payment_manifest_web_data_service_andr oid.h" | |
| 15 #include "jni/PaymentManifestParser_jni.h" | 16 #include "jni/PaymentManifestParser_jni.h" |
| 16 #include "url/gurl.h" | 17 #include "url/gurl.h" |
| 17 | 18 |
| 18 namespace payments { | 19 namespace payments { |
| 19 namespace { | 20 namespace { |
| 20 | 21 |
| 21 class ParseCallback { | 22 class ParseCallback { |
| 22 public: | 23 public: |
| 23 explicit ParseCallback(const base::android::JavaParamRef<jobject>& jcallback) | 24 explicit ParseCallback(const base::android::JavaParamRef<jobject>& jcallback) |
| 24 : jcallback_(jcallback) {} | 25 : jcallback_(jcallback) {} |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 83 Java_PaymentManifestParser_addFingerprintToSection( | 84 Java_PaymentManifestParser_addFingerprintToSection( |
| 84 env, jmanifest.obj(), base::checked_cast<int>(i), | 85 env, jmanifest.obj(), base::checked_cast<int>(i), |
| 85 base::checked_cast<int>(j), | 86 base::checked_cast<int>(j), |
| 86 base::android::ToJavaByteArray(env, fingerprint)); | 87 base::android::ToJavaByteArray(env, fingerprint)); |
| 87 } | 88 } |
| 88 } | 89 } |
| 89 | 90 |
| 90 // Can trigger synchronous deletion of PaymentManifestParserAndroid. | 91 // Can trigger synchronous deletion of PaymentManifestParserAndroid. |
| 91 Java_ManifestParseCallback_onWebAppManifestParseSuccess(env, jcallback_, | 92 Java_ManifestParseCallback_onWebAppManifestParseSuccess(env, jcallback_, |
| 92 jmanifest.obj()); | 93 jmanifest.obj()); |
| 94 | |
| 95 // Cache parsed web app manifest. | |
| 96 PaymentManifestWebDataServiceAndroid::AddPaymentWebAppManifest(manifest); | |
|
please use gerrit instead
2017/04/24 18:22:31
Please cache the manifests from PaymentMethodVerif
gogerald1
2017/04/26 13:46:32
Done.
| |
| 93 } | 97 } |
| 94 | 98 |
| 95 private: | 99 private: |
| 96 base::android::ScopedJavaGlobalRef<jobject> jcallback_; | 100 base::android::ScopedJavaGlobalRef<jobject> jcallback_; |
| 97 | 101 |
| 98 DISALLOW_COPY_AND_ASSIGN(ParseCallback); | 102 DISALLOW_COPY_AND_ASSIGN(ParseCallback); |
| 99 }; | 103 }; |
| 100 | 104 |
| 101 } // namespace | 105 } // namespace |
| 102 | 106 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 143 } | 147 } |
| 144 | 148 |
| 145 // Caller owns the result. | 149 // Caller owns the result. |
| 146 jlong CreatePaymentManifestParserAndroid( | 150 jlong CreatePaymentManifestParserAndroid( |
| 147 JNIEnv* env, | 151 JNIEnv* env, |
| 148 const base::android::JavaParamRef<jclass>& jcaller) { | 152 const base::android::JavaParamRef<jclass>& jcaller) { |
| 149 return reinterpret_cast<jlong>(new PaymentManifestParserAndroid); | 153 return reinterpret_cast<jlong>(new PaymentManifestParserAndroid); |
| 150 } | 154 } |
| 151 | 155 |
| 152 } // namespace payments | 156 } // namespace payments |
| OLD | NEW |