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

Side by Side Diff: components/autofill/core/browser/full_card_request.h

Issue 1899893002: Card unmasking without form filling (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moar tests Created 4 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_FULL_CARD_REQUEST_H_
Mathieu 2016/04/22 17:58:35 should it be under core/browser/payments (alongsid
please use gerrit instead 2016/04/22 20:50:18 Done.
6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_FULL_CARD_REQUEST_H_
7
8 #include <memory>
9 #include <string>
10
11 #include "base/macros.h"
12 #include "base/memory/weak_ptr.h"
13 #include "base/strings/string16.h"
14 #include "base/time/time.h"
15 #include "components/autofill/core/browser/card_unmask_delegate.h"
16 #include "components/autofill/core/browser/payments/payments_client.h"
17
18 namespace net {
19 class URLRequestContextGetter;
20 }
21
22 namespace autofill {
23
24 class AutofillClient;
25 class CreditCard;
26 class PersonalDataManager;
27
28 // Retrieves the full card details, including the pan and the cvc.
29 class FullCardRequest : public CardUnmaskDelegate,
30 public payments::PaymentsClientDelegate {
31 public:
32 // The interface for receiving the full card details.
33 class Delegate {
34 public:
35 virtual void OnFullCardDetails(const CreditCard& card,
36 const base::string16& cvc) = 0;
37 virtual void OnFullCardError() = 0;
38 };
39
40 // The parameters should outlive the FullCardRequest.
41 FullCardRequest(net::URLRequestContextGetter* url_getter,
42 AutofillClient* autofill_client,
43 PersonalDataManager* personal_data_manager);
44 ~FullCardRequest();
45
46 // Retrieves the pan and cvc for |card| and invokes
47 // Delegate::OnFullCardDetails() or Delegate::OnFullCardError(). Only one
48 // request should be active at a time.
49 void GetFullCard(const CreditCard& card,
50 AutofillClient::UnmaskCardReason reason,
51 base::WeakPtr<Delegate> delegate);
52
53 // Returns true if there's a pending request to get the full card.
54 bool IsGettingFullCard() const;
55
56 private:
57 void OnDidGetUnmaskRiskData(const std::string& risk_data);
58
59 // CardUnmaskDelegate:
60 void OnUnmaskResponse(const UnmaskResponse& response) override;
61 void OnUnmaskPromptClosed() override;
62
63 // Used payments::PaymentsClientDelegate methods:
64 IdentityProvider* GetIdentityProvider() override;
65 void OnDidGetRealPan(AutofillClient::PaymentsRpcResult result,
66 const std::string& real_pan) override;
67
68 // Unused payments::PaymentsClientDelegate methods:
69 void OnDidGetUploadDetails(
70 AutofillClient::PaymentsRpcResult result,
71 const base::string16& context_token,
72 std::unique_ptr<base::DictionaryValue> legal_message) override;
73 void OnDidUploadCard(AutofillClient::PaymentsRpcResult result) override;
74
75 AutofillClient* const autofill_client_;
76 PersonalDataManager* const personal_data_manager_;
77 base::WeakPtr<Delegate> delegate_;
78 payments::PaymentsClient payments_client_;
79 std::unique_ptr<payments::PaymentsClient::UnmaskRequestDetails> request_;
80 base::Time real_pan_request_timestamp_;
81 base::WeakPtrFactory<FullCardRequest> weak_ptr_factory_;
82
83 DISALLOW_COPY_AND_ASSIGN(FullCardRequest);
84 };
85
86 } // namespace autofill
87
88 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_FULL_CARD_REQUEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698