OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/ui/webui/options/autofill_options_handler.h" | 5 #include "chrome/browser/ui/webui/options/autofill_options_handler.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
690 if (!IsPersonalDataLoaded()) | 690 if (!IsPersonalDataLoaded()) |
691 return; | 691 return; |
692 | 692 |
693 scoped_ptr<base::ListValue> list_value = ValidatePhoneArguments(args); | 693 scoped_ptr<base::ListValue> list_value = ValidatePhoneArguments(args); |
694 | 694 |
695 web_ui()->CallJavascriptFunction( | 695 web_ui()->CallJavascriptFunction( |
696 "AutofillEditAddressOverlay.setValidatedPhoneNumbers", *list_value); | 696 "AutofillEditAddressOverlay.setValidatedPhoneNumbers", *list_value); |
697 } | 697 } |
698 | 698 |
699 void AutofillOptionsHandler::RemaskServerCards(const base::ListValue* args) { | 699 void AutofillOptionsHandler::RemaskServerCards(const base::ListValue* args) { |
700 const std::vector<CreditCard*>& cards = personal_data_->GetCreditCards(); | 700 personal_data_->ResetFullServerCards(); |
701 for (const auto card : cards) { | |
702 CreditCard card_copy = *card; | |
703 if (card_copy.record_type() == CreditCard::FULL_SERVER_CARD) { | |
704 card_copy.set_record_type(CreditCard::MASKED_SERVER_CARD); | |
705 card_copy.SetNumber(card->LastFourDigits()); | |
706 personal_data_->UpdateServerCreditCard(card_copy); | |
707 } | |
708 } | |
709 } | 701 } |
710 | 702 |
711 bool AutofillOptionsHandler::IsPersonalDataLoaded() const { | 703 bool AutofillOptionsHandler::IsPersonalDataLoaded() const { |
712 return personal_data_ && personal_data_->IsDataLoaded(); | 704 return personal_data_ && personal_data_->IsDataLoaded(); |
713 } | 705 } |
714 | 706 |
715 // static | 707 // static |
716 void AutofillOptionsHandler::AutofillProfileToDictionary( | 708 void AutofillOptionsHandler::AutofillProfileToDictionary( |
717 const autofill::AutofillProfile& profile, | 709 const autofill::AutofillProfile& profile, |
718 base::DictionaryValue* address) { | 710 base::DictionaryValue* address) { |
(...skipping 27 matching lines...) Expand all Loading... |
746 scoped_ptr<base::ListValue> components(new base::ListValue); | 738 scoped_ptr<base::ListValue> components(new base::ListValue); |
747 GetAddressComponents( | 739 GetAddressComponents( |
748 base::UTF16ToUTF8(profile.GetRawInfo(autofill::ADDRESS_HOME_COUNTRY)), | 740 base::UTF16ToUTF8(profile.GetRawInfo(autofill::ADDRESS_HOME_COUNTRY)), |
749 profile.language_code(), | 741 profile.language_code(), |
750 components.get(), | 742 components.get(), |
751 NULL); | 743 NULL); |
752 address->Set(kComponents, components.release()); | 744 address->Set(kComponents, components.release()); |
753 } | 745 } |
754 | 746 |
755 } // namespace options | 747 } // namespace options |
OLD | NEW |