OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_AUTOFILL_CORE_BROWSER_PAYMENTS_FULL_CARD_REQUEST_H_ | 5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_PAYMENTS_FULL_CARD_REQUEST_H_ |
6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_PAYMENTS_FULL_CARD_REQUEST_H_ | 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_PAYMENTS_FULL_CARD_REQUEST_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 11 matching lines...) Expand all Loading... |
22 class PersonalDataManager; | 22 class PersonalDataManager; |
23 | 23 |
24 namespace payments { | 24 namespace payments { |
25 | 25 |
26 // Retrieves the full card details, including the pan and the cvc. | 26 // Retrieves the full card details, including the pan and the cvc. |
27 class FullCardRequest : public CardUnmaskDelegate { | 27 class FullCardRequest : public CardUnmaskDelegate { |
28 public: | 28 public: |
29 // The interface for receiving the full card details. | 29 // The interface for receiving the full card details. |
30 class Delegate { | 30 class Delegate { |
31 public: | 31 public: |
32 virtual void OnFullCardDetails(const CreditCard& card, | 32 virtual void OnFullCardRequestSucceeded(const CreditCard& card, |
33 const base::string16& cvc) = 0; | 33 const base::string16& cvc) = 0; |
34 virtual void OnFullCardError() = 0; | 34 virtual void OnFullCardRequestFailed() = 0; |
35 }; | 35 }; |
36 | 36 |
37 // The parameters should outlive the FullCardRequest. | 37 // The parameters should outlive the FullCardRequest. |
38 FullCardRequest(AutofillClient* autofill_client, | 38 FullCardRequest(AutofillClient* autofill_client, |
39 payments::PaymentsClient* payments_client, | 39 payments::PaymentsClient* payments_client, |
40 PersonalDataManager* personal_data_manager); | 40 PersonalDataManager* personal_data_manager); |
41 ~FullCardRequest(); | 41 ~FullCardRequest(); |
42 | 42 |
43 // Retrieves the pan and cvc for |card| and invokes | 43 // Retrieves the pan and cvc for |card| and invokes |
44 // Delegate::OnFullCardDetails() or Delegate::OnFullCardError(). Only one | 44 // Delegate::OnFullCardRequestSucceeded() or |
45 // request should be active at a time. | 45 // Delegate::OnFullCardRequestFailed(). Only one request should be active at a |
| 46 // time. |
46 // | 47 // |
47 // If the card is local, has a non-empty GUID, and the user has updated its | 48 // If the card is local, has a non-empty GUID, and the user has updated its |
48 // expiration date, then this function will write the new information to | 49 // expiration date, then this function will write the new information to |
49 // autofill table on disk. | 50 // autofill table on disk. |
50 void GetFullCard(const CreditCard& card, | 51 void GetFullCard(const CreditCard& card, |
51 AutofillClient::UnmaskCardReason reason, | 52 AutofillClient::UnmaskCardReason reason, |
52 base::WeakPtr<Delegate> delegate); | 53 base::WeakPtr<Delegate> delegate); |
53 | 54 |
54 // Returns true if there's a pending request to get the full card. | 55 // Returns true if there's a pending request to get the full card. |
55 bool IsGettingFullCard() const; | 56 bool IsGettingFullCard() const; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 // communication is pending. | 96 // communication is pending. |
96 base::WeakPtrFactory<FullCardRequest> weak_ptr_factory_; | 97 base::WeakPtrFactory<FullCardRequest> weak_ptr_factory_; |
97 | 98 |
98 DISALLOW_COPY_AND_ASSIGN(FullCardRequest); | 99 DISALLOW_COPY_AND_ASSIGN(FullCardRequest); |
99 }; | 100 }; |
100 | 101 |
101 } // namespace payments | 102 } // namespace payments |
102 } // namespace autofill | 103 } // namespace autofill |
103 | 104 |
104 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_PAYMENTS_FULL_CARD_REQUEST_H_ | 105 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_PAYMENTS_FULL_CARD_REQUEST_H_ |
OLD | NEW |