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

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

Issue 1134793004: Autofill item deletion on android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: test fix Created 5 years, 7 months 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 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();

Powered by Google App Engine
This is Rietveld 408576698