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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 scoped_ptr<base::DictionaryValue> CreditCardToDictionary( | 73 scoped_ptr<base::DictionaryValue> CreditCardToDictionary( |
74 const CreditCard& card) { | 74 const CreditCard& card) { |
75 scoped_ptr<base::DictionaryValue> value(new base::DictionaryValue); | 75 scoped_ptr<base::DictionaryValue> value(new base::DictionaryValue); |
76 value->SetString("guid", card.guid()); | 76 value->SetString("guid", card.guid()); |
77 std::pair<base::string16, base::string16> label_pieces = card.LabelPieces(); | 77 std::pair<base::string16, base::string16> label_pieces = card.LabelPieces(); |
78 value->SetString("label", label_pieces.first); | 78 value->SetString("label", label_pieces.first); |
79 value->SetString("sublabel", label_pieces.second); | 79 value->SetString("sublabel", label_pieces.second); |
80 value->SetBoolean("isLocal", card.record_type() == CreditCard::LOCAL_CARD); | 80 value->SetBoolean("isLocal", card.record_type() == CreditCard::LOCAL_CARD); |
81 value->SetBoolean("isCached", | 81 value->SetBoolean("isCached", |
82 card.record_type() == CreditCard::FULL_SERVER_CARD); | 82 card.record_type() == CreditCard::FULL_SERVER_CARD); |
83 return value.Pass(); | 83 return value; |
84 } | 84 } |
85 | 85 |
86 // Fills |components| with the address UI components that should be used to | 86 // Fills |components| with the address UI components that should be used to |
87 // input an address for |country_code| when UI BCP 47 language code is | 87 // input an address for |country_code| when UI BCP 47 language code is |
88 // |ui_language_code|. If |components_language_code| is not NULL, then sets it | 88 // |ui_language_code|. If |components_language_code| is not NULL, then sets it |
89 // to the BCP 47 language code that should be used to format the address for | 89 // to the BCP 47 language code that should be used to format the address for |
90 // display. | 90 // display. |
91 void GetAddressComponents(const std::string& country_code, | 91 void GetAddressComponents(const std::string& country_code, |
92 const std::string& ui_language_code, | 92 const std::string& ui_language_code, |
93 base::ListValue* address_components, | 93 base::ListValue* address_components, |
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
638 scoped_ptr<base::ListValue> components(new base::ListValue); | 638 scoped_ptr<base::ListValue> components(new base::ListValue); |
639 GetAddressComponents( | 639 GetAddressComponents( |
640 base::UTF16ToUTF8(profile.GetRawInfo(autofill::ADDRESS_HOME_COUNTRY)), | 640 base::UTF16ToUTF8(profile.GetRawInfo(autofill::ADDRESS_HOME_COUNTRY)), |
641 profile.language_code(), | 641 profile.language_code(), |
642 components.get(), | 642 components.get(), |
643 NULL); | 643 NULL); |
644 address->Set(kComponents, components.release()); | 644 address->Set(kComponents, components.release()); |
645 } | 645 } |
646 | 646 |
647 } // namespace options | 647 } // namespace options |
OLD | NEW |