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_AUTOFILL_PAYMENT_INSTRUMENT_H_ | 5 #ifndef COMPONENTS_PAYMENTS_CORE_AUTOFILL_PAYMENT_INSTRUMENT_H_ |
| 6 #define COMPONENTS_PAYMENTS_CORE_AUTOFILL_PAYMENT_INSTRUMENT_H_ | 6 #define COMPONENTS_PAYMENTS_CORE_AUTOFILL_PAYMENT_INSTRUMENT_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "components/autofill/core/browser/credit_card.h" | 13 #include "components/autofill/core/browser/credit_card.h" |
| 14 #include "components/autofill/core/browser/payments/full_card_request.h" | |
| 14 #include "components/payments/core/payment_instrument.h" | 15 #include "components/payments/core/payment_instrument.h" |
| 15 | 16 |
| 16 namespace autofill { | 17 namespace autofill { |
| 17 class AutofillProfile; | 18 class AutofillProfile; |
| 18 } | 19 } |
| 19 | 20 |
| 20 namespace payments { | 21 namespace payments { |
| 21 | 22 |
| 22 // Represents an Autofill/Payments credit card form of payment in Payment | 23 // Represents an Autofill/Payments credit card form of payment in Payment |
| 23 // Request. | 24 // Request. |
| 24 class AutofillPaymentInstrument : public PaymentInstrument { | 25 class AutofillPaymentInstrument |
| 26 : public PaymentInstrument, | |
| 27 public autofill::payments::FullCardRequest::ResultDelegate { | |
| 25 public: | 28 public: |
| 29 class FullCardRequestDelegate { | |
| 30 public: | |
|
please use gerrit instead
2017/03/30 13:14:10
Need an empty virtual destructor.
anthonyvd
2017/03/30 15:43:41
Done.
| |
| 31 virtual void DoFullCardRequest( | |
| 32 const autofill::CreditCard& credit_card, | |
| 33 base::WeakPtr<autofill::payments::FullCardRequest::ResultDelegate> | |
| 34 result_delegate) = 0; | |
| 35 }; | |
| 36 | |
| 26 // |billing_profiles| is owned by the caller and should outlive this object. | 37 // |billing_profiles| is owned by the caller and should outlive this object. |
| 27 AutofillPaymentInstrument( | 38 AutofillPaymentInstrument( |
| 28 const std::string& method_name, | 39 const std::string& method_name, |
| 29 const autofill::CreditCard& card, | 40 const autofill::CreditCard& card, |
| 30 const std::vector<autofill::AutofillProfile*>& billing_profiles, | 41 const std::vector<autofill::AutofillProfile*>& billing_profiles, |
| 31 const std::string& app_locale); | 42 const std::string& app_locale, |
| 43 FullCardRequestDelegate* full_card_request_delegate); | |
|
please use gerrit instead
2017/03/30 13:14:10
Add a comment about ownership of full_Card_request
anthonyvd
2017/03/30 15:43:41
Done.
| |
| 32 ~AutofillPaymentInstrument() override; | 44 ~AutofillPaymentInstrument() override; |
| 33 | 45 |
| 34 // PaymentInstrument: | 46 // PaymentInstrument: |
| 35 void InvokePaymentApp(PaymentInstrument::Delegate* delegate) override; | 47 void InvokePaymentApp(PaymentInstrument::Delegate* delegate) override; |
| 36 bool IsValid() override; | 48 bool IsValid() override; |
| 37 | 49 |
| 50 // autofill::payments::FullCardRequest::ResultDelegate: | |
| 51 void OnFullCardRequestSucceeded(const autofill::CreditCard& card, | |
| 52 const base::string16& cvc) override; | |
| 53 void OnFullCardRequestFailed() override; | |
| 54 | |
| 38 private: | 55 private: |
| 39 // A copy of the card is owned by this object. | 56 // A copy of the card is owned by this object. |
| 40 const autofill::CreditCard credit_card_; | 57 autofill::CreditCard credit_card_; |
| 41 // Not owned by this object, should outlive this. | 58 // Not owned by this object, should outlive this. |
| 42 const std::vector<autofill::AutofillProfile*>& billing_profiles_; | 59 const std::vector<autofill::AutofillProfile*>& billing_profiles_; |
| 43 | 60 |
| 44 const std::string app_locale_; | 61 const std::string app_locale_; |
| 45 | 62 |
| 63 PaymentInstrument::Delegate* delegate_; | |
| 64 FullCardRequestDelegate* full_card_request_delegate_; | |
| 65 | |
| 66 base::WeakPtrFactory<AutofillPaymentInstrument> weak_ptr_factory_; | |
| 67 | |
| 46 DISALLOW_COPY_AND_ASSIGN(AutofillPaymentInstrument); | 68 DISALLOW_COPY_AND_ASSIGN(AutofillPaymentInstrument); |
| 47 }; | 69 }; |
| 48 | 70 |
| 49 } // namespace payments | 71 } // namespace payments |
| 50 | 72 |
| 51 #endif // COMPONENTS_PAYMENTS_CORE_AUTOFILL_PAYMENT_INSTRUMENT_H_ | 73 #endif // COMPONENTS_PAYMENTS_CORE_AUTOFILL_PAYMENT_INSTRUMENT_H_ |
| OLD | NEW |