OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef COMPONENTS_PAYMENTS_ANDROID_CURRENCY_FORMATTER_ANDROID_H_ |
| 6 #define COMPONENTS_PAYMENTS_ANDROID_CURRENCY_FORMATTER_ANDROID_H_ |
| 7 |
| 8 #include <memory> |
| 9 |
| 10 #include "base/android/scoped_java_ref.h" |
| 11 #include "base/macros.h" |
| 12 #include "components/payments/currency_formatter.h" |
| 13 |
| 14 namespace payments { |
| 15 |
| 16 // Forwarding calls to payments::CurrencyFormatter. |
| 17 class CurrencyFormatterAndroid { |
| 18 public: |
| 19 CurrencyFormatterAndroid( |
| 20 JNIEnv* env, |
| 21 jobject unused_obj, |
| 22 const base::android::JavaParamRef<jstring>& currency_code, |
| 23 const base::android::JavaParamRef<jstring>& currency_system, |
| 24 const base::android::JavaParamRef<jstring>& locale_name); |
| 25 ~CurrencyFormatterAndroid(); |
| 26 |
| 27 // Message from Java to destroy this object. |
| 28 void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); |
| 29 |
| 30 // Refer to CurrencyFormatter::Format documentation. |
| 31 base::android::ScopedJavaLocalRef<jstring> Format( |
| 32 JNIEnv* env, |
| 33 const base::android::JavaParamRef<jobject>& unused_obj, |
| 34 const base::android::JavaParamRef<jstring>& amount); |
| 35 |
| 36 base::android::ScopedJavaLocalRef<jstring> GetFormattedCurrencyCode( |
| 37 JNIEnv* env, |
| 38 const base::android::JavaParamRef<jobject>& unused_obj); |
| 39 |
| 40 // Registers the JNI bindings for this class. |
| 41 static bool Register(JNIEnv* env); |
| 42 |
| 43 private: |
| 44 std::unique_ptr<CurrencyFormatter> currency_formatter_; |
| 45 |
| 46 DISALLOW_COPY_AND_ASSIGN(CurrencyFormatterAndroid); |
| 47 }; |
| 48 |
| 49 } // namespace payments |
| 50 |
| 51 #endif // COMPONENTS_PAYMENTS_ANDROID_CURRENCY_FORMATTER_ANDROID_H_ |
OLD | NEW |