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 afe08ec5db622351f6bfc781dde52dad478f48d1..bc056e33b0ab64274bdafbe75e282fb59cc130d8 100644 |
--- a/android_webview/native/aw_autofill_client.cc |
+++ b/android_webview/native/aw_autofill_client.cc |
@@ -17,6 +17,7 @@ |
#include "base/prefs/pref_service.h" |
#include "base/prefs/pref_service_factory.h" |
#include "components/autofill/core/browser/autofill_popup_delegate.h" |
+#include "components/autofill/core/browser/suggestion.h" |
#include "components/autofill/core/browser/webdata/autofill_webdata_service.h" |
#include "components/autofill/core/common/autofill_pref_names.h" |
#include "components/user_prefs/user_prefs.h" |
@@ -80,13 +81,9 @@ AwAutofillClient::GetDatabase() { |
void AwAutofillClient::ShowAutofillPopup( |
const gfx::RectF& element_bounds, |
base::i18n::TextDirection text_direction, |
- const std::vector<base::string16>& values, |
- const std::vector<base::string16>& labels, |
- const std::vector<base::string16>& icons, |
- const std::vector<int>& identifiers, |
+ const std::vector<autofill::Suggestion>& suggestions, |
base::WeakPtr<autofill::AutofillPopupDelegate> delegate) { |
- values_ = values; |
- identifiers_ = identifiers; |
+ suggestions_ = suggestions; |
delegate_ = delegate; |
// Convert element_bounds to be in screen space. |
@@ -96,34 +93,32 @@ void AwAutofillClient::ShowAutofillPopup( |
ShowAutofillPopupImpl(element_bounds_in_screen_space, |
text_direction == base::i18n::RIGHT_TO_LEFT, |
- values, |
- labels, |
- identifiers); |
+ suggestions); |
} |
void AwAutofillClient::ShowAutofillPopupImpl( |
const gfx::RectF& element_bounds, |
bool is_rtl, |
- const std::vector<base::string16>& values, |
- const std::vector<base::string16>& labels, |
- const std::vector<int>& identifiers) { |
+ const std::vector<autofill::Suggestion>& suggestions) { |
JNIEnv* env = AttachCurrentThread(); |
ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
if (obj.is_null()) |
return; |
// We need an array of AutofillSuggestion. |
- size_t count = values.size(); |
+ size_t count = suggestions.size(); |
ScopedJavaLocalRef<jobjectArray> data_array = |
Java_AwAutofillClient_createAutofillSuggestionArray(env, count); |
for (size_t i = 0; i < count; ++i) { |
- ScopedJavaLocalRef<jstring> name = ConvertUTF16ToJavaString(env, values[i]); |
+ ScopedJavaLocalRef<jstring> name = |
+ ConvertUTF16ToJavaString(env, suggestions[i].value); |
ScopedJavaLocalRef<jstring> label = |
- ConvertUTF16ToJavaString(env, labels[i]); |
+ ConvertUTF16ToJavaString(env, suggestions[i].label); |
Java_AwAutofillClient_addToAutofillSuggestionArray( |
- env, data_array.obj(), i, name.obj(), label.obj(), identifiers[i]); |
+ env, data_array.obj(), i, name.obj(), label.obj(), |
+ suggestions[i].frontend_id); |
} |
Java_AwAutofillClient_showAutofillPopup(env, |
@@ -175,8 +170,10 @@ void AwAutofillClient::OnFirstUserGestureObserved() { |
void AwAutofillClient::SuggestionSelected(JNIEnv* env, |
jobject object, |
jint position) { |
- if (delegate_) |
- delegate_->DidAcceptSuggestion(values_[position], identifiers_[position]); |
+ if (delegate_) { |
+ delegate_->DidAcceptSuggestion(suggestions_[position].value, |
+ suggestions_[position].frontend_id); |
+ } |
} |
void AwAutofillClient::HideRequestAutocompleteDialog() { |