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..2e9ec03d4fdf99df4e98ef90ef2ded06bf88f494 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,23 @@ void AwAutofillClient::ShowAutofillPopupImpl( |
| env, data_array.obj(), i, name.obj(), label.obj(), |
| suggestions[i].frontend_id); |
| } |
| + ui::ViewAndroid* view_android = web_contents_->GetNativeView(); |
| + if (!view_android) |
| + return; |
| + |
| + const ScopedJavaLocalRef<jobject>& current_view = anchor_view_.view(); |
|
boliu
2016/07/29 20:05:15
this (and line 147) below is bad c++, you can't ta
Jinsuk Kim
2016/08/01 02:02:47
Embarrassing :) Fixed.
|
| + if (current_view.is_null()) |
| + anchor_view_ = view_android->AcquireAnchorView(); |
| + |
| + const ScopedJavaLocalRef<jobject>& view = anchor_view_.view(); |
| + if (view.is_null()) |
| + return; |
| + view_android->SetAnchorRect(view, element_bounds); |
| Java_AwAutofillClient_showAutofillPopup(env, |
| obj.obj(), |
| - element_bounds.x(), |
| - element_bounds.y(), |
| + anchor_view_.view().obj(), |
|
boliu
2016/07/29 20:05:15
view.obj()
Jinsuk Kim
2016/08/01 02:02:47
Done.
|
| element_bounds.width(), |
| - element_bounds.height(), |
| is_rtl, |
| data_array.obj()); |
| } |
| @@ -203,6 +215,11 @@ bool AwAutofillClient::ShouldShowSigninPromo() { |
| void AwAutofillClient::StartSigninFlow() {} |
| +void AwAutofillClient::Dismissed(JNIEnv* env, |
| + const JavaParamRef<jobject>& obj) { |
| + anchor_view_.Reset(); |
| +} |
| + |
| void AwAutofillClient::SuggestionSelected(JNIEnv* env, |
| const JavaParamRef<jobject>& object, |
| jint position) { |