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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 scoped_ptr<base::DictionaryValue> option_details( | 155 scoped_ptr<base::DictionaryValue> option_details( |
156 new base::DictionaryValue()); | 156 new base::DictionaryValue()); |
157 option_details->SetString("name", model.GetItemAt(i)); | 157 option_details->SetString("name", model.GetItemAt(i)); |
158 option_details->SetString( | 158 option_details->SetString( |
159 "value", | 159 "value", |
160 countries[i] ? countries[i]->country_code() : "separator"); | 160 countries[i] ? countries[i]->country_code() : "separator"); |
161 country_list->Append(option_details.release()); | 161 country_list->Append(option_details.release()); |
162 } | 162 } |
163 localized_strings->Set("autofillCountrySelectList", country_list.release()); | 163 localized_strings->Set("autofillCountrySelectList", country_list.release()); |
164 | 164 |
165 scoped_ptr<base::ListValue> defaultCountryComponents(new base::ListValue); | 165 scoped_ptr<base::ListValue> default_country_components(new base::ListValue); |
166 std::string defaultCountryLanguageCode; | 166 std::string default_country_language_code; |
167 GetAddressComponents(countries.front()->country_code(), | 167 GetAddressComponents(countries.front()->country_code(), |
168 g_browser_process->GetApplicationLocale(), | 168 g_browser_process->GetApplicationLocale(), |
169 defaultCountryComponents.get(), | 169 default_country_components.get(), |
170 &defaultCountryLanguageCode); | 170 &default_country_language_code); |
171 localized_strings->Set("autofillDefaultCountryComponents", | 171 localized_strings->Set("autofillDefaultCountryComponents", |
172 defaultCountryComponents.release()); | 172 default_country_components.release()); |
173 localized_strings->SetString("autofillDefaultCountryLanguageCode", | 173 localized_strings->SetString("autofillDefaultCountryLanguageCode", |
174 defaultCountryLanguageCode); | 174 default_country_language_code); |
175 } | 175 } |
176 | 176 |
177 // Get the multi-valued element for |type| and return it in |ListValue| form. | 177 // Get the multi-valued element for |type| and return it in |ListValue| form. |
178 void GetValueList(const AutofillProfile& profile, | 178 void GetValueList(const AutofillProfile& profile, |
179 ServerFieldType type, | 179 ServerFieldType type, |
180 scoped_ptr<base::ListValue>* list) { | 180 scoped_ptr<base::ListValue>* list) { |
181 list->reset(new base::ListValue); | 181 list->reset(new base::ListValue); |
182 | 182 |
183 std::vector<base::string16> values; | 183 std::vector<base::string16> values; |
184 profile.GetRawMultiInfo(type, &values); | 184 profile.GetRawMultiInfo(type, &values); |
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
663 | 663 |
664 web_ui()->CallJavascriptFunction( | 664 web_ui()->CallJavascriptFunction( |
665 "AutofillEditAddressOverlay.setValidatedPhoneNumbers", *list_value); | 665 "AutofillEditAddressOverlay.setValidatedPhoneNumbers", *list_value); |
666 } | 666 } |
667 | 667 |
668 bool AutofillOptionsHandler::IsPersonalDataLoaded() const { | 668 bool AutofillOptionsHandler::IsPersonalDataLoaded() const { |
669 return personal_data_ && personal_data_->IsDataLoaded(); | 669 return personal_data_ && personal_data_->IsDataLoaded(); |
670 } | 670 } |
671 | 671 |
672 } // namespace options | 672 } // namespace options |
OLD | NEW |