| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 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 ANDROID_WEBVIEW_BROWSER_AW_AUTOFILL_MANAGER_DELEGATE_H_ | 5 #ifndef ANDROID_WEBVIEW_BROWSER_AW_AUTOFILL_MANAGER_DELEGATE_H_ |
| 6 #define ANDROID_WEBVIEW_BROWSER_AW_AUTOFILL_MANAGER_DELEGATE_H_ | 6 #define ANDROID_WEBVIEW_BROWSER_AW_AUTOFILL_MANAGER_DELEGATE_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/prefs/pref_registry_simple.h" | 10 #include "base/prefs/pref_registry_simple.h" |
| 11 #include "base/prefs/pref_service_builder.h" | 11 #include "base/prefs/pref_service_builder.h" |
| 12 #include "components/autofill/core/browser/autofill_manager_delegate.h" | 12 #include "components/autofill/core/browser/autofill_manager_delegate.h" |
| 13 #include "content/public/browser/web_contents_user_data.h" |
| 13 | 14 |
| 14 namespace autofill { | 15 namespace autofill { |
| 15 class AutofillMetrics; | 16 class AutofillMetrics; |
| 16 class AutofillPopupDelegate; | 17 class AutofillPopupDelegate; |
| 17 class CreditCard; | 18 class CreditCard; |
| 18 class FormStructure; | 19 class FormStructure; |
| 19 class PasswordGenerator; | 20 class PasswordGenerator; |
| 20 class PersonalDataManager; | 21 class PersonalDataManager; |
| 21 struct FormData; | 22 struct FormData; |
| 22 namespace autocheckout { | 23 namespace autocheckout { |
| 23 class WhitelistManager; | 24 class WhitelistManager; |
| 24 } | 25 } |
| 25 } | 26 } |
| 26 | 27 |
| 27 namespace content { | 28 namespace content { |
| 28 class WebContents; | 29 class WebContents; |
| 29 } | 30 } |
| 30 | 31 |
| 31 class PersonalDataManager; | 32 class PersonalDataManager; |
| 32 class PrefService; | 33 class PrefService; |
| 33 | 34 |
| 34 namespace android_webview { | 35 namespace android_webview { |
| 35 | 36 |
| 36 class AwAutofillManagerDelegate : | 37 // Manager delegate for the autofill functionality. Android webview |
| 37 public autofill::AutofillManagerDelegate { | 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 |
| 38 public: | 48 public: |
| 39 AwAutofillManagerDelegate(bool enabled); | |
| 40 virtual ~AwAutofillManagerDelegate(); | 49 virtual ~AwAutofillManagerDelegate(); |
| 41 | 50 |
| 42 void SetSaveFormData(bool enabled); | 51 void SetSaveFormData(bool enabled); |
| 43 bool GetSaveFormData(); | 52 bool GetSaveFormData(); |
| 44 | 53 |
| 45 // AutofillManagerDelegate implementation. | 54 // AutofillManagerDelegate implementation. |
| 46 virtual autofill::PersonalDataManager* GetPersonalDataManager() OVERRIDE; | 55 virtual autofill::PersonalDataManager* GetPersonalDataManager() OVERRIDE; |
| 47 virtual PrefService* GetPrefs() OVERRIDE; | 56 virtual PrefService* GetPrefs() OVERRIDE; |
| 48 virtual autofill::autocheckout::WhitelistManager* | 57 virtual autofill::autocheckout::WhitelistManager* |
| 49 GetAutocheckoutWhitelistManager() const OVERRIDE; | 58 GetAutocheckoutWhitelistManager() const OVERRIDE; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 69 virtual void ShowAutofillPopup( | 78 virtual void ShowAutofillPopup( |
| 70 const gfx::RectF& element_bounds, | 79 const gfx::RectF& element_bounds, |
| 71 base::i18n::TextDirection text_direction, | 80 base::i18n::TextDirection text_direction, |
| 72 const std::vector<string16>& values, | 81 const std::vector<string16>& values, |
| 73 const std::vector<string16>& labels, | 82 const std::vector<string16>& labels, |
| 74 const std::vector<string16>& icons, | 83 const std::vector<string16>& icons, |
| 75 const std::vector<int>& identifiers, | 84 const std::vector<int>& identifiers, |
| 76 base::WeakPtr<autofill::AutofillPopupDelegate> delegate) OVERRIDE; | 85 base::WeakPtr<autofill::AutofillPopupDelegate> delegate) OVERRIDE; |
| 77 virtual void HideAutofillPopup() OVERRIDE; | 86 virtual void HideAutofillPopup() OVERRIDE; |
| 78 virtual void UpdateProgressBar(double value) OVERRIDE; | 87 virtual void UpdateProgressBar(double value) OVERRIDE; |
| 88 virtual bool IsAutocompleteEnabled() OVERRIDE; |
| 79 | 89 |
| 80 private: | 90 private: |
| 91 AwAutofillManagerDelegate(content::WebContents* contents); |
| 92 friend class content::WebContentsUserData<AwAutofillManagerDelegate>; |
| 93 |
| 94 // The web_contents associated with this delegate. |
| 95 content::WebContents* web_contents_; |
| 96 |
| 97 bool save_form_data_; |
| 98 |
| 81 DISALLOW_COPY_AND_ASSIGN(AwAutofillManagerDelegate); | 99 DISALLOW_COPY_AND_ASSIGN(AwAutofillManagerDelegate); |
| 82 }; | 100 }; |
| 83 | 101 |
| 84 } // namespace android_webview | 102 } // namespace android_webview |
| 85 | 103 |
| 86 #endif // ANDROID_WEBVIEW_BROWSER_AW_AUTOFILL_MANAGER_DELEGATE_H_ | 104 #endif // ANDROID_WEBVIEW_BROWSER_AW_AUTOFILL_MANAGER_DELEGATE_H_ |
| OLD | NEW |