Index: components/payments/android/currency_formatter_android.h |
diff --git a/components/payments/android/currency_formatter_android.h b/components/payments/android/currency_formatter_android.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..4743bd705ad412b54af60b0e921a67fee0889d2f |
--- /dev/null |
+++ b/components/payments/android/currency_formatter_android.h |
@@ -0,0 +1,45 @@ |
+// Copyright 2017 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef COMPONENTS_PAYMENTS_ANDROID_CURRENCY_FORMATTER_ANDROID_H_ |
+#define COMPONENTS_PAYMENTS_ANDROID_CURRENCY_FORMATTER_ANDROID_H_ |
+ |
+#include <memory> |
+ |
+#include "base/android/scoped_java_ref.h" |
+#include "base/macros.h" |
+#include "components/payments/currency_formatter.h" |
+ |
+using base::android::JavaParamRef; |
please use gerrit instead
2017/01/13 21:16:25
"using" should not be in header files, as a rule o
Mathieu
2017/01/13 22:27:01
Done.
|
+ |
+namespace payments { |
+ |
+// Forwarding calls to payments::CurrencyFormatter. |
+class CurrencyFormatterAndroid { |
+ public: |
+ CurrencyFormatterAndroid(JNIEnv* env, |
+ jobject unused_obj, |
+ const JavaParamRef<jstring>& currency_code, |
+ const JavaParamRef<jstring>& currency_system, |
+ const JavaParamRef<jstring>& locale_name); |
+ ~CurrencyFormatterAndroid(); |
+ |
+ // Refer to CurrencyFormatter::Format documentation. |
+ base::android::ScopedJavaLocalRef<jstring> Format( |
+ JNIEnv* env, |
+ const JavaParamRef<jobject>& unused_obj, |
+ const JavaParamRef<jstring>& amount); |
+ |
+ // 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 payments |
+ |
+#endif // COMPONENTS_PAYMENTS_ANDROID_CURRENCY_FORMATTER_ANDROID_H_ |