Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1030)

Unified Diff: chrome/browser/ui/android/autofill/autofill_popup_view_android.cc

Issue 772253003: Create an autofill Suggestion class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 baf38d92a731cce6b0e343199bcd907381e4243e..5e4acdcec3b56b95b9aab2bd6c0affd5a2a91675 100644
--- a/chrome/browser/ui/android/autofill/autofill_popup_view_android.cc
+++ b/chrome/browser/ui/android/autofill/autofill_popup_view_android.cc
@@ -9,6 +9,7 @@
#include "chrome/browser/android/resource_mapper.h"
#include "chrome/browser/ui/android/window_android_helper.h"
#include "chrome/browser/ui/autofill/autofill_popup_controller.h"
+#include "components/autofill/core/browser/suggestion.h"
#include "content/public/browser/android/content_view_core.h"
#include "jni/AutofillPopupBridge_jni.h"
#include "ui/base/android/view_android.h"
@@ -56,32 +57,32 @@ void AutofillPopupViewAndroid::UpdateBoundsAndRedrawPopup() {
controller_->element_bounds().width(),
controller_->element_bounds().height());
- // We need an array of AutofillSuggestion.
- size_t count = controller_->names().size();
-
+ size_t count = controller_->GetLineCount();
ScopedJavaLocalRef<jobjectArray> data_array =
Java_AutofillPopupBridge_createAutofillSuggestionArray(env, count);
for (size_t i = 0; i < count; ++i) {
- ScopedJavaLocalRef<jstring> name =
- base::android::ConvertUTF16ToJavaString(env, controller_->names()[i]);
- ScopedJavaLocalRef<jstring> subtext =
- base::android::ConvertUTF16ToJavaString(env,
- controller_->subtexts()[i]);
+ ScopedJavaLocalRef<jstring> value = base::android::ConvertUTF16ToJavaString(
+ env, controller_->GetElidedValueAt(i));
+ ScopedJavaLocalRef<jstring> label =
+ base::android::ConvertUTF16ToJavaString(
+ env, controller_->GetElidedLabelAt(i));
int android_icon_id = 0;
- if (!controller_->icons()[i].empty()) {
+
+ const autofill::Suggestion& suggestion = controller_->GetSuggestionAt(i);
+ if (!suggestion.icon.empty()) {
android_icon_id = ResourceMapper::MapFromChromiumId(
- controller_->GetIconResourceID(controller_->icons()[i]));
+ controller_->GetIconResourceID(suggestion.icon));
}
Java_AutofillPopupBridge_addToAutofillSuggestionArray(
env,
data_array.obj(),
i,
- name.obj(),
- subtext.obj(),
+ value.obj(),
+ label.obj(),
android_icon_id,
- controller_->identifiers()[i]);
+ suggestion.frontend_id);
}
Java_AutofillPopupBridge_show(

Powered by Google App Engine
This is Rietveld 408576698