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 b376d9cc24bc7ef5b56cffdeb1afef7eb2759d5d..3f58221e00a5d0656cc5b980513bee63af811afe 100644 |
--- a/chrome/browser/ui/android/autofill/autofill_popup_view_android.cc |
+++ b/chrome/browser/ui/android/autofill/autofill_popup_view_android.cc |
@@ -25,7 +25,8 @@ namespace autofill { |
AutofillPopupViewAndroid::AutofillPopupViewAndroid( |
AutofillPopupController* controller) |
- : controller_(controller) {} |
+ : controller_(controller), |
+ deleting_index_(-1) {} |
AutofillPopupViewAndroid::~AutofillPopupViewAndroid() {} |
@@ -77,6 +78,8 @@ void AutofillPopupViewAndroid::UpdateBoundsAndRedrawPopup() { |
controller_->GetIconResourceID(suggestion.icon)); |
} |
+ bool deletable = |
+ controller_->GetRemovalConfirmationText(i, nullptr, nullptr); |
Java_AutofillPopupBridge_addToAutofillSuggestionArray( |
env, |
data_array.obj(), |
@@ -84,7 +87,8 @@ void AutofillPopupViewAndroid::UpdateBoundsAndRedrawPopup() { |
value.obj(), |
label.obj(), |
android_icon_id, |
- suggestion.frontend_id); |
+ suggestion.frontend_id, |
+ deletable); |
} |
Java_AutofillPopupBridge_show( |
@@ -99,6 +103,37 @@ void AutofillPopupViewAndroid::SuggestionSelected(JNIEnv* env, |
controller_->AcceptSuggestion(list_index); |
} |
+void AutofillPopupViewAndroid::DeletionRequested(JNIEnv* env, |
+ jobject obj, |
+ jint list_index) { |
+ if (!controller_) |
+ return; |
+ |
+ base::string16 confirmation_title, confirmation_body; |
+ if (!controller_->GetRemovalConfirmationText(list_index, &confirmation_title, |
+ &confirmation_body)) { |
+ return; |
+ } |
+ |
+ deleting_index_ = list_index; |
+ Java_AutofillPopupBridge_confirmDeletion( |
+ env, |
+ java_object_.obj(), |
+ base::android::ConvertUTF16ToJavaString( |
+ env, confirmation_title).obj(), |
+ base::android::ConvertUTF16ToJavaString( |
+ env, confirmation_body).obj()); |
+} |
+ |
+void AutofillPopupViewAndroid::DeletionConfirmed(JNIEnv* env, |
+ jobject obj) { |
+ if (!controller_) |
+ return; |
+ |
+ CHECK_GE(deleting_index_, 0); |
+ controller_->RemoveSuggestion(deleting_index_); |
+} |
+ |
void AutofillPopupViewAndroid::PopupDismissed(JNIEnv* env, jobject obj) { |
if (controller_) |
controller_->ViewDestroyed(); |