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

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

Issue 2629883004: [Payment Request] Update the CurrencyStringFormatter to call the native impl. (Closed)
Patch Set: 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
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_

Powered by Google App Engine
This is Rietveld 408576698