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 26 matching lines...) Expand all Loading... |
37 using autofill::CreditCard; | 37 using autofill::CreditCard; |
38 using autofill::PersonalDataManager; | 38 using autofill::PersonalDataManager; |
39 | 39 |
40 namespace { | 40 namespace { |
41 | 41 |
42 const char kSettingsOrigin[] = "Chrome settings"; | 42 const char kSettingsOrigin[] = "Chrome settings"; |
43 | 43 |
44 // Sets data related to the country <select>. | 44 // Sets data related to the country <select>. |
45 void SetCountryData(const PersonalDataManager& manager, | 45 void SetCountryData(const PersonalDataManager& manager, |
46 base::DictionaryValue* localized_strings) { | 46 base::DictionaryValue* localized_strings) { |
47 autofill::CountryComboboxModel model(manager); | 47 autofill::CountryComboboxModel model(manager, true); |
48 const std::vector<AutofillCountry*>& countries = model.countries(); | 48 const std::vector<AutofillCountry*>& countries = model.countries(); |
49 localized_strings->SetString("defaultCountryCode", | 49 localized_strings->SetString("defaultCountryCode", |
50 countries.front()->country_code()); | 50 countries.front()->country_code()); |
51 | 51 |
52 // An ordered list of options to show in the <select>. | 52 // An ordered list of options to show in the <select>. |
53 scoped_ptr<base::ListValue> country_list(new base::ListValue()); | 53 scoped_ptr<base::ListValue> country_list(new base::ListValue()); |
54 // A dictionary of postal code and state info, keyed on country code. | 54 // A dictionary of postal code and state info, keyed on country code. |
55 scoped_ptr<base::DictionaryValue> country_data(new base::DictionaryValue()); | 55 scoped_ptr<base::DictionaryValue> country_data(new base::DictionaryValue()); |
56 for (size_t i = 0; i < countries.size(); ++i) { | 56 for (size_t i = 0; i < countries.size(); ++i) { |
57 scoped_ptr<base::DictionaryValue> option_details( | 57 scoped_ptr<base::DictionaryValue> option_details( |
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
604 | 604 |
605 web_ui()->CallJavascriptFunction( | 605 web_ui()->CallJavascriptFunction( |
606 "AutofillEditAddressOverlay.setValidatedPhoneNumbers", *list_value); | 606 "AutofillEditAddressOverlay.setValidatedPhoneNumbers", *list_value); |
607 } | 607 } |
608 | 608 |
609 bool AutofillOptionsHandler::IsPersonalDataLoaded() const { | 609 bool AutofillOptionsHandler::IsPersonalDataLoaded() const { |
610 return personal_data_ && personal_data_->IsDataLoaded(); | 610 return personal_data_ && personal_data_->IsDataLoaded(); |
611 } | 611 } |
612 | 612 |
613 } // namespace options | 613 } // namespace options |
OLD | NEW |