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

Unified Diff: components/payments/payment_request.h

Issue 2621033003: [Payments] Currency formatter for order amounts. (Closed)
Patch Set: checked_cast 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/currency_formatter_unittest.cc ('k') | components/payments/payment_request.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/payments/payment_request.h
diff --git a/components/payments/payment_request.h b/components/payments/payment_request.h
index cbd0e246ab9d79a501faffb3ef718c34844a093b..1a5f087d2855a88b79855e15e4610909842f788d 100644
--- a/components/payments/payment_request.h
+++ b/components/payments/payment_request.h
@@ -7,6 +7,8 @@
#include <memory>
+#include "base/optional.h"
+#include "components/payments/currency_formatter.h"
#include "components/payments/payment_request.mojom.h"
#include "mojo/public/cpp/bindings/binding.h"
@@ -41,6 +43,16 @@ class PaymentRequest : payments::mojom::PaymentRequest {
void Cancel();
void OnError();
+
+ // Returns the CurrencyFormatter instance for this PaymentRequest.
+ // |locale_name| should be the result of the browser's GetApplicationLocale().
+ // Note: Having multiple currencies per PaymentRequest is not supported; hence
+ // the CurrencyFormatter is cached here.
+ CurrencyFormatter* GetOrCreateCurrencyFormatter(
+ const std::string& currency_code,
+ const base::Optional<std::string> currency_system,
+ const std::string& locale_name);
+
payments::mojom::PaymentDetails* details() { return details_.get(); }
content::WebContents* web_contents() { return web_contents_; }
@@ -53,6 +65,7 @@ class PaymentRequest : payments::mojom::PaymentRequest {
mojo::Binding<payments::mojom::PaymentRequest> binding_;
payments::mojom::PaymentRequestClientPtr client_;
payments::mojom::PaymentDetailsPtr details_;
+ std::unique_ptr<CurrencyFormatter> currency_formatter_;
DISALLOW_COPY_AND_ASSIGN(PaymentRequest);
};
« no previous file with comments | « components/payments/currency_formatter_unittest.cc ('k') | components/payments/payment_request.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698