| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 CHROME_BROWSER_UI_AUTOFILL_CARD_UNMASK_PROMPT_CONTROLLER_IMPL_H_ | 5 #ifndef CHROME_BROWSER_UI_AUTOFILL_CARD_UNMASK_PROMPT_CONTROLLER_IMPL_H_ |
| 6 #define CHROME_BROWSER_UI_AUTOFILL_CARD_UNMASK_PROMPT_CONTROLLER_IMPL_H_ | 6 #define CHROME_BROWSER_UI_AUTOFILL_CARD_UNMASK_PROMPT_CONTROLLER_IMPL_H_ |
| 7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 9 #include "chrome/browser/ui/autofill/card_unmask_prompt_controller.h" | 10 #include "chrome/browser/ui/autofill/card_unmask_prompt_controller.h" |
| 11 #include "components/autofill/core/browser/card_unmask_delegate.h" |
| 10 #include "components/autofill/core/browser/credit_card.h" | 12 #include "components/autofill/core/browser/credit_card.h" |
| 11 | 13 |
| 12 namespace autofill { | 14 namespace autofill { |
| 13 | 15 |
| 14 class CardUnmaskDelegate; | |
| 15 class CardUnmaskPromptView; | 16 class CardUnmaskPromptView; |
| 16 | 17 |
| 17 class CardUnmaskPromptControllerImpl : public CardUnmaskPromptController { | 18 class CardUnmaskPromptControllerImpl : public CardUnmaskPromptController { |
| 18 public: | 19 public: |
| 19 explicit CardUnmaskPromptControllerImpl(content::WebContents* web_contents); | 20 explicit CardUnmaskPromptControllerImpl(content::WebContents* web_contents); |
| 20 ~CardUnmaskPromptControllerImpl(); | 21 ~CardUnmaskPromptControllerImpl(); |
| 21 | 22 |
| 22 // Functions called by ChromeAutofillClient. | 23 // Functions called by ChromeAutofillClient. |
| 23 void ShowPrompt(const CreditCard& card, | 24 void ShowPrompt(const CreditCard& card, |
| 24 base::WeakPtr<CardUnmaskDelegate> delegate); | 25 base::WeakPtr<CardUnmaskDelegate> delegate); |
| 25 // The CVC the user entered went through validation. | 26 // The CVC the user entered went through validation. |
| 26 void OnVerificationResult(bool success); | 27 void OnVerificationResult(bool success); |
| 27 | 28 |
| 28 // CardUnmaskPromptController implementation. | 29 // CardUnmaskPromptController implementation. |
| 29 void OnUnmaskDialogClosed() override; | 30 void OnUnmaskDialogClosed() override; |
| 30 void OnUnmaskResponse(const base::string16& cvc, | 31 void OnUnmaskResponse(const base::string16& cvc, |
| 31 const base::string16& exp_month, | 32 const base::string16& exp_month, |
| 32 const base::string16& exp_year) override; | 33 const base::string16& exp_year) override; |
| 33 | 34 |
| 34 content::WebContents* GetWebContents() override; | 35 content::WebContents* GetWebContents() override; |
| 35 base::string16 GetWindowTitle() const override; | 36 base::string16 GetWindowTitle() const override; |
| 36 base::string16 GetInstructionsMessage() const override; | 37 base::string16 GetInstructionsMessage() const override; |
| 37 int GetCvcImageRid() const override; | 38 int GetCvcImageRid() const override; |
| 38 bool ShouldRequestExpirationDate() const override; | 39 bool ShouldRequestExpirationDate() const override; |
| 39 bool InputTextIsValid(const base::string16& input_text) const override; | 40 bool InputTextIsValid(const base::string16& input_text) const override; |
| 40 | 41 |
| 41 private: | 42 private: |
| 43 void LoadRiskFingerprint(); |
| 44 void OnDidLoadRiskFingerprint(const std::string& risk_data); |
| 45 |
| 42 content::WebContents* web_contents_; | 46 content::WebContents* web_contents_; |
| 43 CreditCard card_; | 47 CreditCard card_; |
| 44 base::WeakPtr<CardUnmaskDelegate> delegate_; | 48 base::WeakPtr<CardUnmaskDelegate> delegate_; |
| 45 CardUnmaskPromptView* card_unmask_view_; | 49 CardUnmaskPromptView* card_unmask_view_; |
| 46 | 50 |
| 51 CardUnmaskDelegate::UnmaskResponse pending_response_; |
| 52 |
| 47 base::WeakPtrFactory<CardUnmaskPromptControllerImpl> weak_pointer_factory_; | 53 base::WeakPtrFactory<CardUnmaskPromptControllerImpl> weak_pointer_factory_; |
| 48 | 54 |
| 49 DISALLOW_COPY_AND_ASSIGN(CardUnmaskPromptControllerImpl); | 55 DISALLOW_COPY_AND_ASSIGN(CardUnmaskPromptControllerImpl); |
| 50 }; | 56 }; |
| 51 | 57 |
| 52 } // namespace autofill | 58 } // namespace autofill |
| 53 | 59 |
| 54 #endif // CHROME_BROWSER_UI_AUTOFILL_CARD_UNMASK_PROMPT_CONTROLLER_IMPL_H_ | 60 #endif // CHROME_BROWSER_UI_AUTOFILL_CARD_UNMASK_PROMPT_CONTROLLER_IMPL_H_ |
| OLD | NEW |