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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/autofill/core/browser/autofill_manager.h" 5 #include "components/autofill/core/browser/autofill_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <limits> 9 #include <limits>
10 #include <map> 10 #include <map>
(...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after
693 } 693 }
694 694
695 void AutofillManager::OnHidePopup() { 695 void AutofillManager::OnHidePopup() {
696 if (!IsAutofillEnabled()) 696 if (!IsAutofillEnabled())
697 return; 697 return;
698 698
699 autocomplete_history_manager_->CancelPendingQuery(); 699 autocomplete_history_manager_->CancelPendingQuery();
700 client_->HideAutofillPopup(); 700 client_->HideAutofillPopup();
701 } 701 }
702 702
703 bool AutofillManager::GetDeletionConfirmationText(const base::string16& value,
704 int identifier,
705 base::string16* title,
706 base::string16* body) {
707 if (identifier == POPUP_ITEM_ID_AUTOCOMPLETE_ENTRY) {
708 if (title)
709 title->assign(value);
710 if (body) {
711 body->assign(l10n_util::GetStringUTF16(
712 IDS_AUTOFILL_DELETE_AUTOCOMPLETE_SUGGESTION_CONFIRMATION_BODY));
713 }
714
715 return true;
716 }
717
718 if (identifier < 0)
719 return false;
720
721 size_t variant = 0;
722 const CreditCard* credit_card = nullptr;
723 const AutofillProfile* profile = nullptr;
724 if (GetCreditCard(identifier, &credit_card)) {
725 if (credit_card->record_type() != CreditCard::LOCAL_CARD)
726 return false;
727
728 if (title)
729 title->assign(credit_card->TypeAndLastFourDigits());
730 if (body) {
731 body->assign(l10n_util::GetStringUTF16(
732 IDS_AUTOFILL_DELETE_CREDIT_CARD_SUGGESTION_CONFIRMATION_BODY));
733 }
734
735 return true;
736 } else if (GetProfile(identifier, &profile, &variant)) {
737 if (profile->record_type() != AutofillProfile::LOCAL_PROFILE)
738 return false;
739
740 if (title) {
741 base::string16 street_address = profile->GetRawInfo(ADDRESS_HOME_CITY);
742 if (!street_address.empty())
743 title->swap(street_address);
744 else
745 title->assign(value);
746 }
747 if (body) {
748 body->assign(l10n_util::GetStringUTF16(
749 IDS_AUTOFILL_DELETE_PROFILE_SUGGESTION_CONFIRMATION_BODY));
750 }
751
752 return true;
753 }
754
755 NOTREACHED();
756 return false;
757 }
758
703 bool AutofillManager::RemoveAutofillProfileOrCreditCard(int unique_id) { 759 bool AutofillManager::RemoveAutofillProfileOrCreditCard(int unique_id) {
704 std::string guid; 760 std::string guid;
705 size_t variant = 0; 761 size_t variant = 0;
706 const CreditCard* credit_card = nullptr; 762 const CreditCard* credit_card = nullptr;
707 const AutofillProfile* profile = nullptr; 763 const AutofillProfile* profile = nullptr;
708 if (GetCreditCard(unique_id, &credit_card)) { 764 if (GetCreditCard(unique_id, &credit_card)) {
709 if (credit_card->record_type() != CreditCard::LOCAL_CARD) 765 if (credit_card->record_type() != CreditCard::LOCAL_CARD)
710 return false; 766 return false;
711 767
712 guid = credit_card->guid(); 768 guid = credit_card->guid();
(...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after
1511 return false; 1567 return false;
1512 1568
1513 // Disregard forms that we wouldn't ever autofill in the first place. 1569 // Disregard forms that we wouldn't ever autofill in the first place.
1514 if (!form.ShouldBeParsed()) 1570 if (!form.ShouldBeParsed())
1515 return false; 1571 return false;
1516 1572
1517 return true; 1573 return true;
1518 } 1574 }
1519 1575
1520 } // namespace autofill 1576 } // namespace autofill
OLDNEW
« 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