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

Side by Side Diff: components/payments/core/autofill_payment_instrument.h

Issue 2779283002: [Web Payments] Implement the CVC Unmask dialog. (Closed)
Patch Set: Address comments Created 3 years, 8 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_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 {
Mathieu 2017/04/05 00:02:23 I think I still see a world where this is not need
anthonyvd 2017/04/05 02:12:37 Yep, you're right. Done.
30 public:
31 virtual ~FullCardRequestDelegate() {}
32 virtual void DoFullCardRequest(
33 const autofill::CreditCard& credit_card,
34 base::WeakPtr<autofill::payments::FullCardRequest::ResultDelegate>
35 result_delegate) = 0;
36 };
37
26 // |billing_profiles| is owned by the caller and should outlive this object. 38 // |billing_profiles| is owned by the caller and should outlive this object.
39 // |full_card_request_delegate| must outlive this object.
27 AutofillPaymentInstrument( 40 AutofillPaymentInstrument(
28 const std::string& method_name, 41 const std::string& method_name,
29 const autofill::CreditCard& card, 42 const autofill::CreditCard& card,
30 const std::vector<autofill::AutofillProfile*>& billing_profiles, 43 const std::vector<autofill::AutofillProfile*>& billing_profiles,
31 const std::string& app_locale); 44 const std::string& app_locale,
45 FullCardRequestDelegate* full_card_request_delegate);
32 ~AutofillPaymentInstrument() override; 46 ~AutofillPaymentInstrument() override;
33 47
34 // PaymentInstrument: 48 // PaymentInstrument:
35 void InvokePaymentApp(PaymentInstrument::Delegate* delegate) override; 49 void InvokePaymentApp(PaymentInstrument::Delegate* delegate) override;
36 bool IsValid() override; 50 bool IsValid() override;
37 51
52 // autofill::payments::FullCardRequest::ResultDelegate:
53 void OnFullCardRequestSucceeded(const autofill::CreditCard& card,
54 const base::string16& cvc) override;
55 void OnFullCardRequestFailed() override;
56
38 private: 57 private:
39 // A copy of the card is owned by this object. 58 // A copy of the card is owned by this object.
40 const autofill::CreditCard credit_card_; 59 autofill::CreditCard credit_card_;
41 // Not owned by this object, should outlive this. 60 // Not owned by this object, should outlive this.
42 const std::vector<autofill::AutofillProfile*>& billing_profiles_; 61 const std::vector<autofill::AutofillProfile*>& billing_profiles_;
43 62
44 const std::string app_locale_; 63 const std::string app_locale_;
45 64
65 PaymentInstrument::Delegate* delegate_;
66 FullCardRequestDelegate* full_card_request_delegate_;
67
68 base::WeakPtrFactory<AutofillPaymentInstrument> weak_ptr_factory_;
69
46 DISALLOW_COPY_AND_ASSIGN(AutofillPaymentInstrument); 70 DISALLOW_COPY_AND_ASSIGN(AutofillPaymentInstrument);
47 }; 71 };
48 72
49 } // namespace payments 73 } // namespace payments
50 74
51 #endif // COMPONENTS_PAYMENTS_CORE_AUTOFILL_PAYMENT_INSTRUMENT_H_ 75 #endif // COMPONENTS_PAYMENTS_CORE_AUTOFILL_PAYMENT_INSTRUMENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698