Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_UI_VIEWS_PAYMENTS_CVC_UNMASK_VIEW_CONTROLLER_H_ | |
| 6 #define CHROME_BROWSER_UI_VIEWS_PAYMENTS_CVC_UNMASK_VIEW_CONTROLLER_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "base/macros.h" | |
| 11 #include "base/memory/ptr_util.h" | |
| 12 #include "base/observer_list.h" | |
| 13 #include "base/strings/string16.h" | |
| 14 #include "chrome/browser/ui/views/payments/payment_request_sheet_controller.h" | |
| 15 #include "components/autofill/core/browser/payments/full_card_request.h" | |
| 16 #include "components/autofill/core/browser/payments/payments_client.h" | |
| 17 #include "components/autofill/core/browser/risk_data_loader.h" | |
| 18 | |
| 19 namespace autofill { | |
| 20 namespace payments { | |
| 21 class FullCardRequest; | |
|
Mathieu
2017/04/04 19:05:47
look like this one is included
anthonyvd
2017/04/05 02:12:37
Done.
| |
| 22 } | |
| 23 class AutofillClient; | |
| 24 } | |
| 25 | |
| 26 namespace content { | |
| 27 class WebContents; | |
| 28 } | |
| 29 | |
| 30 namespace views { | |
| 31 class Textfield; | |
| 32 } | |
| 33 | |
| 34 namespace payments { | |
| 35 | |
| 36 class PaymentRequestSpec; | |
| 37 class PaymentRequestState; | |
| 38 class PaymentRequestDialogView; | |
| 39 | |
| 40 class CvcUnmaskViewController | |
| 41 : public PaymentRequestSheetController, | |
| 42 public autofill::RiskDataLoader, | |
| 43 public autofill::payments::PaymentsClientDelegate, | |
| 44 public autofill::payments::FullCardRequest::UIDelegate { | |
| 45 public: | |
| 46 CvcUnmaskViewController( | |
| 47 PaymentRequestSpec* spec, | |
| 48 PaymentRequestState* state, | |
| 49 PaymentRequestDialogView* dialog, | |
| 50 const autofill::CreditCard& credit_card, | |
| 51 base::WeakPtr<autofill::payments::FullCardRequest::ResultDelegate> | |
| 52 result_delegate); | |
| 53 ~CvcUnmaskViewController() override; | |
| 54 | |
| 55 // autofill::payments::PaymentsClientDelegate: | |
| 56 IdentityProvider* GetIdentityProvider() override; | |
| 57 void OnDidGetRealPan(autofill::AutofillClient::PaymentsRpcResult result, | |
| 58 const std::string& real_pan) override; | |
| 59 void OnDidGetUploadDetails( | |
| 60 autofill::AutofillClient::PaymentsRpcResult result, | |
| 61 const base::string16& context_token, | |
| 62 std::unique_ptr<base::DictionaryValue> legal_message) override; | |
| 63 void OnDidUploadCard( | |
| 64 autofill::AutofillClient::PaymentsRpcResult result) override; | |
| 65 | |
| 66 // autofill::RiskDataLoader: | |
| 67 void LoadRiskData( | |
| 68 const base::Callback<void(const std::string&)>& callback) override; | |
| 69 | |
| 70 // autofill::payments::FullCardRequest::UIDelegate: | |
| 71 void ShowUnmaskPrompt( | |
| 72 const autofill::CreditCard& card, | |
| 73 autofill::AutofillClient::UnmaskCardReason reason, | |
| 74 base::WeakPtr<autofill::CardUnmaskDelegate> delegate) override; | |
| 75 void OnUnmaskVerificationResult( | |
| 76 autofill::AutofillClient::PaymentsRpcResult result) override; | |
| 77 | |
| 78 protected: | |
| 79 // PaymentRequestSheetController: | |
| 80 base::string16 GetSheetTitle() override; | |
| 81 void FillContentView(views::View* content_view) override; | |
| 82 std::unique_ptr<views::Button> CreatePrimaryButton() override; | |
| 83 void ButtonPressed(views::Button* sender, const ui::Event& event) override; | |
| 84 | |
| 85 private: | |
| 86 void CvcConfirmed(); | |
| 87 | |
| 88 views::Textfield* cvc_field_; // owned by the view hierarchy, outlives this. | |
| 89 autofill::CreditCard credit_card_; | |
| 90 content::WebContents* web_contents_; | |
| 91 // The identity provider, used for Payments integration. | |
| 92 std::unique_ptr<IdentityProvider> identity_provider_; | |
| 93 std::unique_ptr<autofill::payments::PaymentsClient> payments_client_; | |
| 94 std::unique_ptr<autofill::payments::FullCardRequest> full_card_request_; | |
| 95 base::WeakPtr<autofill::CardUnmaskDelegate> unmask_delegate_; | |
| 96 | |
| 97 base::WeakPtrFactory<CvcUnmaskViewController> weak_ptr_factory_; | |
| 98 | |
| 99 DISALLOW_COPY_AND_ASSIGN(CvcUnmaskViewController); | |
| 100 }; | |
| 101 | |
| 102 } // namespace payments | |
| 103 | |
| 104 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_CVC_UNMASK_VIEW_CONTROLLER_H_ | |
| OLD | NEW |