Index: components/payments/content/android/component_jni_registrar.cc |
diff --git a/components/payments/content/android/currency_formatter_android.h b/components/payments/content/android/component_jni_registrar.cc |
similarity index 12% |
copy from components/payments/content/android/currency_formatter_android.h |
copy to components/payments/content/android/component_jni_registrar.cc |
index 9693c200b83a989119069e818c1f53c7cd81d21d..4dbb97d630cfd3e4dabefd4817c674beb7a58787 100644 |
--- a/components/payments/content/android/currency_formatter_android.h |
+++ b/components/payments/content/android/component_jni_registrar.cc |
@@ -2,52 +2,32 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#ifndef COMPONENTS_PAYMENTS_CONTENT_ANDROID_CURRENCY_FORMATTER_ANDROID_H_ |
-#define COMPONENTS_PAYMENTS_CONTENT_ANDROID_CURRENCY_FORMATTER_ANDROID_H_ |
+#include "components/payments/content/android/component_jni_registrar.h" |
-#include <jni.h> |
-#include <memory> |
- |
-#include "base/android/scoped_java_ref.h" |
+#include "base/android/jni_android.h" |
+#include "base/android/jni_registrar.h" |
#include "base/macros.h" |
+#include "components/payments/content/android/currency_formatter_android.h" |
+#include "components/payments/content/android/journey_logger_android.h" |
+#include "components/payments/content/android/payment_details_validation_android.h" |
+#include "components/payments/content/android/payment_manifest_downloader_android.h" |
+#include "components/payments/content/android/payment_manifest_parser_android.h" |
namespace payments { |
- |
-class CurrencyFormatter; |
- |
-// Forwarding calls to payments::CurrencyFormatter. |
-class CurrencyFormatterAndroid { |
- public: |
- CurrencyFormatterAndroid( |
- JNIEnv* env, |
- jobject unused_obj, |
- const base::android::JavaParamRef<jstring>& currency_code, |
- const base::android::JavaParamRef<jstring>& currency_system, |
- const base::android::JavaParamRef<jstring>& locale_name); |
- ~CurrencyFormatterAndroid(); |
- |
- // Message from Java to destroy this object. |
- void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); |
- |
- // Refer to CurrencyFormatter::Format documentation. |
- base::android::ScopedJavaLocalRef<jstring> Format( |
- JNIEnv* env, |
- const base::android::JavaParamRef<jobject>& unused_obj, |
- const base::android::JavaParamRef<jstring>& amount); |
- |
- base::android::ScopedJavaLocalRef<jstring> GetFormattedCurrencyCode( |
- JNIEnv* env, |
- const base::android::JavaParamRef<jobject>& unused_obj); |
- |
- // Registers the JNI bindings for this class. |
- static bool Register(JNIEnv* env); |
- |
- private: |
- std::unique_ptr<CurrencyFormatter> currency_formatter_; |
- |
- DISALLOW_COPY_AND_ASSIGN(CurrencyFormatterAndroid); |
+namespace android { |
+ |
+static base::android::RegistrationMethod kPaymentsRegisteredMethods[] = { |
+ {"CurrencyFormatter", CurrencyFormatterAndroid::Register}, |
+ {"JourneyLogger", JourneyLoggerAndroid::Register}, |
+ {"PaymentManifestDownloader", RegisterPaymentManifestDownloader}, |
+ {"PaymentManifestParser", RegisterPaymentManifestParser}, |
+ {"PaymentValidator", RegisterPaymentValidator}, |
}; |
-} // namespace payments |
+bool RegisterPayments(JNIEnv* env) { |
+ return base::android::RegisterNativeMethods( |
+ env, kPaymentsRegisteredMethods, arraysize(kPaymentsRegisteredMethods)); |
+} |
-#endif // COMPONENTS_PAYMENTS_CONTENT_ANDROID_CURRENCY_FORMATTER_ANDROID_H_ |
+} // namespace android |
+} // namespace payments |