| 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 3abf4449f05e51cc2160eed6a9d57342addb47e6..94c1d408f361c5536f4dd28b2c8764f0b10a1bfb 100644
|
| --- a/chrome/browser/ui/android/autofill/autofill_popup_view_android.cc
|
| +++ b/chrome/browser/ui/android/autofill/autofill_popup_view_android.cc
|
| @@ -10,11 +10,10 @@
|
| #include "chrome/browser/ui/autofill/autofill_popup_controller.h"
|
| #include "content/public/browser/android/content_view_core.h"
|
| #include "jni/AutofillPopupGlue_jni.h"
|
| +#include "ui/android/view_android.h"
|
| #include "ui/gfx/android/window_android.h"
|
| #include "ui/gfx/rect.h"
|
|
|
| -using base::android::MethodID;
|
| -
|
| namespace autofill {
|
|
|
| AutofillPopupViewAndroid::AutofillPopupViewAndroid(
|
| @@ -25,13 +24,15 @@ AutofillPopupViewAndroid::~AutofillPopupViewAndroid() {}
|
|
|
| void AutofillPopupViewAndroid::Show() {
|
| JNIEnv* env = base::android::AttachCurrentThread();
|
| - content::ContentViewCore* content_view_core = controller_->container_view();
|
| + ui::ViewAndroid* view_android = controller_->container_view();
|
| +
|
| + DCHECK(view_android);
|
|
|
| java_object_.Reset(Java_AutofillPopupGlue_create(
|
| env,
|
| reinterpret_cast<jint>(this),
|
| - content_view_core->GetWindowAndroid()->GetJavaObject().obj(),
|
| - content_view_core->GetContainerViewDelegate().obj()));
|
| + view_android->GetWindowAndroid()->GetJavaObject().obj(),
|
| + view_android->GetJavaObject().obj()));
|
|
|
| UpdateBoundsAndRedrawPopup();
|
| }
|
| @@ -54,28 +55,24 @@ void AutofillPopupViewAndroid::UpdateBoundsAndRedrawPopup() {
|
| controller_->element_bounds().height());
|
|
|
| // We need an array of AutofillSuggestion.
|
| - ScopedJavaLocalRef<jclass> autofill_suggestion_clazz =
|
| - base::android::GetClass(env,
|
| - "org/chromium/chrome/browser/autofill/AutofillSuggestion");
|
| - ScopedJavaLocalRef<jobjectArray> data_array(env,
|
| - env->NewObjectArray(controller_->names().size(),
|
| - autofill_suggestion_clazz.obj(), NULL));
|
| - base::android::CheckException(env);
|
| - for (size_t i = 0; i < controller_->names().size(); ++i) {
|
| + size_t count = controller_->names().size();
|
| +
|
| + ScopedJavaLocalRef<jobjectArray> data_array =
|
| + Java_AutofillPopupGlue_createAutofillSuggestionArray(env, count);
|
| +
|
| + for (size_t i = 0; i < count; ++i) {
|
| ScopedJavaLocalRef<jstring> name =
|
| - base::android::ConvertUTF16ToJavaString(
|
| - env, controller_->names()[i]);
|
| + base::android::ConvertUTF16ToJavaString(env, controller_->names()[i]);
|
| ScopedJavaLocalRef<jstring> subtext =
|
| - base::android::ConvertUTF16ToJavaString(
|
| - env, controller_->subtexts()[i]);
|
| - int identifier = controller_->identifiers()[i];
|
| - ScopedJavaLocalRef<jobject> data =
|
| - Java_AutofillPopupGlue_createAutofillSuggestion(env,
|
| - name.obj(),
|
| - subtext.obj(),
|
| - identifier);
|
| - env->SetObjectArrayElement(data_array.obj(), i, data.obj());
|
| - base::android::CheckException(env);
|
| + base::android::ConvertUTF16ToJavaString(env,
|
| + controller_->subtexts()[i]);
|
| + Java_AutofillPopupGlue_addToAutofillSuggestionArray(
|
| + env,
|
| + data_array.obj(),
|
| + i,
|
| + name.obj(),
|
| + subtext.obj(),
|
| + controller_->identifiers()[i]);
|
| }
|
|
|
| Java_AutofillPopupGlue_show(env, java_object_.obj(), data_array.obj());
|
|
|