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 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 for (size_t i = 0; i < profiles.size(); ++i) { | 453 for (size_t i = 0; i < profiles.size(); ++i) { |
454 base::ListValue* entry = new base::ListValue(); | 454 base::ListValue* entry = new base::ListValue(); |
455 entry->Append(new base::StringValue(profiles[i]->guid())); | 455 entry->Append(new base::StringValue(profiles[i]->guid())); |
456 entry->Append(new base::StringValue(labels[i])); | 456 entry->Append(new base::StringValue(labels[i])); |
457 addresses.Append(entry); | 457 addresses.Append(entry); |
458 } | 458 } |
459 | 459 |
460 web_ui()->CallJavascriptFunction("AutofillOptions.setAddressList", addresses); | 460 web_ui()->CallJavascriptFunction("AutofillOptions.setAddressList", addresses); |
461 | 461 |
462 base::ListValue credit_cards; | 462 base::ListValue credit_cards; |
463 const std::vector<CreditCard*>& cards = personal_data_->GetCreditCards(); | 463 const std::vector<CreditCard*>& cards = personal_data_->GetLocalCreditCards(); |
464 for (std::vector<CreditCard*>::const_iterator iter = cards.begin(); | 464 for (const CreditCard* card : cards) { |
465 iter != cards.end(); ++iter) { | |
466 const CreditCard* card = *iter; | |
467 if (card->record_type() != CreditCard::LOCAL_CARD) | |
468 continue; | |
469 | |
470 // TODO(estade): this should be a dictionary. | 465 // TODO(estade): this should be a dictionary. |
471 base::ListValue* entry = new base::ListValue(); | 466 base::ListValue* entry = new base::ListValue(); |
472 entry->Append(new base::StringValue(card->guid())); | 467 entry->Append(new base::StringValue(card->guid())); |
473 entry->Append(new base::StringValue(card->Label())); | 468 entry->Append(new base::StringValue(card->Label())); |
474 entry->Append(new base::StringValue( | 469 entry->Append(new base::StringValue( |
475 webui::GetBitmapDataUrlFromResource( | 470 webui::GetBitmapDataUrlFromResource( |
476 CreditCard::IconResourceId(card->type())))); | 471 CreditCard::IconResourceId(card->type())))); |
477 entry->Append(new base::StringValue(card->TypeForDisplay())); | 472 entry->Append(new base::StringValue(card->TypeForDisplay())); |
478 credit_cards.Append(entry); | 473 credit_cards.Append(entry); |
479 } | 474 } |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
746 scoped_ptr<base::ListValue> components(new base::ListValue); | 741 scoped_ptr<base::ListValue> components(new base::ListValue); |
747 GetAddressComponents( | 742 GetAddressComponents( |
748 base::UTF16ToUTF8(profile.GetRawInfo(autofill::ADDRESS_HOME_COUNTRY)), | 743 base::UTF16ToUTF8(profile.GetRawInfo(autofill::ADDRESS_HOME_COUNTRY)), |
749 profile.language_code(), | 744 profile.language_code(), |
750 components.get(), | 745 components.get(), |
751 NULL); | 746 NULL); |
752 address->Set(kComponents, components.release()); | 747 address->Set(kComponents, components.release()); |
753 } | 748 } |
754 | 749 |
755 } // namespace options | 750 } // namespace options |
OLD | NEW |