| 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 ANDROID_WEBVIEW_NATIVE_AW_AUTOFILL_CLIENT_H_ | 5 #ifndef ANDROID_WEBVIEW_NATIVE_AW_AUTOFILL_CLIENT_H_ |
| 6 #define ANDROID_WEBVIEW_NATIVE_AW_AUTOFILL_CLIENT_H_ | 6 #define ANDROID_WEBVIEW_NATIVE_AW_AUTOFILL_CLIENT_H_ |
| 7 | 7 |
| 8 #include <jni.h> | 8 #include <jni.h> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 // Manager delegate for the autofill functionality. Android webview | 43 // Manager delegate for the autofill functionality. Android webview |
| 44 // supports enabling autocomplete feature for each webview instance | 44 // supports enabling autocomplete feature for each webview instance |
| 45 // (different than the browser which supports enabling/disabling for | 45 // (different than the browser which supports enabling/disabling for |
| 46 // a profile). Since there is only one pref service for a given browser | 46 // a profile). Since there is only one pref service for a given browser |
| 47 // context, we cannot enable this feature via UserPrefs. Rather, we always | 47 // context, we cannot enable this feature via UserPrefs. Rather, we always |
| 48 // keep the feature enabled at the pref service, and control it via | 48 // keep the feature enabled at the pref service, and control it via |
| 49 // the delegates. | 49 // the delegates. |
| 50 class AwAutofillClient : public autofill::AutofillClient, | 50 class AwAutofillClient : public autofill::AutofillClient, |
| 51 public content::WebContentsUserData<AwAutofillClient> { | 51 public content::WebContentsUserData<AwAutofillClient> { |
| 52 public: | 52 public: |
| 53 virtual ~AwAutofillClient(); | 53 ~AwAutofillClient() override; |
| 54 | 54 |
| 55 void SetSaveFormData(bool enabled); | 55 void SetSaveFormData(bool enabled); |
| 56 bool GetSaveFormData(); | 56 bool GetSaveFormData(); |
| 57 | 57 |
| 58 // AutofillClient: | 58 // AutofillClient: |
| 59 virtual autofill::PersonalDataManager* GetPersonalDataManager() override; | 59 autofill::PersonalDataManager* GetPersonalDataManager() override; |
| 60 virtual scoped_refptr<autofill::AutofillWebDataService> GetDatabase() | 60 scoped_refptr<autofill::AutofillWebDataService> GetDatabase() override; |
| 61 override; | 61 PrefService* GetPrefs() override; |
| 62 virtual PrefService* GetPrefs() override; | |
| 63 IdentityProvider* GetIdentityProvider() override; | 62 IdentityProvider* GetIdentityProvider() override; |
| 64 virtual void HideRequestAutocompleteDialog() override; | 63 void HideRequestAutocompleteDialog() override; |
| 65 virtual void ShowAutofillSettings() override; | 64 void ShowAutofillSettings() override; |
| 66 virtual void ShowUnmaskPrompt( | 65 void ShowUnmaskPrompt( |
| 67 const autofill::CreditCard& card, | 66 const autofill::CreditCard& card, |
| 68 base::WeakPtr<autofill::CardUnmaskDelegate> delegate) override; | 67 base::WeakPtr<autofill::CardUnmaskDelegate> delegate) override; |
| 69 virtual void OnUnmaskVerificationResult(bool success) override; | 68 void OnUnmaskVerificationResult(bool success) override; |
| 70 virtual void ConfirmSaveCreditCard( | 69 void ConfirmSaveCreditCard(const base::Closure& save_card_callback) override; |
| 71 const base::Closure& save_card_callback) override; | 70 bool HasCreditCardScanFeature() override; |
| 72 virtual bool HasCreditCardScanFeature() override; | 71 void ScanCreditCard(const CreditCardScanCallback& callback) override; |
| 73 virtual void ScanCreditCard(const CreditCardScanCallback& callback) override; | 72 void ShowRequestAutocompleteDialog(const autofill::FormData& form, |
| 74 virtual void ShowRequestAutocompleteDialog( | 73 content::RenderFrameHost* rfh, |
| 75 const autofill::FormData& form, | 74 const ResultCallback& callback) override; |
| 76 content::RenderFrameHost* rfh, | 75 void ShowAutofillPopup( |
| 77 const ResultCallback& callback) override; | |
| 78 virtual void ShowAutofillPopup( | |
| 79 const gfx::RectF& element_bounds, | 76 const gfx::RectF& element_bounds, |
| 80 base::i18n::TextDirection text_direction, | 77 base::i18n::TextDirection text_direction, |
| 81 const std::vector<autofill::Suggestion>& suggestions, | 78 const std::vector<autofill::Suggestion>& suggestions, |
| 82 base::WeakPtr<autofill::AutofillPopupDelegate> delegate) override; | 79 base::WeakPtr<autofill::AutofillPopupDelegate> delegate) override; |
| 83 virtual void UpdateAutofillPopupDataListValues( | 80 void UpdateAutofillPopupDataListValues( |
| 84 const std::vector<base::string16>& values, | 81 const std::vector<base::string16>& values, |
| 85 const std::vector<base::string16>& labels) override; | 82 const std::vector<base::string16>& labels) override; |
| 86 virtual void HideAutofillPopup() override; | 83 void HideAutofillPopup() override; |
| 87 virtual bool IsAutocompleteEnabled() override; | 84 bool IsAutocompleteEnabled() override; |
| 88 virtual void DetectAccountCreationForms( | 85 void DetectAccountCreationForms( |
| 89 content::RenderFrameHost* rfh, | 86 content::RenderFrameHost* rfh, |
| 90 const std::vector<autofill::FormStructure*>& forms) override; | 87 const std::vector<autofill::FormStructure*>& forms) override; |
| 91 virtual void DidFillOrPreviewField( | 88 void DidFillOrPreviewField(const base::string16& autofilled_value, |
| 92 const base::string16& autofilled_value, | 89 const base::string16& profile_full_name) override; |
| 93 const base::string16& profile_full_name) override; | 90 void OnFirstUserGestureObserved() override; |
| 94 virtual void OnFirstUserGestureObserved() override; | 91 void LinkClicked(const GURL& url, WindowOpenDisposition disposition) override; |
| 95 virtual void LinkClicked(const GURL& url, | |
| 96 WindowOpenDisposition disposition) override; | |
| 97 | 92 |
| 98 void SuggestionSelected(JNIEnv* env, jobject obj, jint position); | 93 void SuggestionSelected(JNIEnv* env, jobject obj, jint position); |
| 99 | 94 |
| 100 private: | 95 private: |
| 101 AwAutofillClient(content::WebContents* web_contents); | 96 AwAutofillClient(content::WebContents* web_contents); |
| 102 friend class content::WebContentsUserData<AwAutofillClient>; | 97 friend class content::WebContentsUserData<AwAutofillClient>; |
| 103 | 98 |
| 104 void ShowAutofillPopupImpl( | 99 void ShowAutofillPopupImpl( |
| 105 const gfx::RectF& element_bounds, | 100 const gfx::RectF& element_bounds, |
| 106 bool is_rtl, | 101 bool is_rtl, |
| 107 const std::vector<autofill::Suggestion>& suggestions); | 102 const std::vector<autofill::Suggestion>& suggestions); |
| 108 | 103 |
| 109 // The web_contents associated with this delegate. | 104 // The web_contents associated with this delegate. |
| 110 content::WebContents* web_contents_; | 105 content::WebContents* web_contents_; |
| 111 bool save_form_data_; | 106 bool save_form_data_; |
| 112 JavaObjectWeakGlobalRef java_ref_; | 107 JavaObjectWeakGlobalRef java_ref_; |
| 113 | 108 |
| 114 // The current Autofill query values. | 109 // The current Autofill query values. |
| 115 std::vector<autofill::Suggestion> suggestions_; | 110 std::vector<autofill::Suggestion> suggestions_; |
| 116 base::WeakPtr<autofill::AutofillPopupDelegate> delegate_; | 111 base::WeakPtr<autofill::AutofillPopupDelegate> delegate_; |
| 117 | 112 |
| 118 DISALLOW_COPY_AND_ASSIGN(AwAutofillClient); | 113 DISALLOW_COPY_AND_ASSIGN(AwAutofillClient); |
| 119 }; | 114 }; |
| 120 | 115 |
| 121 bool RegisterAwAutofillClient(JNIEnv* env); | 116 bool RegisterAwAutofillClient(JNIEnv* env); |
| 122 | 117 |
| 123 } // namespace android_webview | 118 } // namespace android_webview |
| 124 | 119 |
| 125 #endif // ANDROID_WEBVIEW_NATIVE_AW_AUTOFILL_CLIENT_H_ | 120 #endif // ANDROID_WEBVIEW_NATIVE_AW_AUTOFILL_CLIENT_H_ |
| OLD | NEW |