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

Unified Diff: components/autofill/core/browser/autofill_manager.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: components/autofill/core/browser/autofill_manager.cc
diff --git a/components/autofill/core/browser/autofill_manager.cc b/components/autofill/core/browser/autofill_manager.cc
index 5df3ca14bda7fa0fee2dde5a92456f091613c803..f5040f9fabc2f4ae3921ce65eb525f02fd9fbbe8 100644
--- a/components/autofill/core/browser/autofill_manager.cc
+++ b/components/autofill/core/browser/autofill_manager.cc
@@ -700,6 +700,62 @@ void AutofillManager::OnHidePopup() {
client_->HideAutofillPopup();
}
+bool AutofillManager::GetDeletionConfirmationText(const base::string16& value,
+ int identifier,
+ base::string16* title,
+ base::string16* body) {
+ if (identifier == POPUP_ITEM_ID_AUTOCOMPLETE_ENTRY) {
+ if (title)
+ title->assign(value);
+ if (body) {
+ body->assign(l10n_util::GetStringUTF16(
+ IDS_AUTOFILL_DELETE_AUTOCOMPLETE_SUGGESTION_CONFIRMATION_BODY));
+ }
+
+ return true;
+ }
+
+ if (identifier < 0)
+ return false;
+
+ size_t variant = 0;
+ const CreditCard* credit_card = nullptr;
+ const AutofillProfile* profile = nullptr;
+ if (GetCreditCard(identifier, &credit_card)) {
+ if (credit_card->record_type() != CreditCard::LOCAL_CARD)
+ return false;
+
+ if (title)
+ title->assign(credit_card->TypeAndLastFourDigits());
+ if (body) {
+ body->assign(l10n_util::GetStringUTF16(
+ IDS_AUTOFILL_DELETE_CREDIT_CARD_SUGGESTION_CONFIRMATION_BODY));
+ }
+
+ return true;
+ } else if (GetProfile(identifier, &profile, &variant)) {
+ if (profile->record_type() != AutofillProfile::LOCAL_PROFILE)
+ return false;
+
+ if (title) {
+ base::string16 street_address = profile->GetRawInfo(ADDRESS_HOME_CITY);
+ if (!street_address.empty())
+ title->swap(street_address);
+ else
+ title->assign(value);
+ }
+ if (body) {
+ body->assign(l10n_util::GetStringUTF16(
+ IDS_AUTOFILL_DELETE_PROFILE_SUGGESTION_CONFIRMATION_BODY));
+ }
+
+ return true;
+ }
+
+ NOTREACHED();
+ return false;
+}
+
bool AutofillManager::RemoveAutofillProfileOrCreditCard(int unique_id) {
std::string guid;
size_t variant = 0;
« no previous file with comments | « components/autofill/core/browser/autofill_manager.h ('k') | components/autofill/core/browser/autofill_popup_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698