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

Unified Diff: components/payments/android/currency_formatter_android.h

Issue 2629883004: [Payment Request] Update the CurrencyStringFormatter to call the native impl. (Closed)
Patch Set: CurrencyStringFormatter -> CurrencyFormatter Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/payments/android/BUILD.gn ('k') | components/payments/android/currency_formatter_android.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..f6e6b33e28f9c057edf87a951c947700bd75a6b5
--- /dev/null
+++ b/components/payments/android/currency_formatter_android.h
@@ -0,0 +1,51 @@
+// 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"
+
+namespace payments {
+
+// 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 payments
+
+#endif // COMPONENTS_PAYMENTS_ANDROID_CURRENCY_FORMATTER_ANDROID_H_
« no previous file with comments | « components/payments/android/BUILD.gn ('k') | components/payments/android/currency_formatter_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698