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 |
11 #include "base/android/jni_weak_ref.h" | 11 #include "base/android/jni_weak_ref.h" |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "components/autofill/core/browser/autofill_client.h" | 14 #include "components/autofill/core/browser/autofill_client.h" |
15 #include "components/prefs/pref_registry_simple.h" | 15 #include "components/prefs/pref_registry_simple.h" |
16 #include "components/prefs/pref_service_factory.h" | 16 #include "components/prefs/pref_service_factory.h" |
17 #include "content/public/browser/web_contents_user_data.h" | 17 #include "content/public/browser/web_contents_user_data.h" |
18 #include "ui/android/view_android.h" | |
18 | 19 |
19 namespace autofill { | 20 namespace autofill { |
20 class AutofillMetrics; | 21 class AutofillMetrics; |
21 class AutofillPopupDelegate; | 22 class AutofillPopupDelegate; |
22 class CardUnmaskDelegate; | 23 class CardUnmaskDelegate; |
23 class CreditCard; | 24 class CreditCard; |
24 class FormStructure; | 25 class FormStructure; |
25 class PasswordGenerator; | 26 class PasswordGenerator; |
26 class PersonalDataManager; | 27 class PersonalDataManager; |
27 struct FormData; | 28 struct FormData; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
95 void PropagateAutofillPredictions( | 96 void PropagateAutofillPredictions( |
96 content::RenderFrameHost* rfh, | 97 content::RenderFrameHost* rfh, |
97 const std::vector<autofill::FormStructure*>& forms) override; | 98 const std::vector<autofill::FormStructure*>& forms) override; |
98 void DidFillOrPreviewField(const base::string16& autofilled_value, | 99 void DidFillOrPreviewField(const base::string16& autofilled_value, |
99 const base::string16& profile_full_name) override; | 100 const base::string16& profile_full_name) override; |
100 void OnFirstUserGestureObserved() override; | 101 void OnFirstUserGestureObserved() override; |
101 bool IsContextSecure(const GURL& form_origin) override; | 102 bool IsContextSecure(const GURL& form_origin) override; |
102 bool ShouldShowSigninPromo() override; | 103 bool ShouldShowSigninPromo() override; |
103 void StartSigninFlow() override; | 104 void StartSigninFlow() override; |
104 | 105 |
106 void Dismissed(JNIEnv* env, | |
107 const base::android::JavaParamRef<jobject>& obj); | |
105 void SuggestionSelected(JNIEnv* env, | 108 void SuggestionSelected(JNIEnv* env, |
106 const base::android::JavaParamRef<jobject>& obj, | 109 const base::android::JavaParamRef<jobject>& obj, |
107 jint position); | 110 jint position); |
108 | 111 |
109 private: | 112 private: |
110 AwAutofillClient(content::WebContents* web_contents); | 113 AwAutofillClient(content::WebContents* web_contents); |
111 friend class content::WebContentsUserData<AwAutofillClient>; | 114 friend class content::WebContentsUserData<AwAutofillClient>; |
112 | 115 |
113 void ShowAutofillPopupImpl( | 116 void ShowAutofillPopupImpl( |
114 const gfx::RectF& element_bounds, | 117 const gfx::RectF& element_bounds, |
115 bool is_rtl, | 118 bool is_rtl, |
116 const std::vector<autofill::Suggestion>& suggestions); | 119 const std::vector<autofill::Suggestion>& suggestions); |
117 | 120 |
118 // The web_contents associated with this delegate. | 121 // The web_contents associated with this delegate. |
119 content::WebContents* web_contents_; | 122 content::WebContents* web_contents_; |
120 bool save_form_data_; | 123 bool save_form_data_; |
121 JavaObjectWeakGlobalRef java_ref_; | 124 JavaObjectWeakGlobalRef java_ref_; |
122 | 125 |
126 ui::ViewAndroid::ScopedAnchorView anchor_view_; | |
boliu
2016/07/25 22:15:26
another gc root, what's the lifetime guanratee her
no sievers
2016/07/25 22:24:40
For the View or the Delegate?
The whole point is
boliu
2016/07/25 22:29:24
View, which has parent references back to the whol
boliu
2016/07/25 22:33:34
Actually delegate too. The delegate is holding str
| |
127 | |
123 // The current Autofill query values. | 128 // The current Autofill query values. |
124 std::vector<autofill::Suggestion> suggestions_; | 129 std::vector<autofill::Suggestion> suggestions_; |
125 base::WeakPtr<autofill::AutofillPopupDelegate> delegate_; | 130 base::WeakPtr<autofill::AutofillPopupDelegate> delegate_; |
126 | 131 |
127 DISALLOW_COPY_AND_ASSIGN(AwAutofillClient); | 132 DISALLOW_COPY_AND_ASSIGN(AwAutofillClient); |
128 }; | 133 }; |
129 | 134 |
130 bool RegisterAwAutofillClient(JNIEnv* env); | 135 bool RegisterAwAutofillClient(JNIEnv* env); |
131 | 136 |
132 } // namespace android_webview | 137 } // namespace android_webview |
133 | 138 |
134 #endif // ANDROID_WEBVIEW_NATIVE_AW_AUTOFILL_CLIENT_H_ | 139 #endif // ANDROID_WEBVIEW_NATIVE_AW_AUTOFILL_CLIENT_H_ |
OLD | NEW |