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..9861ab546c180f7343b4b6155d5dc5682e43e462 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; |
| @@ -47,6 +49,7 @@ AwAutofillClient::AwAutofillClient(WebContents* contents) |
| Java_AwAutofillClient_create(env, reinterpret_cast<intptr_t>(this))); |
| AwContents* aw_contents = AwContents::FromWebContents(web_contents_); |
| + view_android_ = web_contents_->GetContentNativeView(); |
|
no sievers
2016/07/18 22:14:16
Sorry, I changed my mind after looking at the auto
Jinsuk Kim
2016/07/19 07:08:39
Done.
|
| aw_contents->SetAwAutofillClient(delegate.obj()); |
| java_ref_ = JavaObjectWeakGlobalRef(env, delegate.obj()); |
| } |
| @@ -134,13 +137,14 @@ void AwAutofillClient::ShowAutofillPopupImpl( |
| env, data_array.obj(), i, name.obj(), label.obj(), |
| suggestions[i].frontend_id); |
| } |
| - |
| + if (!anchor_view_) { |
| + anchor_view_.reset(view_android_->AcquireAnchorView()); |
| + } |
|
no sievers
2016/07/18 22:14:16
I'd handle |anchor_view_.view_.is_null()| here and
Jinsuk Kim
2016/07/19 07:08:39
Done.
|
| + view_android_->SetAnchorRect(anchor_view_->ref(), element_bounds); |
| Java_AwAutofillClient_showAutofillPopup(env, |
| obj.obj(), |
| - element_bounds.x(), |
| - element_bounds.y(), |
| + anchor_view_->obj(), |
| element_bounds.width(), |
| - element_bounds.height(), |
| is_rtl, |
| data_array.obj()); |
| } |
| @@ -203,6 +207,13 @@ bool AwAutofillClient::ShouldShowSigninPromo() { |
| void AwAutofillClient::StartSigninFlow() {} |
| +void AwAutofillClient::Dismissed(JNIEnv* env, |
| + const JavaParamRef<jobject>& obj) { |
| + if (anchor_view_) { |
| + anchor_view_.reset(); |
| + } |
| +} |
| + |
| void AwAutofillClient::SuggestionSelected(JNIEnv* env, |
| const JavaParamRef<jobject>& object, |
| jint position) { |