Chromium Code Reviews| 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 <jni.h> | |
| 9 #include <vector> | |
| 10 | |
| 11 #include "base/android/jni_helper.h" | |
| 8 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 10 #include "base/prefs/pref_registry_simple.h" | 14 #include "base/prefs/pref_registry_simple.h" |
| 11 #include "base/prefs/pref_service_builder.h" | 15 #include "base/prefs/pref_service_builder.h" |
| 12 #include "components/autofill/core/browser/autofill_manager_delegate.h" | 16 #include "components/autofill/core/browser/autofill_manager_delegate.h" |
| 13 #include "content/public/browser/web_contents_user_data.h" | 17 #include "content/public/browser/web_contents_user_data.h" |
| 14 | 18 |
| 15 namespace autofill { | 19 namespace autofill { |
| 16 class AutofillMetrics; | 20 class AutofillMetrics; |
| 17 class AutofillPopupDelegate; | 21 class AutofillPopupDelegate; |
| 18 class CreditCard; | 22 class CreditCard; |
| 19 class FormStructure; | 23 class FormStructure; |
| 20 class PasswordGenerator; | 24 class PasswordGenerator; |
| 21 class PersonalDataManager; | 25 class PersonalDataManager; |
| 22 struct FormData; | 26 struct FormData; |
| 23 namespace autocheckout { | 27 namespace autocheckout { |
| 24 class WhitelistManager; | 28 class WhitelistManager; |
| 25 } | 29 } |
| 26 } | 30 } |
| 27 | 31 |
| 28 namespace content { | 32 namespace content { |
| 29 class WebContents; | 33 class WebContents; |
| 30 } | 34 } |
| 31 | 35 |
| 36 namespace gfx { | |
| 37 class RectF; | |
| 38 } | |
| 39 | |
| 32 class PersonalDataManager; | 40 class PersonalDataManager; |
| 33 class PrefService; | 41 class PrefService; |
| 34 | 42 |
| 35 namespace android_webview { | 43 namespace android_webview { |
| 36 | 44 |
| 37 // Manager delegate for the autofill functionality. Android webview | 45 // Manager delegate for the autofill functionality. Android webview |
| 38 // supports enabling autocomplete feature for each webview instance | 46 // supports enabling autocomplete feature for each webview instance |
| 39 // (different than the browser which supports enabling/disabling for | 47 // (different than the browser which supports enabling/disabling for |
| 40 // a profile). Since there is only one pref service for a given browser | 48 // 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 | 49 // context, we cannot enable this feature via UserPrefs. Rather, we always |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 84 const std::vector<int>& identifiers, | 92 const std::vector<int>& identifiers, |
| 85 base::WeakPtr<autofill::AutofillPopupDelegate> delegate) OVERRIDE; | 93 base::WeakPtr<autofill::AutofillPopupDelegate> delegate) OVERRIDE; |
| 86 virtual void HideAutofillPopup() OVERRIDE; | 94 virtual void HideAutofillPopup() OVERRIDE; |
| 87 virtual bool IsAutocompleteEnabled() OVERRIDE; | 95 virtual bool IsAutocompleteEnabled() OVERRIDE; |
| 88 virtual void AddAutocheckoutStep(autofill::AutocheckoutStepType step_type) | 96 virtual void AddAutocheckoutStep(autofill::AutocheckoutStepType step_type) |
| 89 OVERRIDE; | 97 OVERRIDE; |
| 90 virtual void UpdateAutocheckoutStep( | 98 virtual void UpdateAutocheckoutStep( |
| 91 autofill::AutocheckoutStepType step_type, | 99 autofill::AutocheckoutStepType step_type, |
| 92 autofill::AutocheckoutStepStatus step_status) OVERRIDE; | 100 autofill::AutocheckoutStepStatus step_status) OVERRIDE; |
| 93 | 101 |
| 102 void SuggestionSelected(JNIEnv* env, | |
| 103 jobject obj, | |
| 104 jint position); | |
| 94 private: | 105 private: |
| 95 AwAutofillManagerDelegate(content::WebContents* contents); | 106 AwAutofillManagerDelegate(content::WebContents* web_contents); |
| 96 friend class content::WebContentsUserData<AwAutofillManagerDelegate>; | 107 friend class content::WebContentsUserData<AwAutofillManagerDelegate>; |
| 97 | 108 |
| 109 void ShowAutofillPopupImpl(const gfx::RectF& element_bounds, | |
| 110 const std::vector<string16>& values, | |
| 111 const std::vector<string16>& labels, | |
| 112 const std::vector<int>& identifiers); | |
| 113 | |
| 98 // The web_contents associated with this delegate. | 114 // The web_contents associated with this delegate. |
| 99 content::WebContents* web_contents_; | 115 content::WebContents* web_contents_; |
| 116 bool save_form_data_; | |
| 117 JavaObjectWeakGlobalRef java_ref_; | |
| 100 | 118 |
| 101 bool save_form_data_; | 119 // The current Autofill query values. |
| 120 std::vector<string16> values_; | |
| 121 std::vector<int> identifiers_; | |
| 122 base::WeakPtr<autofill::AutofillPopupDelegate> delegate_; | |
| 102 | 123 |
| 103 DISALLOW_COPY_AND_ASSIGN(AwAutofillManagerDelegate); | 124 DISALLOW_COPY_AND_ASSIGN(AwAutofillManagerDelegate); |
| 104 }; | 125 }; |
| 105 | 126 |
| 127 bool RegisterAwAutofillManagerDelegate(JNIEnv* env); | |
|
bulach
2013/06/26 17:35:19
nit: in some places we're using as static "Registe
sgurun-gerrit only
2013/06/26 23:48:46
I guess in webview, we generally use it this way (
| |
| 128 | |
| 106 } // namespace android_webview | 129 } // namespace android_webview |
| 107 | 130 |
| 108 #endif // ANDROID_WEBVIEW_BROWSER_AW_AUTOFILL_MANAGER_DELEGATE_H_ | 131 #endif // ANDROID_WEBVIEW_BROWSER_AW_AUTOFILL_MANAGER_DELEGATE_H_ |
| OLD | NEW |