| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2013 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 ANDROID_WEBVIEW_BROWSER_AW_AUTOFILL_MANAGER_DELEGATE_H_ | |
| 6 #define ANDROID_WEBVIEW_BROWSER_AW_AUTOFILL_MANAGER_DELEGATE_H_ | |
| 7 | |
| 8 #include "base/basictypes.h" | |
| 9 #include "base/compiler_specific.h" | |
| 10 #include "base/prefs/pref_registry_simple.h" | |
| 11 #include "base/prefs/pref_service_builder.h" | |
| 12 #include "components/autofill/core/browser/autofill_manager_delegate.h" | |
| 13 #include "content/public/browser/web_contents_user_data.h" | |
| 14 | |
| 15 namespace autofill { | |
| 16 class AutofillMetrics; | |
| 17 class AutofillPopupDelegate; | |
| 18 class CreditCard; | |
| 19 class FormStructure; | |
| 20 class PasswordGenerator; | |
| 21 class PersonalDataManager; | |
| 22 struct FormData; | |
| 23 namespace autocheckout { | |
| 24 class WhitelistManager; | |
| 25 } | |
| 26 } | |
| 27 | |
| 28 namespace content { | |
| 29 class WebContents; | |
| 30 } | |
| 31 | |
| 32 class PersonalDataManager; | |
| 33 class PrefService; | |
| 34 | |
| 35 namespace android_webview { | |
| 36 | |
| 37 // Manager delegate for the autofill functionality. Android webview | |
| 38 // supports enabling autocomplete feature for each webview instance | |
| 39 // (different than the browser which supports enabling/disabling for | |
| 40 // a profile). Since there is only one pref service for a given browser | |
| 41 // context, we cannot enable this feature via UserPrefs. Rather, we always | |
| 42 // keep the feature enabled at the pref service, and control it via | |
| 43 // the delegates. | |
| 44 class AwAutofillManagerDelegate | |
| 45 : public autofill::AutofillManagerDelegate, | |
| 46 public content::WebContentsUserData<AwAutofillManagerDelegate> { | |
| 47 | |
| 48 public: | |
| 49 virtual ~AwAutofillManagerDelegate(); | |
| 50 | |
| 51 void SetSaveFormData(bool enabled); | |
| 52 bool GetSaveFormData(); | |
| 53 | |
| 54 // AutofillManagerDelegate implementation. | |
| 55 virtual autofill::PersonalDataManager* GetPersonalDataManager() OVERRIDE; | |
| 56 virtual PrefService* GetPrefs() OVERRIDE; | |
| 57 virtual autofill::autocheckout::WhitelistManager* | |
| 58 GetAutocheckoutWhitelistManager() const OVERRIDE; | |
| 59 virtual void HideRequestAutocompleteDialog() OVERRIDE; | |
| 60 virtual void OnAutocheckoutError() OVERRIDE; | |
| 61 virtual void OnAutocheckoutSuccess() OVERRIDE; | |
| 62 virtual void ShowAutofillSettings() OVERRIDE; | |
| 63 virtual void ConfirmSaveCreditCard( | |
| 64 const autofill::AutofillMetrics& metric_logger, | |
| 65 const autofill::CreditCard& credit_card, | |
| 66 const base::Closure& save_card_callback) OVERRIDE; | |
| 67 virtual void ShowAutocheckoutBubble( | |
| 68 const gfx::RectF& bounds, | |
| 69 bool is_google_user, | |
| 70 const base::Callback<void(bool)>& callback) OVERRIDE; | |
| 71 virtual void HideAutocheckoutBubble() OVERRIDE; | |
| 72 virtual void ShowRequestAutocompleteDialog( | |
| 73 const autofill::FormData& form, | |
| 74 const GURL& source_url, | |
| 75 autofill::DialogType dialog_type, | |
| 76 const base::Callback<void(const autofill::FormStructure*, | |
| 77 const std::string&)>& callback) OVERRIDE; | |
| 78 virtual void ShowAutofillPopup( | |
| 79 const gfx::RectF& element_bounds, | |
| 80 base::i18n::TextDirection text_direction, | |
| 81 const std::vector<string16>& values, | |
| 82 const std::vector<string16>& labels, | |
| 83 const std::vector<string16>& icons, | |
| 84 const std::vector<int>& identifiers, | |
| 85 base::WeakPtr<autofill::AutofillPopupDelegate> delegate) OVERRIDE; | |
| 86 virtual void HideAutofillPopup() OVERRIDE; | |
| 87 virtual bool IsAutocompleteEnabled() OVERRIDE; | |
| 88 virtual void AddAutocheckoutStep(autofill::AutocheckoutStepType step_type) | |
| 89 OVERRIDE; | |
| 90 virtual void UpdateAutocheckoutStep( | |
| 91 autofill::AutocheckoutStepType step_type, | |
| 92 autofill::AutocheckoutStepStatus step_status) OVERRIDE; | |
| 93 | |
| 94 private: | |
| 95 AwAutofillManagerDelegate(content::WebContents* contents); | |
| 96 friend class content::WebContentsUserData<AwAutofillManagerDelegate>; | |
| 97 | |
| 98 // The web_contents associated with this delegate. | |
| 99 content::WebContents* web_contents_; | |
| 100 | |
| 101 bool save_form_data_; | |
| 102 | |
| 103 DISALLOW_COPY_AND_ASSIGN(AwAutofillManagerDelegate); | |
| 104 }; | |
| 105 | |
| 106 } // namespace android_webview | |
| 107 | |
| 108 #endif // ANDROID_WEBVIEW_BROWSER_AW_AUTOFILL_MANAGER_DELEGATE_H_ | |
| OLD | NEW |