Chromium Code Reviews| OLD | NEW |
|---|---|
| 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_CORE_PAYMENT_INSTRUMENT_H_ | 5 #ifndef COMPONENTS_PAYMENTS_CORE_PAYMENT_INSTRUMENT_H_ |
| 6 #define COMPONENTS_PAYMENTS_CORE_PAYMENT_INSTRUMENT_H_ | 6 #define COMPONENTS_PAYMENTS_CORE_PAYMENT_INSTRUMENT_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/strings/string16.h" | |
| 12 | 13 |
| 13 namespace payments { | 14 namespace payments { |
| 14 | 15 |
| 15 // Base class which represents a form of payment in Payment Request. | 16 // Base class which represents a form of payment in Payment Request. |
| 16 class PaymentInstrument { | 17 class PaymentInstrument { |
| 17 public: | 18 public: |
| 18 class Delegate { | 19 class Delegate { |
| 19 public: | 20 public: |
| 20 virtual ~Delegate() {} | 21 virtual ~Delegate() {} |
| 21 | 22 |
| 22 // Should be called with method name (e.g., "visa") and json-serialized | 23 // Should be called with method name (e.g., "visa") and json-serialized |
| 23 // stringified details. | 24 // stringified details. |
| 24 virtual void OnInstrumentDetailsReady( | 25 virtual void OnInstrumentDetailsReady( |
| 25 const std::string& method_name, | 26 const std::string& method_name, |
| 26 const std::string& stringified_details) = 0; | 27 const std::string& stringified_details) = 0; |
| 27 | 28 |
| 28 virtual void OnInstrumentDetailsError() = 0; | 29 virtual void OnInstrumentDetailsError() = 0; |
| 29 }; | 30 }; |
| 30 | 31 |
| 31 virtual ~PaymentInstrument() {} | 32 virtual ~PaymentInstrument(); |
| 32 | 33 |
| 33 // Will call into the |delegate| (can't be null) on success or error. | 34 // Will call into the |delegate| (can't be null) on success or error. |
| 34 virtual void InvokePaymentApp(Delegate* delegate) = 0; | 35 virtual void InvokePaymentApp(Delegate* delegate) = 0; |
| 36 // Returns if the card is valid to be used as a payment method. | |
|
please use gerrit instead
2017/03/16 15:01:24
Add "true" after "Returns". (Or replace "if" with
| |
| 37 virtual bool IsValid() = 0; | |
| 35 | 38 |
| 36 const std::string& method_name() { return method_name_; } | 39 const std::string& method_name() const { return method_name_; } |
| 40 const base::string16& label() const { return label_; } | |
| 41 const base::string16& sublabel() const { return sublabel_; } | |
| 42 int icon_resource_id() { return icon_resource_id_; } | |
|
please use gerrit instead
2017/03/16 15:01:24
const this method as well, please.
| |
| 37 | 43 |
| 38 protected: | 44 protected: |
| 39 explicit PaymentInstrument(const std::string& method_name) | 45 PaymentInstrument(const std::string& method_name, |
| 40 : method_name_(method_name) {} | 46 const base::string16& label, |
| 47 const base::string16& sublabel, | |
| 48 int icon_resource_id); | |
| 41 | 49 |
| 42 private: | 50 private: |
| 43 const std::string method_name_; | 51 const std::string method_name_; |
| 52 const base::string16 label_; | |
| 53 const base::string16 sublabel_; | |
| 54 int icon_resource_id_; | |
| 44 | 55 |
| 45 DISALLOW_COPY_AND_ASSIGN(PaymentInstrument); | 56 DISALLOW_COPY_AND_ASSIGN(PaymentInstrument); |
| 46 }; | 57 }; |
| 47 | 58 |
| 48 } // namespace payments | 59 } // namespace payments |
| 49 | 60 |
| 50 #endif // COMPONENTS_PAYMENTS_CORE_PAYMENT_INSTRUMENT_H_ | 61 #endif // COMPONENTS_PAYMENTS_CORE_PAYMENT_INSTRUMENT_H_ |
| OLD | NEW |