Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(386)

Side by Side Diff: android_webview/browser/aw_autofill_manager_delegate.h

Issue 15097004: Enable Autocomplete feature for chromium webview (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@setSaveFormData2
Patch Set: added a unit test Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 #include "base/prefs/pref_service_builder.h"
12 #include "components/autofill/browser/autofill_manager_delegate.h" 10 #include "components/autofill/browser/autofill_manager_delegate.h"
11 #include "content/public/browser/web_contents_user_data.h"
13 12
14 namespace autofill { 13 namespace autofill {
15 class AutofillMetrics; 14 class AutofillMetrics;
16 class AutofillPopupDelegate; 15 class AutofillPopupDelegate;
17 class CreditCard; 16 class CreditCard;
18 class FormStructure; 17 class FormStructure;
19 class PasswordGenerator; 18 class PasswordGenerator;
20 class PersonalDataManager; 19 class PersonalDataManager;
21 struct FormData; 20 struct FormData;
22 namespace autocheckout { 21 namespace autocheckout {
23 class WhitelistManager; 22 class WhitelistManager;
24 } 23 }
25 } 24 }
26 25
27 namespace content { 26 namespace content {
28 class WebContents; 27 class WebContents;
29 } 28 }
30 29
31 class PersonalDataManager; 30 class PersonalDataManager;
32 class PrefService; 31 class PrefService;
33 32
34 namespace android_webview { 33 namespace android_webview {
35 34
36 class AwAutofillManagerDelegate : 35 // Manager delegate for the autofill functionality. Android webview
37 public autofill::AutofillManagerDelegate { 36 // supports enabling autocomplete feature for each webview instance
37 // (different than the browser which supports enabling/disabling for
38 // a profile). Since there is only one pref service for a given browser
39 // context, we cannot enable this feature via UserPrefs. Rather, we always
40 // keep the feature enabled at the pref service, and control it via
41 // the delegates.
42 class AwAutofillManagerDelegate
43 : public autofill::AutofillManagerDelegate,
44 public content::WebContentsUserData<AwAutofillManagerDelegate> {
45
38 public: 46 public:
39 AwAutofillManagerDelegate(bool enabled);
40 virtual ~AwAutofillManagerDelegate(); 47 virtual ~AwAutofillManagerDelegate();
41 48
42 void SetSaveFormData(bool enabled); 49 void SetSaveFormData(bool enabled);
43 bool GetSaveFormData(); 50 bool GetSaveFormData();
44 51
45 // AutofillManagerDelegate implementation. 52 // AutofillManagerDelegate implementation.
46 virtual autofill::PersonalDataManager* GetPersonalDataManager() OVERRIDE; 53 virtual autofill::PersonalDataManager* GetPersonalDataManager() OVERRIDE;
47 virtual PrefService* GetPrefs() OVERRIDE; 54 virtual PrefService* GetPrefs() OVERRIDE;
48 virtual autofill::autocheckout::WhitelistManager* 55 virtual autofill::autocheckout::WhitelistManager*
49 GetAutocheckoutWhitelistManager() const OVERRIDE; 56 GetAutocheckoutWhitelistManager() const OVERRIDE;
(...skipping 18 matching lines...) Expand all
68 const std::string&)>& callback) OVERRIDE; 75 const std::string&)>& callback) OVERRIDE;
69 virtual void ShowAutofillPopup( 76 virtual void ShowAutofillPopup(
70 const gfx::RectF& element_bounds, 77 const gfx::RectF& element_bounds,
71 const std::vector<string16>& values, 78 const std::vector<string16>& values,
72 const std::vector<string16>& labels, 79 const std::vector<string16>& labels,
73 const std::vector<string16>& icons, 80 const std::vector<string16>& icons,
74 const std::vector<int>& identifiers, 81 const std::vector<int>& identifiers,
75 base::WeakPtr<autofill::AutofillPopupDelegate> delegate) OVERRIDE; 82 base::WeakPtr<autofill::AutofillPopupDelegate> delegate) OVERRIDE;
76 virtual void HideAutofillPopup() OVERRIDE; 83 virtual void HideAutofillPopup() OVERRIDE;
77 virtual void UpdateProgressBar(double value) OVERRIDE; 84 virtual void UpdateProgressBar(double value) OVERRIDE;
85 virtual bool ShouldIgnoreFormData() OVERRIDE;
78 86
79 private: 87 private:
88 AwAutofillManagerDelegate(content::WebContents* contents);
89 friend class content::WebContentsUserData<AwAutofillManagerDelegate>;
90
91 // The web_contents associated with this delegate.
92 content::WebContents* web_contents_;
93
94 bool save_form_data_;
95
80 DISALLOW_COPY_AND_ASSIGN(AwAutofillManagerDelegate); 96 DISALLOW_COPY_AND_ASSIGN(AwAutofillManagerDelegate);
81 }; 97 };
82 98
83 } // namespace android_webview 99 } // namespace android_webview
84 100
85 #endif // ANDROID_WEBVIEW_BROWSER_AW_AUTOFILL_MANAGER_DELEGATE_H_ 101 #endif // ANDROID_WEBVIEW_BROWSER_AW_AUTOFILL_MANAGER_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698