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..5eaef31dc71ee5102e77035362ff10ff867a4386 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,11 @@ void AutofillPopupViewAndroid::Show() { |
| ui::ViewAndroid* view_android = controller_->container_view(); |
| DCHECK(view_android); |
| - |
| + popup_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.
|
| java_object_.Reset(Java_AutofillPopupBridge_create( |
| - env, reinterpret_cast<intptr_t>(this), |
| - view_android->GetWindowAndroid()->GetJavaObject().obj(), |
| - view_android->GetViewAndroidDelegate().obj())); |
| + env, popup_view_->obj(), controller_->element_bounds().width(), |
| + reinterpret_cast<intptr_t>(this), |
| + view_android->GetWindowAndroid()->GetJavaObject().obj())); |
| UpdateBoundsAndRedrawPopup(); |
| } |
| @@ -48,19 +48,18 @@ void AutofillPopupViewAndroid::Show() { |
| void AutofillPopupViewAndroid::Hide() { |
| controller_ = NULL; |
| JNIEnv* env = base::android::AttachCurrentThread(); |
| + popup_view_.reset(); |
|
no sievers
2016/07/18 22:14:16
See comment in password_generation_popup_view_andr
Jinsuk Kim
2016/07/19 07:08:39
Done. Removed it as we do not use unique_ptr any m
|
| Java_AutofillPopupBridge_dismiss(env, java_object_.obj()); |
| } |
| 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_->ref(), |
| + controller_->element_bounds()); |
| + |
| + JNIEnv* env = base::android::AttachCurrentThread(); |
| size_t count = controller_->GetLineCount(); |
| ScopedJavaLocalRef<jobjectArray> data_array = |
| Java_AutofillPopupBridge_createAutofillSuggestionArray(env, count); |
| @@ -137,8 +136,9 @@ void AutofillPopupViewAndroid::DeletionConfirmed( |
| void AutofillPopupViewAndroid::PopupDismissed( |
| JNIEnv* env, |
| const JavaParamRef<jobject>& obj) { |
| - if (controller_) |
| + if (controller_) { |
| controller_->ViewDestroyed(); |
| + } |
| delete this; |
| } |