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

Side by Side Diff: components/payments/currency_formatter.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 unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COMPONENTS_PAYMENTS_CURRENCY_FORMATTER_H_ 5 #ifndef COMPONENTS_PAYMENTS_CURRENCY_FORMATTER_H_
6 #define COMPONENTS_PAYMENTS_CURRENCY_FORMATTER_H_ 6 #define COMPONENTS_PAYMENTS_CURRENCY_FORMATTER_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
(...skipping 23 matching lines...) Expand all
34 ~CurrencyFormatter(); 34 ~CurrencyFormatter();
35 35
36 // Formats the |amount| according to the currency code that was set. The 36 // Formats the |amount| according to the currency code that was set. The
37 // result will NOT contain the currency code, nor a subset of it. Rather, the 37 // result will NOT contain the currency code, nor a subset of it. Rather, the
38 // caller of this function should display the currency code separately. The 38 // caller of this function should display the currency code separately. The
39 // return value may contain non-breaking space and is ready for display. In 39 // return value may contain non-breaking space and is ready for display. In
40 // the case of a failure in initialization of the formatter or during 40 // the case of a failure in initialization of the formatter or during
41 // formatter, this method will return |amount|. 41 // formatter, this method will return |amount|.
42 base::string16 Format(const std::string& amount); 42 base::string16 Format(const std::string& amount);
43 43
44 // Returns the formatted currency code (<= 6 characters including ellipsis if
45 // applicable).
46 std::string formatted_currency_code() { return formatted_currency_code_; }
47
44 private: 48 private:
45 const icu::Locale locale_; 49 const icu::Locale locale_;
46 std::unique_ptr<icu::UnicodeString> currency_code_; 50 std::unique_ptr<icu::UnicodeString> currency_code_;
51 std::string formatted_currency_code_;
47 std::unique_ptr<icu::NumberFormat> icu_formatter_; 52 std::unique_ptr<icu::NumberFormat> icu_formatter_;
48 53
49 DISALLOW_COPY_AND_ASSIGN(CurrencyFormatter); 54 DISALLOW_COPY_AND_ASSIGN(CurrencyFormatter);
50 }; 55 };
51 56
52 } // namespace payments 57 } // namespace payments
53 58
54 #endif // COMPONENTS_PAYMENTS_CURRENCY_FORMATTER_H_ 59 #endif // COMPONENTS_PAYMENTS_CURRENCY_FORMATTER_H_
OLDNEW
« no previous file with comments | « components/payments/android/currency_formatter_android.cc ('k') | components/payments/currency_formatter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698