| OLD | NEW |
| 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 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 698 } | 698 } |
| 699 | 699 |
| 700 void AutofillManager::OnHidePopup() { | 700 void AutofillManager::OnHidePopup() { |
| 701 if (!IsAutofillEnabled()) | 701 if (!IsAutofillEnabled()) |
| 702 return; | 702 return; |
| 703 | 703 |
| 704 autocomplete_history_manager_->CancelPendingQuery(); | 704 autocomplete_history_manager_->CancelPendingQuery(); |
| 705 client_->HideAutofillPopup(); | 705 client_->HideAutofillPopup(); |
| 706 } | 706 } |
| 707 | 707 |
| 708 void AutofillManager::RemoveAutofillProfileOrCreditCard(int unique_id) { | 708 bool AutofillManager::RemoveAutofillProfileOrCreditCard(int unique_id) { |
| 709 std::string guid; | 709 std::string guid; |
| 710 size_t variant = 0; | 710 size_t variant = 0; |
| 711 const CreditCard* credit_card = nullptr; | 711 const CreditCard* credit_card = nullptr; |
| 712 const AutofillProfile* profile = nullptr; | 712 const AutofillProfile* profile = nullptr; |
| 713 if (GetCreditCard(unique_id, &credit_card)) { | 713 if (GetCreditCard(unique_id, &credit_card)) { |
| 714 if (credit_card->record_type() != CreditCard::LOCAL_CARD) |
| 715 return false; |
| 716 |
| 714 guid = credit_card->guid(); | 717 guid = credit_card->guid(); |
| 715 } else if (GetProfile(unique_id, &profile, &variant)) { | 718 } else if (GetProfile(unique_id, &profile, &variant)) { |
| 719 if (profile->record_type() != AutofillProfile::LOCAL_PROFILE) |
| 720 return false; |
| 721 |
| 716 guid = profile->guid(); | 722 guid = profile->guid(); |
| 717 } else { | 723 } else { |
| 718 NOTREACHED(); | 724 NOTREACHED(); |
| 719 return; | 725 return false; |
| 720 } | 726 } |
| 721 | 727 |
| 722 // TODO(csharp): If we are dealing with a variant only the variant should | 728 // TODO(csharp): If we are dealing with a variant only the variant should |
| 723 // be deleted, instead of doing nothing. | 729 // be deleted, instead of doing nothing. |
| 724 // http://crbug.com/124211 | 730 // http://crbug.com/124211 |
| 725 if (variant != 0) | 731 if (variant != 0) |
| 726 return; | 732 return false; |
| 727 | 733 |
| 728 personal_data_->RemoveByGUID(guid); | 734 personal_data_->RemoveByGUID(guid); |
| 735 return true; |
| 729 } | 736 } |
| 730 | 737 |
| 731 void AutofillManager::RemoveAutocompleteEntry(const base::string16& name, | 738 void AutofillManager::RemoveAutocompleteEntry(const base::string16& name, |
| 732 const base::string16& value) { | 739 const base::string16& value) { |
| 733 autocomplete_history_manager_->OnRemoveAutocompleteEntry(name, value); | 740 autocomplete_history_manager_->OnRemoveAutocompleteEntry(name, value); |
| 734 } | 741 } |
| 735 | 742 |
| 736 bool AutofillManager::IsShowingUnmaskPrompt() { | 743 bool AutofillManager::IsShowingUnmaskPrompt() { |
| 737 return unmasking_card_.Compare(CreditCard()) != 0; | 744 return unmasking_card_.Compare(CreditCard()) != 0; |
| 738 } | 745 } |
| (...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1497 return false; | 1504 return false; |
| 1498 | 1505 |
| 1499 // Disregard forms that we wouldn't ever autofill in the first place. | 1506 // Disregard forms that we wouldn't ever autofill in the first place. |
| 1500 if (!form.ShouldBeParsed()) | 1507 if (!form.ShouldBeParsed()) |
| 1501 return false; | 1508 return false; |
| 1502 | 1509 |
| 1503 return true; | 1510 return true; |
| 1504 } | 1511 } |
| 1505 | 1512 |
| 1506 } // namespace autofill | 1513 } // namespace autofill |
| OLD | NEW |