| 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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 component->SetString(kField, kPostalCodeField); | 146 component->SetString(kField, kPostalCodeField); |
| 147 break; | 147 break; |
| 148 case i18n::addressinput::STREET_ADDRESS: | 148 case i18n::addressinput::STREET_ADDRESS: |
| 149 component->SetString(kField, kAddressLineField); | 149 component->SetString(kField, kAddressLineField); |
| 150 break; | 150 break; |
| 151 case i18n::addressinput::ORGANIZATION: | 151 case i18n::addressinput::ORGANIZATION: |
| 152 component->SetString(kField, kCompanyNameField); | 152 component->SetString(kField, kCompanyNameField); |
| 153 break; | 153 break; |
| 154 case i18n::addressinput::RECIPIENT: | 154 case i18n::addressinput::RECIPIENT: |
| 155 component->SetString(kField, kFullNameField); | 155 component->SetString(kField, kFullNameField); |
| 156 component->SetString( | |
| 157 "placeholder", | |
| 158 l10n_util::GetStringUTF16(IDS_AUTOFILL_FIELD_LABEL_ADD_NAME)); | |
| 159 break; | 156 break; |
| 160 } | 157 } |
| 161 | 158 |
| 162 switch (components[i].length_hint) { | 159 switch (components[i].length_hint) { |
| 163 case AddressUiComponent::HINT_LONG: | 160 case AddressUiComponent::HINT_LONG: |
| 164 component->SetString(kLength, "long"); | 161 component->SetString(kLength, "long"); |
| 165 break; | 162 break; |
| 166 case AddressUiComponent::HINT_SHORT: | 163 case AddressUiComponent::HINT_SHORT: |
| 167 component->SetString(kLength, "short"); | 164 component->SetString(kLength, "short"); |
| 168 break; | 165 break; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 199 GetAddressComponents(countries.front()->country_code(), | 196 GetAddressComponents(countries.front()->country_code(), |
| 200 g_browser_process->GetApplicationLocale(), | 197 g_browser_process->GetApplicationLocale(), |
| 201 default_country_components.get(), | 198 default_country_components.get(), |
| 202 &default_country_language_code); | 199 &default_country_language_code); |
| 203 localized_strings->Set("autofillDefaultCountryComponents", | 200 localized_strings->Set("autofillDefaultCountryComponents", |
| 204 default_country_components.release()); | 201 default_country_components.release()); |
| 205 localized_strings->SetString("autofillDefaultCountryLanguageCode", | 202 localized_strings->SetString("autofillDefaultCountryLanguageCode", |
| 206 default_country_language_code); | 203 default_country_language_code); |
| 207 } | 204 } |
| 208 | 205 |
| 209 // Get the multi-valued element for |type| and return it in |ListValue| form. | |
| 210 // Buyer beware: the type of data affects whether GetRawInfo or GetInfo is used. | |
| 211 void GetValueList(const AutofillProfile& profile, | |
| 212 ServerFieldType type, | |
| 213 scoped_ptr<base::ListValue>* list) { | |
| 214 list->reset(new base::ListValue); | |
| 215 | |
| 216 std::vector<base::string16> values; | |
| 217 if (AutofillType(type).group() == autofill::NAME) { | |
| 218 profile.GetMultiInfo( | |
| 219 AutofillType(type), g_browser_process->GetApplicationLocale(), &values); | |
| 220 } else { | |
| 221 profile.GetRawMultiInfo(type, &values); | |
| 222 } | |
| 223 | |
| 224 // |Get[Raw]MultiInfo()| always returns at least one, potentially empty, item. | |
| 225 if (values.size() == 1 && values.front().empty()) | |
| 226 return; | |
| 227 | |
| 228 for (size_t i = 0; i < values.size(); ++i) { | |
| 229 (*list)->Set(i, new base::StringValue(values[i])); | |
| 230 } | |
| 231 } | |
| 232 | |
| 233 // Converts a ListValue of StringValues to a vector of string16s. | |
| 234 void ListValueToStringVector(const base::ListValue& list, | |
| 235 std::vector<base::string16>* output) { | |
| 236 output->resize(list.GetSize()); | |
| 237 for (size_t i = 0; i < list.GetSize(); ++i) { | |
| 238 base::string16 value; | |
| 239 if (list.GetString(i, &value)) | |
| 240 (*output)[i].swap(value); | |
| 241 } | |
| 242 } | |
| 243 | |
| 244 // Pulls the phone number |index|, |phone_number_list|, and |country_code| from | |
| 245 // the |args| input. | |
| 246 void ExtractPhoneNumberInformation(const base::ListValue* args, | |
| 247 size_t* index, | |
| 248 const base::ListValue** phone_number_list, | |
| 249 std::string* country_code) { | |
| 250 // Retrieve index as a |double|, as that is how it comes across from | |
| 251 // JavaScript. | |
| 252 double number = 0.0; | |
| 253 if (!args->GetDouble(0, &number)) { | |
| 254 NOTREACHED(); | |
| 255 return; | |
| 256 } | |
| 257 *index = number; | |
| 258 | |
| 259 if (!args->GetList(1, phone_number_list)) { | |
| 260 NOTREACHED(); | |
| 261 return; | |
| 262 } | |
| 263 | |
| 264 if (!args->GetString(2, country_code)) { | |
| 265 NOTREACHED(); | |
| 266 return; | |
| 267 } | |
| 268 } | |
| 269 | |
| 270 // Searches the |list| for the value at |index|. If this value is present | |
| 271 // in any of the rest of the list, then the item (at |index|) is removed. | |
| 272 // The comparison of phone number values is done on normalized versions of the | |
| 273 // phone number values. | |
| 274 void RemoveDuplicatePhoneNumberAtIndex(size_t index, | |
| 275 const std::string& country_code, | |
| 276 base::ListValue* list) { | |
| 277 base::string16 new_value; | |
| 278 if (!list->GetString(index, &new_value)) { | |
| 279 NOTREACHED() << "List should have a value at index " << index; | |
| 280 return; | |
| 281 } | |
| 282 | |
| 283 bool is_duplicate = false; | |
| 284 std::string app_locale = g_browser_process->GetApplicationLocale(); | |
| 285 for (size_t i = 0; i < list->GetSize() && !is_duplicate; ++i) { | |
| 286 if (i == index) | |
| 287 continue; | |
| 288 | |
| 289 base::string16 existing_value; | |
| 290 if (!list->GetString(i, &existing_value)) { | |
| 291 NOTREACHED() << "List should have a value at index " << i; | |
| 292 continue; | |
| 293 } | |
| 294 is_duplicate = autofill::i18n::PhoneNumbersMatch( | |
| 295 new_value, existing_value, country_code, app_locale); | |
| 296 } | |
| 297 | |
| 298 if (is_duplicate) | |
| 299 list->Remove(index, NULL); | |
| 300 } | |
| 301 | |
| 302 scoped_ptr<base::ListValue> ValidatePhoneArguments( | |
| 303 const base::ListValue* args) { | |
| 304 size_t index = 0; | |
| 305 std::string country_code; | |
| 306 const base::ListValue* extracted_list = NULL; | |
| 307 ExtractPhoneNumberInformation(args, &index, &extracted_list, &country_code); | |
| 308 | |
| 309 scoped_ptr<base::ListValue> list(extracted_list->DeepCopy()); | |
| 310 RemoveDuplicatePhoneNumberAtIndex(index, country_code, list.get()); | |
| 311 return list.Pass(); | |
| 312 } | |
| 313 | |
| 314 } // namespace | 206 } // namespace |
| 315 | 207 |
| 316 namespace options { | 208 namespace options { |
| 317 | 209 |
| 318 AutofillOptionsHandler::AutofillOptionsHandler() | 210 AutofillOptionsHandler::AutofillOptionsHandler() |
| 319 : personal_data_(NULL), observer_(this) { | 211 : personal_data_(NULL), observer_(this) { |
| 320 } | 212 } |
| 321 | 213 |
| 322 AutofillOptionsHandler::~AutofillOptionsHandler() { | 214 AutofillOptionsHandler::~AutofillOptionsHandler() { |
| 323 if (personal_data_) | 215 if (personal_data_) |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 base::Bind(&AutofillOptionsHandler::LoadCreditCardEditor, | 313 base::Bind(&AutofillOptionsHandler::LoadCreditCardEditor, |
| 422 base::Unretained(this))); | 314 base::Unretained(this))); |
| 423 web_ui()->RegisterMessageCallback( | 315 web_ui()->RegisterMessageCallback( |
| 424 "setAddress", | 316 "setAddress", |
| 425 base::Bind(&AutofillOptionsHandler::SetAddress, base::Unretained(this))); | 317 base::Bind(&AutofillOptionsHandler::SetAddress, base::Unretained(this))); |
| 426 web_ui()->RegisterMessageCallback( | 318 web_ui()->RegisterMessageCallback( |
| 427 "setCreditCard", | 319 "setCreditCard", |
| 428 base::Bind(&AutofillOptionsHandler::SetCreditCard, | 320 base::Bind(&AutofillOptionsHandler::SetCreditCard, |
| 429 base::Unretained(this))); | 321 base::Unretained(this))); |
| 430 web_ui()->RegisterMessageCallback( | 322 web_ui()->RegisterMessageCallback( |
| 431 "validatePhoneNumbers", | |
| 432 base::Bind(&AutofillOptionsHandler::ValidatePhoneNumbers, | |
| 433 base::Unretained(this))); | |
| 434 web_ui()->RegisterMessageCallback( | |
| 435 "clearLocalCardCopy", | 323 "clearLocalCardCopy", |
| 436 base::Bind(&AutofillOptionsHandler::RemaskServerCard, | 324 base::Bind(&AutofillOptionsHandler::RemaskServerCard, |
| 437 base::Unretained(this))); | 325 base::Unretained(this))); |
| 438 } | 326 } |
| 439 | 327 |
| 440 ///////////////////////////////////////////////////////////////////////////// | 328 ///////////////////////////////////////////////////////////////////////////// |
| 441 // PersonalDataManagerObserver implementation: | 329 // PersonalDataManagerObserver implementation: |
| 442 void AutofillOptionsHandler::OnPersonalDataChanged() { | 330 void AutofillOptionsHandler::OnPersonalDataChanged() { |
| 443 LoadAutofillData(); | 331 LoadAutofillData(); |
| 444 OnStateChanged(); | 332 OnStateChanged(); |
| 445 } | 333 } |
| 446 | 334 |
| 447 void AutofillOptionsHandler::OnStateChanged() { | 335 void AutofillOptionsHandler::OnStateChanged() { |
| 448 web_ui()->CallJavascriptFunction( | 336 web_ui()->CallJavascriptFunction( |
| 449 "AutofillOptions.walletIntegrationAvailableStateChanged", | 337 "AutofillOptions.walletIntegrationAvailableStateChanged", |
| 450 base::FundamentalValue(autofill::WalletIntegrationAvailableForProfile( | 338 base::FundamentalValue(autofill::WalletIntegrationAvailableForProfile( |
| 451 Profile::FromWebUI(web_ui())))); | 339 Profile::FromWebUI(web_ui())))); |
| 452 } | 340 } |
| 453 | 341 |
| 454 void AutofillOptionsHandler::SetAddressOverlayStrings( | 342 void AutofillOptionsHandler::SetAddressOverlayStrings( |
| 455 base::DictionaryValue* localized_strings) { | 343 base::DictionaryValue* localized_strings) { |
| 456 localized_strings->SetString("autofillEditAddressTitle", | 344 localized_strings->SetString("autofillEditAddressTitle", |
| 457 l10n_util::GetStringUTF16(IDS_AUTOFILL_EDIT_ADDRESS_CAPTION)); | 345 l10n_util::GetStringUTF16(IDS_AUTOFILL_EDIT_ADDRESS_CAPTION)); |
| 458 localized_strings->SetString("autofillCountryLabel", | 346 localized_strings->SetString("autofillCountryLabel", |
| 459 l10n_util::GetStringUTF16(IDS_LIBADDRESSINPUT_COUNTRY_OR_REGION_LABEL)); | 347 l10n_util::GetStringUTF16(IDS_LIBADDRESSINPUT_COUNTRY_OR_REGION_LABEL)); |
| 460 localized_strings->SetString("autofillPhoneLabel", | 348 localized_strings->SetString("autofillPhoneLabel", |
| 461 l10n_util::GetStringUTF16(IDS_AUTOFILL_FIELD_LABEL_PHONE)); | 349 l10n_util::GetStringUTF16(IDS_AUTOFILL_FIELD_LABEL_PHONE)); |
| 462 localized_strings->SetString("autofillEmailLabel", | 350 localized_strings->SetString("autofillEmailLabel", |
| 463 l10n_util::GetStringUTF16(IDS_AUTOFILL_FIELD_LABEL_EMAIL)); | 351 l10n_util::GetStringUTF16(IDS_AUTOFILL_FIELD_LABEL_EMAIL)); |
| 464 localized_strings->SetString("autofillAddPhonePlaceholder", | |
| 465 l10n_util::GetStringUTF16(IDS_AUTOFILL_FIELD_LABEL_ADD_PHONE)); | |
| 466 localized_strings->SetString("autofillAddEmailPlaceholder", | |
| 467 l10n_util::GetStringUTF16(IDS_AUTOFILL_FIELD_LABEL_ADD_EMAIL)); | |
| 468 SetCountryData(*personal_data_, localized_strings); | 352 SetCountryData(*personal_data_, localized_strings); |
| 469 } | 353 } |
| 470 | 354 |
| 471 void AutofillOptionsHandler::SetCreditCardOverlayStrings( | 355 void AutofillOptionsHandler::SetCreditCardOverlayStrings( |
| 472 base::DictionaryValue* localized_strings) { | 356 base::DictionaryValue* localized_strings) { |
| 473 localized_strings->SetString("autofillEditCreditCardTitle", | 357 localized_strings->SetString("autofillEditCreditCardTitle", |
| 474 l10n_util::GetStringUTF16(IDS_AUTOFILL_EDIT_CREDITCARD_CAPTION)); | 358 l10n_util::GetStringUTF16(IDS_AUTOFILL_EDIT_CREDITCARD_CAPTION)); |
| 475 localized_strings->SetString("nameOnCardLabel", | 359 localized_strings->SetString("nameOnCardLabel", |
| 476 l10n_util::GetStringUTF16(IDS_AUTOFILL_FIELD_LABEL_NAME_ON_CARD)); | 360 l10n_util::GetStringUTF16(IDS_AUTOFILL_FIELD_LABEL_NAME_ON_CARD)); |
| 477 localized_strings->SetString("creditCardNumberLabel", | 361 localized_strings->SetString("creditCardNumberLabel", |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 632 int arg_counter = 0; | 516 int arg_counter = 0; |
| 633 std::string guid; | 517 std::string guid; |
| 634 if (!args->GetString(arg_counter++, &guid)) { | 518 if (!args->GetString(arg_counter++, &guid)) { |
| 635 NOTREACHED(); | 519 NOTREACHED(); |
| 636 return; | 520 return; |
| 637 } | 521 } |
| 638 | 522 |
| 639 AutofillProfile profile(guid, kSettingsOrigin); | 523 AutofillProfile profile(guid, kSettingsOrigin); |
| 640 | 524 |
| 641 base::string16 value; | 525 base::string16 value; |
| 642 const base::ListValue* list_value; | 526 if (args->GetString(arg_counter++, &value)) { |
| 643 if (args->GetList(arg_counter++, &list_value)) { | 527 // TODO(estade): get rid of this vector wrapper. |
| 644 std::vector<base::string16> values; | 528 std::vector<base::string16> values(1, value); |
| 645 ListValueToStringVector(*list_value, &values); | |
| 646 AutofillProfile* old_profile = personal_data_->GetProfileByGUID(guid); | 529 AutofillProfile* old_profile = personal_data_->GetProfileByGUID(guid); |
| 647 profile.CopyAndUpdateNameList(values, old_profile, | 530 profile.CopyAndUpdateNameList(values, old_profile, |
| 648 g_browser_process->GetApplicationLocale()); | 531 g_browser_process->GetApplicationLocale()); |
| 649 } | 532 } |
| 650 | 533 |
| 651 if (args->GetString(arg_counter++, &value)) | 534 if (args->GetString(arg_counter++, &value)) |
| 652 profile.SetRawInfo(autofill::COMPANY_NAME, value); | 535 profile.SetRawInfo(autofill::COMPANY_NAME, value); |
| 653 | 536 |
| 654 if (args->GetString(arg_counter++, &value)) | 537 if (args->GetString(arg_counter++, &value)) |
| 655 profile.SetRawInfo(autofill::ADDRESS_HOME_STREET_ADDRESS, value); | 538 profile.SetRawInfo(autofill::ADDRESS_HOME_STREET_ADDRESS, value); |
| 656 | 539 |
| 657 if (args->GetString(arg_counter++, &value)) | 540 if (args->GetString(arg_counter++, &value)) |
| 658 profile.SetRawInfo(autofill::ADDRESS_HOME_DEPENDENT_LOCALITY, value); | 541 profile.SetRawInfo(autofill::ADDRESS_HOME_DEPENDENT_LOCALITY, value); |
| 659 | 542 |
| 660 if (args->GetString(arg_counter++, &value)) | 543 if (args->GetString(arg_counter++, &value)) |
| 661 profile.SetRawInfo(autofill::ADDRESS_HOME_CITY, value); | 544 profile.SetRawInfo(autofill::ADDRESS_HOME_CITY, value); |
| 662 | 545 |
| 663 if (args->GetString(arg_counter++, &value)) | 546 if (args->GetString(arg_counter++, &value)) |
| 664 profile.SetRawInfo(autofill::ADDRESS_HOME_STATE, value); | 547 profile.SetRawInfo(autofill::ADDRESS_HOME_STATE, value); |
| 665 | 548 |
| 666 if (args->GetString(arg_counter++, &value)) | 549 if (args->GetString(arg_counter++, &value)) |
| 667 profile.SetRawInfo(autofill::ADDRESS_HOME_ZIP, value); | 550 profile.SetRawInfo(autofill::ADDRESS_HOME_ZIP, value); |
| 668 | 551 |
| 669 if (args->GetString(arg_counter++, &value)) | 552 if (args->GetString(arg_counter++, &value)) |
| 670 profile.SetRawInfo(autofill::ADDRESS_HOME_SORTING_CODE, value); | 553 profile.SetRawInfo(autofill::ADDRESS_HOME_SORTING_CODE, value); |
| 671 | 554 |
| 672 if (args->GetString(arg_counter++, &value)) | 555 if (args->GetString(arg_counter++, &value)) |
| 673 profile.SetRawInfo(autofill::ADDRESS_HOME_COUNTRY, value); | 556 profile.SetRawInfo(autofill::ADDRESS_HOME_COUNTRY, value); |
| 674 | 557 |
| 675 if (args->GetList(arg_counter++, &list_value)) { | 558 if (args->GetString(arg_counter++, &value)) |
| 676 std::vector<base::string16> values; | 559 profile.SetRawInfo(autofill::PHONE_HOME_WHOLE_NUMBER, value); |
| 677 ListValueToStringVector(*list_value, &values); | |
| 678 profile.SetRawMultiInfo(autofill::PHONE_HOME_WHOLE_NUMBER, values); | |
| 679 } | |
| 680 | 560 |
| 681 if (args->GetList(arg_counter++, &list_value)) { | 561 if (args->GetString(arg_counter++, &value)) |
| 682 std::vector<base::string16> values; | 562 profile.SetRawInfo(autofill::EMAIL_ADDRESS, value); |
| 683 ListValueToStringVector(*list_value, &values); | |
| 684 profile.SetRawMultiInfo(autofill::EMAIL_ADDRESS, values); | |
| 685 } | |
| 686 | 563 |
| 687 if (args->GetString(arg_counter++, &value)) | 564 if (args->GetString(arg_counter++, &value)) |
| 688 profile.set_language_code(base::UTF16ToUTF8(value)); | 565 profile.set_language_code(base::UTF16ToUTF8(value)); |
| 689 | 566 |
| 690 if (!base::IsValidGUID(profile.guid())) { | 567 if (!base::IsValidGUID(profile.guid())) { |
| 691 profile.set_guid(base::GenerateGUID()); | 568 profile.set_guid(base::GenerateGUID()); |
| 692 personal_data_->AddProfile(profile); | 569 personal_data_->AddProfile(profile); |
| 693 } else { | 570 } else { |
| 694 personal_data_->UpdateProfile(profile); | 571 personal_data_->UpdateProfile(profile); |
| 695 } | 572 } |
| (...skipping 25 matching lines...) Expand all Loading... |
| 721 credit_card.SetRawInfo(autofill::CREDIT_CARD_EXP_4_DIGIT_YEAR, value); | 598 credit_card.SetRawInfo(autofill::CREDIT_CARD_EXP_4_DIGIT_YEAR, value); |
| 722 | 599 |
| 723 if (!base::IsValidGUID(credit_card.guid())) { | 600 if (!base::IsValidGUID(credit_card.guid())) { |
| 724 credit_card.set_guid(base::GenerateGUID()); | 601 credit_card.set_guid(base::GenerateGUID()); |
| 725 personal_data_->AddCreditCard(credit_card); | 602 personal_data_->AddCreditCard(credit_card); |
| 726 } else { | 603 } else { |
| 727 personal_data_->UpdateCreditCard(credit_card); | 604 personal_data_->UpdateCreditCard(credit_card); |
| 728 } | 605 } |
| 729 } | 606 } |
| 730 | 607 |
| 731 void AutofillOptionsHandler::ValidatePhoneNumbers(const base::ListValue* args) { | |
| 732 if (!IsPersonalDataLoaded()) | |
| 733 return; | |
| 734 | |
| 735 scoped_ptr<base::ListValue> list_value = ValidatePhoneArguments(args); | |
| 736 | |
| 737 web_ui()->CallJavascriptFunction( | |
| 738 "AutofillEditAddressOverlay.setValidatedPhoneNumbers", *list_value); | |
| 739 } | |
| 740 | |
| 741 void AutofillOptionsHandler::RemaskServerCard(const base::ListValue* args) { | 608 void AutofillOptionsHandler::RemaskServerCard(const base::ListValue* args) { |
| 742 std::string guid; | 609 std::string guid; |
| 743 if (!args->GetString(0, &guid)) { | 610 if (!args->GetString(0, &guid)) { |
| 744 NOTREACHED(); | 611 NOTREACHED(); |
| 745 return; | 612 return; |
| 746 } | 613 } |
| 747 | 614 |
| 748 personal_data_->ResetFullServerCard(guid); | 615 personal_data_->ResetFullServerCard(guid); |
| 749 } | 616 } |
| 750 | 617 |
| 751 bool AutofillOptionsHandler::IsPersonalDataLoaded() const { | 618 bool AutofillOptionsHandler::IsPersonalDataLoaded() const { |
| 752 return personal_data_ && personal_data_->IsDataLoaded(); | 619 return personal_data_ && personal_data_->IsDataLoaded(); |
| 753 } | 620 } |
| 754 | 621 |
| 755 // static | 622 // static |
| 756 void AutofillOptionsHandler::AutofillProfileToDictionary( | 623 void AutofillOptionsHandler::AutofillProfileToDictionary( |
| 757 const autofill::AutofillProfile& profile, | 624 const autofill::AutofillProfile& profile, |
| 758 base::DictionaryValue* address) { | 625 base::DictionaryValue* address) { |
| 759 address->SetString("guid", profile.guid()); | 626 address->SetString("guid", profile.guid()); |
| 760 scoped_ptr<base::ListValue> list; | 627 address->SetString( |
| 761 GetValueList(profile, autofill::NAME_FULL, &list); | 628 kFullNameField, |
| 762 address->Set(kFullNameField, list.release()); | 629 profile.GetInfo(AutofillType(autofill::NAME_FULL), |
| 630 g_browser_process->GetApplicationLocale())); |
| 763 address->SetString(kCompanyNameField, | 631 address->SetString(kCompanyNameField, |
| 764 profile.GetRawInfo(autofill::COMPANY_NAME)); | 632 profile.GetRawInfo(autofill::COMPANY_NAME)); |
| 765 address->SetString(kAddressLineField, | 633 address->SetString(kAddressLineField, |
| 766 profile.GetRawInfo(autofill::ADDRESS_HOME_STREET_ADDRESS)); | 634 profile.GetRawInfo(autofill::ADDRESS_HOME_STREET_ADDRESS)); |
| 767 address->SetString(kCityField, | 635 address->SetString(kCityField, |
| 768 profile.GetRawInfo(autofill::ADDRESS_HOME_CITY)); | 636 profile.GetRawInfo(autofill::ADDRESS_HOME_CITY)); |
| 769 address->SetString(kStateField, | 637 address->SetString(kStateField, |
| 770 profile.GetRawInfo(autofill::ADDRESS_HOME_STATE)); | 638 profile.GetRawInfo(autofill::ADDRESS_HOME_STATE)); |
| 771 address->SetString( | 639 address->SetString( |
| 772 kDependentLocalityField, | 640 kDependentLocalityField, |
| 773 profile.GetRawInfo(autofill::ADDRESS_HOME_DEPENDENT_LOCALITY)); | 641 profile.GetRawInfo(autofill::ADDRESS_HOME_DEPENDENT_LOCALITY)); |
| 774 address->SetString(kSortingCodeField, | 642 address->SetString(kSortingCodeField, |
| 775 profile.GetRawInfo(autofill::ADDRESS_HOME_SORTING_CODE)); | 643 profile.GetRawInfo(autofill::ADDRESS_HOME_SORTING_CODE)); |
| 776 address->SetString(kPostalCodeField, | 644 address->SetString(kPostalCodeField, |
| 777 profile.GetRawInfo(autofill::ADDRESS_HOME_ZIP)); | 645 profile.GetRawInfo(autofill::ADDRESS_HOME_ZIP)); |
| 778 address->SetString(kCountryField, | 646 address->SetString(kCountryField, |
| 779 profile.GetRawInfo(autofill::ADDRESS_HOME_COUNTRY)); | 647 profile.GetRawInfo(autofill::ADDRESS_HOME_COUNTRY)); |
| 780 GetValueList(profile, autofill::PHONE_HOME_WHOLE_NUMBER, &list); | 648 address->SetString("phone", |
| 781 address->Set("phone", list.release()); | 649 profile.GetRawInfo(autofill::PHONE_HOME_WHOLE_NUMBER)); |
| 782 GetValueList(profile, autofill::EMAIL_ADDRESS, &list); | 650 address->SetString("email", profile.GetRawInfo(autofill::EMAIL_ADDRESS)); |
| 783 address->Set("email", list.release()); | |
| 784 address->SetString(kLanguageCode, profile.language_code()); | 651 address->SetString(kLanguageCode, profile.language_code()); |
| 785 | 652 |
| 786 scoped_ptr<base::ListValue> components(new base::ListValue); | 653 scoped_ptr<base::ListValue> components(new base::ListValue); |
| 787 GetAddressComponents( | 654 GetAddressComponents( |
| 788 base::UTF16ToUTF8(profile.GetRawInfo(autofill::ADDRESS_HOME_COUNTRY)), | 655 base::UTF16ToUTF8(profile.GetRawInfo(autofill::ADDRESS_HOME_COUNTRY)), |
| 789 profile.language_code(), | 656 profile.language_code(), |
| 790 components.get(), | 657 components.get(), |
| 791 NULL); | 658 NULL); |
| 792 address->Set(kComponents, components.release()); | 659 address->Set(kComponents, components.release()); |
| 793 } | 660 } |
| 794 | 661 |
| 795 } // namespace options | 662 } // namespace options |
| OLD | NEW |