Chromium Code Reviews| Index: chrome/browser/ui/android/autofill/autofill_popup_view_android.cc |
| diff --git a/chrome/browser/ui/android/autofill/autofill_popup_view_android.cc b/chrome/browser/ui/android/autofill/autofill_popup_view_android.cc |
| index 663bd8b4192cd476f878eb1a6532e5e2d65692fb..b69707319a64df8fc710ab3013f03fc5c10286d8 100644 |
| --- a/chrome/browser/ui/android/autofill/autofill_popup_view_android.cc |
| +++ b/chrome/browser/ui/android/autofill/autofill_popup_view_android.cc |
| @@ -36,11 +36,16 @@ void AutofillPopupViewAndroid::Show() { |
| ui::ViewAndroid* view_android = controller_->container_view(); |
| DCHECK(view_android); |
| + popup_view_ = view_android->AcquireAnchorView(); |
| + if (popup_view_.is_null()) |
| + return; |
| java_object_.Reset(Java_AutofillPopupBridge_create( |
| - env, reinterpret_cast<intptr_t>(this), |
| - view_android->GetWindowAndroid()->GetJavaObject().obj(), |
| - view_android->GetViewAndroidDelegate().obj())); |
| + env, popup_view_.view().obj(), controller_->element_bounds().width(), |
| + reinterpret_cast<intptr_t>(this), |
| + view_android->GetWindowAndroid()->GetJavaObject().obj())); |
| + if (java_object_.is_null()) |
|
no sievers
2016/07/19 22:29:30
nit: I'd not handle this since it's just a factory
Jinsuk Kim
2016/07/20 00:55:18
Done. Please see if the PopupDismissedInternal() l
|
| + return; |
| UpdateBoundsAndRedrawPopup(); |
| } |
| @@ -52,15 +57,13 @@ void AutofillPopupViewAndroid::Hide() { |
| } |
| void AutofillPopupViewAndroid::UpdateBoundsAndRedrawPopup() { |
| - JNIEnv* env = base::android::AttachCurrentThread(); |
| - Java_AutofillPopupBridge_setAnchorRect( |
| - env, |
| - java_object_.obj(), |
| - controller_->element_bounds().x(), |
| - controller_->element_bounds().y(), |
| - controller_->element_bounds().width(), |
| - controller_->element_bounds().height()); |
| + ui::ViewAndroid* view_android = controller_->container_view(); |
| + |
| + DCHECK(view_android); |
| + view_android->SetAnchorRect(popup_view_.view(), |
| + controller_->element_bounds()); |
| + JNIEnv* env = base::android::AttachCurrentThread(); |
| size_t count = controller_->GetLineCount(); |
| ScopedJavaLocalRef<jobjectArray> data_array = |
| Java_AutofillPopupBridge_createAutofillSuggestionArray(env, count); |