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/scoped_ptr.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #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" | 11 #include "components/autofill/core/browser/card_unmask_delegate.h" |
12 #include "components/autofill/core/browser/credit_card.h" | 12 #include "components/autofill/core/browser/credit_card.h" |
13 | 13 |
14 namespace autofill { | 14 namespace autofill { |
15 | 15 |
16 class CardUnmaskPromptView; | 16 class CardUnmaskPromptView; |
17 | 17 |
18 class CardUnmaskPromptControllerImpl : public CardUnmaskPromptController { | 18 class CardUnmaskPromptControllerImpl : public CardUnmaskPromptController { |
19 public: | 19 public: |
20 explicit CardUnmaskPromptControllerImpl(content::WebContents* web_contents); | 20 explicit CardUnmaskPromptControllerImpl(content::WebContents* web_contents); |
21 ~CardUnmaskPromptControllerImpl(); | 21 virtual ~CardUnmaskPromptControllerImpl(); |
bondd
2015/02/24 00:24:33
This is subclassed by TestCardUnmaskPromptControll
| |
22 | 22 |
23 // Functions called by ChromeAutofillClient. | 23 // Functions called by ChromeAutofillClient. |
24 void ShowPrompt(const CreditCard& card, | 24 void ShowPrompt(const CreditCard& card, |
25 base::WeakPtr<CardUnmaskDelegate> delegate); | 25 base::WeakPtr<CardUnmaskDelegate> delegate); |
26 // The CVC the user entered went through validation. | 26 // The CVC the user entered went through validation. |
27 void OnVerificationResult(bool success); | 27 void OnVerificationResult(bool success); |
28 | 28 |
29 // CardUnmaskPromptController implementation. | 29 // CardUnmaskPromptController implementation. |
30 void OnUnmaskDialogClosed() override; | 30 void OnUnmaskDialogClosed() override; |
31 void OnUnmaskResponse(const base::string16& cvc, | 31 void OnUnmaskResponse(const base::string16& cvc, |
32 const base::string16& exp_month, | 32 const base::string16& exp_month, |
33 const base::string16& exp_year, | 33 const base::string16& exp_year, |
34 bool should_store_pan) override; | 34 bool should_store_pan) override; |
35 | 35 |
36 content::WebContents* GetWebContents() override; | 36 content::WebContents* GetWebContents() override; |
37 base::string16 GetWindowTitle() const override; | 37 base::string16 GetWindowTitle() const override; |
38 base::string16 GetInstructionsMessage() const override; | 38 base::string16 GetInstructionsMessage() const override; |
39 int GetCvcImageRid() const override; | 39 int GetCvcImageRid() const override; |
40 bool ShouldRequestExpirationDate() const override; | 40 bool ShouldRequestExpirationDate() const override; |
41 bool GetStoreLocallyStartState() const override; | 41 bool GetStoreLocallyStartState() const override; |
42 bool InputTextIsValid(const base::string16& input_text) const override; | 42 bool InputTextIsValid(const base::string16& input_text) const override; |
43 | 43 |
44 protected: | |
45 virtual void OnDidLoadRiskFingerprint(const std::string& risk_data); | |
46 | |
47 // Exposed for testing. | |
48 CardUnmaskPromptView* view() { return card_unmask_view_; } | |
49 | |
44 private: | 50 private: |
45 void LoadRiskFingerprint(); | 51 void LoadRiskFingerprint(); |
46 void OnDidLoadRiskFingerprint(const std::string& risk_data); | |
47 | 52 |
48 content::WebContents* web_contents_; | 53 content::WebContents* web_contents_; |
49 CreditCard card_; | 54 CreditCard card_; |
50 base::WeakPtr<CardUnmaskDelegate> delegate_; | 55 base::WeakPtr<CardUnmaskDelegate> delegate_; |
51 CardUnmaskPromptView* card_unmask_view_; | 56 CardUnmaskPromptView* card_unmask_view_; |
52 | 57 |
53 CardUnmaskDelegate::UnmaskResponse pending_response_; | 58 CardUnmaskDelegate::UnmaskResponse pending_response_; |
54 | 59 |
55 base::WeakPtrFactory<CardUnmaskPromptControllerImpl> weak_pointer_factory_; | 60 base::WeakPtrFactory<CardUnmaskPromptControllerImpl> weak_pointer_factory_; |
56 | 61 |
57 DISALLOW_COPY_AND_ASSIGN(CardUnmaskPromptControllerImpl); | 62 DISALLOW_COPY_AND_ASSIGN(CardUnmaskPromptControllerImpl); |
58 }; | 63 }; |
59 | 64 |
60 } // namespace autofill | 65 } // namespace autofill |
61 | 66 |
62 #endif // CHROME_BROWSER_UI_AUTOFILL_CARD_UNMASK_PROMPT_CONTROLLER_IMPL_H_ | 67 #endif // CHROME_BROWSER_UI_AUTOFILL_CARD_UNMASK_PROMPT_CONTROLLER_IMPL_H_ |
OLD | NEW |