Chromium Code Reviews| Index: android_webview/native/aw_autofill_client.cc |
| diff --git a/android_webview/native/aw_autofill_client.cc b/android_webview/native/aw_autofill_client.cc |
| index 5c34dc4759ea2bd284dbfedcf28230e532e75a37..f5074812ee4f2783f64002193ca5765c72679800 100644 |
| --- a/android_webview/native/aw_autofill_client.cc |
| +++ b/android_webview/native/aw_autofill_client.cc |
| @@ -20,10 +20,12 @@ |
| #include "components/prefs/pref_service.h" |
| #include "components/prefs/pref_service_factory.h" |
| #include "components/user_prefs/user_prefs.h" |
| +#include "content/public/browser/android/content_view_core.h" |
| #include "content/public/browser/navigation_entry.h" |
| #include "content/public/browser/web_contents.h" |
| #include "content/public/common/ssl_status.h" |
| #include "jni/AwAutofillClient_jni.h" |
| +#include "ui/android/view_android.h" |
| #include "ui/gfx/geometry/rect_f.h" |
| using base::android::AttachCurrentThread; |
| @@ -134,13 +136,17 @@ void AwAutofillClient::ShowAutofillPopupImpl( |
| env, data_array.obj(), i, name.obj(), label.obj(), |
| suggestions[i].frontend_id); |
| } |
| + ui::ViewAndroid* view_android = web_contents_->GetNativeView(); |
| + if (anchor_view_.is_null()) |
| + anchor_view_ = view_android->AcquireAnchorView(); |
| + if (anchor_view_.is_null()) |
| + return; |
| + view_android->SetAnchorRect(anchor_view_.view(), element_bounds); |
| Java_AwAutofillClient_showAutofillPopup(env, |
| obj.obj(), |
| - element_bounds.x(), |
| - element_bounds.y(), |
| + anchor_view_.view().obj(), |
| element_bounds.width(), |
| - element_bounds.height(), |
| is_rtl, |
| data_array.obj()); |
| } |
| @@ -203,6 +209,14 @@ bool AwAutofillClient::ShouldShowSigninPromo() { |
| void AwAutofillClient::StartSigninFlow() {} |
| +void AwAutofillClient::Dismissed(JNIEnv* env, |
| + const JavaParamRef<jobject>& obj) { |
| + if (!anchor_view_.is_null()) { |
| + // Release the anchor view. |
| + anchor_view_ = ui::ViewAndroid::ScopedAnchorView(); |
|
no sievers
2016/07/19 22:29:30
nit: might be nice to add a Reset()/Release() meth
Jinsuk Kim
2016/07/20 00:55:18
Done.
|
| + } |
| +} |
| + |
| void AwAutofillClient::SuggestionSelected(JNIEnv* env, |
| const JavaParamRef<jobject>& object, |
| jint position) { |