1 // Copyright 2018 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef IOS_WEB_VIEW_INTERNAL_AUTOFILL_CWV_CREDIT_CARD_VERIFIER_INTERNAL_H_
6 #define IOS_WEB_VIEW_INTERNAL_AUTOFILL_CWV_CREDIT_CARD_VERIFIER_INTERNAL_H_
7 
8 #import "ios/web_view/public/cwv_credit_card_verifier.h"
9 
10 #include "components/autofill/core/browser/autofill_client.h"
11 
12 NS_ASSUME_NONNULL_BEGIN
13 
14 namespace autofill {
15 class CardUnmaskDelegate;
16 class CreditCard;
17 }  // namespace autofill
18 
19 @interface CWVCreditCardVerifier ()
20 
21 // Designated initializer.
22 // |prefs| The associated pref service. Must outlive this instance.
23 // |isOffTheRecord| The associated browser state's off the record state.
24 // |creditCard| The card that needs verification.
25 // |reason| Why the card needs verification.
26 // |delegate| Internal delegate used process verification events.
27 - (instancetype)initWithPrefs:(PrefService*)prefs
28                isOffTheRecord:(BOOL)isOffTheRecord
29                    creditCard:(const autofill::CreditCard&)creditCard
30                        reason:(autofill::AutofillClient::UnmaskCardReason)reason
31                      delegate:
32                          (base::WeakPtr<autofill::CardUnmaskDelegate>)delegate
33     NS_DESIGNATED_INITIALIZER;
34 
35 // Used to pass unmask verification results to this class. Needed because
36 // verification results arrive from the CWVAutofillClientBridge protocol defiend
37 // in CWVAutofillController.
38 - (void)didReceiveUnmaskVerificationResult:
39     (autofill::AutofillClient::PaymentsRpcResult)result;
40 
41 // Use to notify CWVCreditCardVerifier that it needs to obtain risk data for
42 // credit card verification and to pass it back in |callback|.
43 - (void)loadRiskData:(base::OnceCallback<void(const std::string&)>)callback;
44 
45 @end
46 
47 NS_ASSUME_NONNULL_END
48 
49 #endif  // IOS_WEB_VIEW_INTERNAL_AUTOFILL_CWV_CREDIT_CARD_VERIFIER_INTERNAL_H_
50