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 COMPONENTS_AUTOFILL_CORE_BROWSER_TEST_AUTOFILL_CLIENT_H_ | 5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_TEST_AUTOFILL_CLIENT_H_ |
6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_TEST_AUTOFILL_CLIENT_H_ | 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_TEST_AUTOFILL_CLIENT_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/prefs/pref_service.h" | 11 #include "base/prefs/pref_service.h" |
12 #include "components/autofill/core/browser/autofill_client.h" | 12 #include "components/autofill/core/browser/autofill_client.h" |
13 | 13 |
| 14 class ConfirmInfoBarDelegate; |
| 15 |
| 16 namespace infobars { |
| 17 class InfoBar; |
| 18 } |
| 19 |
14 namespace autofill { | 20 namespace autofill { |
15 | 21 |
| 22 class AutofillManager; |
| 23 |
16 // This class is for easier writing of tests. | 24 // This class is for easier writing of tests. |
17 class TestAutofillClient : public AutofillClient { | 25 class TestAutofillClient : public AutofillClient { |
18 public: | 26 public: |
19 TestAutofillClient(); | 27 TestAutofillClient(); |
20 ~TestAutofillClient() override; | 28 ~TestAutofillClient() override; |
21 | 29 |
22 // AutofillClient implementation. | 30 // AutofillClient implementation. |
23 PersonalDataManager* GetPersonalDataManager() override; | 31 PersonalDataManager* GetPersonalDataManager() override; |
24 scoped_refptr<AutofillWebDataService> GetDatabase() override; | 32 scoped_refptr<AutofillWebDataService> GetDatabase() override; |
25 PrefService* GetPrefs() override; | 33 PrefService* GetPrefs() override; |
26 void HideRequestAutocompleteDialog() override; | 34 void HideRequestAutocompleteDialog() override; |
27 void ShowAutofillSettings() override; | 35 void ShowAutofillSettings() override; |
28 void ShowUnmaskPrompt() override; | 36 void ShowUnmaskPrompt() override; |
29 void ConfirmSaveCreditCard(const base::Closure& save_card_callback) override; | 37 void ConfirmSaveCreditCard(AutofillManager* autofill_manager, |
| 38 const base::Closure& save_card_callback) override; |
30 bool HasCreditCardScanFeature() override; | 39 bool HasCreditCardScanFeature() override; |
31 void ScanCreditCard(const CreditCardScanCallback& callback) override; | 40 void ScanCreditCard(const CreditCardScanCallback& callback) override; |
32 void ShowRequestAutocompleteDialog(const FormData& form, | 41 void ShowRequestAutocompleteDialog(const FormData& form, |
33 const GURL& source_url, | 42 const GURL& source_url, |
34 const ResultCallback& callback) override; | 43 const ResultCallback& callback) override; |
35 void ShowAutofillPopup( | 44 void ShowAutofillPopup( |
36 const gfx::RectF& element_bounds, | 45 const gfx::RectF& element_bounds, |
37 base::i18n::TextDirection text_direction, | 46 base::i18n::TextDirection text_direction, |
38 const std::vector<base::string16>& values, | 47 const std::vector<base::string16>& values, |
39 const std::vector<base::string16>& labels, | 48 const std::vector<base::string16>& labels, |
40 const std::vector<base::string16>& icons, | 49 const std::vector<base::string16>& icons, |
41 const std::vector<int>& identifiers, | 50 const std::vector<int>& identifiers, |
42 base::WeakPtr<AutofillPopupDelegate> delegate) override; | 51 base::WeakPtr<AutofillPopupDelegate> delegate) override; |
43 void UpdateAutofillPopupDataListValues( | 52 void UpdateAutofillPopupDataListValues( |
44 const std::vector<base::string16>& values, | 53 const std::vector<base::string16>& values, |
45 const std::vector<base::string16>& labels) override; | 54 const std::vector<base::string16>& labels) override; |
46 void HideAutofillPopup() override; | 55 void HideAutofillPopup() override; |
47 bool IsAutocompleteEnabled() override; | 56 bool IsAutocompleteEnabled() override; |
48 void DetectAccountCreationForms( | 57 void DetectAccountCreationForms( |
49 content::RenderFrameHost* rfh, | 58 content::RenderFrameHost* rfh, |
50 const std::vector<autofill::FormStructure*>& forms) override; | 59 const std::vector<autofill::FormStructure*>& forms) override; |
51 void DidFillOrPreviewField(const base::string16& autofilled_value, | 60 void DidFillOrPreviewField(const base::string16& autofilled_value, |
52 const base::string16& profile_full_name) override; | 61 const base::string16& profile_full_name) override; |
53 void OnFirstUserGestureObserved() override; | 62 void OnFirstUserGestureObserved() override; |
| 63 scoped_ptr<infobars::InfoBar> CreateInfoBar( |
| 64 scoped_ptr<ConfirmInfoBarDelegate> delegate) override; |
54 | 65 |
55 void SetPrefs(scoped_ptr<PrefService> prefs) { prefs_ = prefs.Pass(); } | 66 void SetPrefs(scoped_ptr<PrefService> prefs) { prefs_ = prefs.Pass(); } |
56 | 67 |
57 private: | 68 private: |
58 // NULL by default. | 69 // NULL by default. |
59 scoped_ptr<PrefService> prefs_; | 70 scoped_ptr<PrefService> prefs_; |
60 | 71 |
61 DISALLOW_COPY_AND_ASSIGN(TestAutofillClient); | 72 DISALLOW_COPY_AND_ASSIGN(TestAutofillClient); |
62 }; | 73 }; |
63 | 74 |
64 } // namespace autofill | 75 } // namespace autofill |
65 | 76 |
66 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_TEST_AUTOFILL_CLIENT_H_ | 77 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_TEST_AUTOFILL_CLIENT_H_ |
OLD | NEW |