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 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 address.SetString("guid", profile->guid()); | 436 address.SetString("guid", profile->guid()); |
437 scoped_ptr<ListValue> list; | 437 scoped_ptr<ListValue> list; |
438 GetNameList(*profile, &list); | 438 GetNameList(*profile, &list); |
439 address.Set("fullName", list.release()); | 439 address.Set("fullName", list.release()); |
440 address.SetString("companyName", profile->GetRawInfo(COMPANY_NAME)); | 440 address.SetString("companyName", profile->GetRawInfo(COMPANY_NAME)); |
441 address.SetString("addrLine1", profile->GetRawInfo(ADDRESS_HOME_LINE1)); | 441 address.SetString("addrLine1", profile->GetRawInfo(ADDRESS_HOME_LINE1)); |
442 address.SetString("addrLine2", profile->GetRawInfo(ADDRESS_HOME_LINE2)); | 442 address.SetString("addrLine2", profile->GetRawInfo(ADDRESS_HOME_LINE2)); |
443 address.SetString("city", profile->GetRawInfo(ADDRESS_HOME_CITY)); | 443 address.SetString("city", profile->GetRawInfo(ADDRESS_HOME_CITY)); |
444 address.SetString("state", profile->GetRawInfo(ADDRESS_HOME_STATE)); | 444 address.SetString("state", profile->GetRawInfo(ADDRESS_HOME_STATE)); |
445 address.SetString("postalCode", profile->GetRawInfo(ADDRESS_HOME_ZIP)); | 445 address.SetString("postalCode", profile->GetRawInfo(ADDRESS_HOME_ZIP)); |
446 address.SetString("country", profile->CountryCode()); | 446 address.SetString("country", profile->GetRawInfo(ADDRESS_HOME_COUNTRY)); |
447 GetValueList(*profile, PHONE_HOME_WHOLE_NUMBER, &list); | 447 GetValueList(*profile, PHONE_HOME_WHOLE_NUMBER, &list); |
448 address.Set("phone", list.release()); | 448 address.Set("phone", list.release()); |
449 GetValueList(*profile, EMAIL_ADDRESS, &list); | 449 GetValueList(*profile, EMAIL_ADDRESS, &list); |
450 address.Set("email", list.release()); | 450 address.Set("email", list.release()); |
451 | 451 |
452 web_ui()->CallJavascriptFunction("AutofillOptions.editAddress", address); | 452 web_ui()->CallJavascriptFunction("AutofillOptions.editAddress", address); |
453 } | 453 } |
454 | 454 |
455 void AutofillOptionsHandler::LoadCreditCardEditor(const ListValue* args) { | 455 void AutofillOptionsHandler::LoadCreditCardEditor(const ListValue* args) { |
456 DCHECK(IsPersonalDataLoaded()); | 456 DCHECK(IsPersonalDataLoaded()); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
517 if (args->GetString(5, &value)) | 517 if (args->GetString(5, &value)) |
518 profile.SetRawInfo(ADDRESS_HOME_CITY, value); | 518 profile.SetRawInfo(ADDRESS_HOME_CITY, value); |
519 | 519 |
520 if (args->GetString(6, &value)) | 520 if (args->GetString(6, &value)) |
521 profile.SetRawInfo(ADDRESS_HOME_STATE, value); | 521 profile.SetRawInfo(ADDRESS_HOME_STATE, value); |
522 | 522 |
523 if (args->GetString(7, &value)) | 523 if (args->GetString(7, &value)) |
524 profile.SetRawInfo(ADDRESS_HOME_ZIP, value); | 524 profile.SetRawInfo(ADDRESS_HOME_ZIP, value); |
525 | 525 |
526 if (args->GetString(8, &country_code)) | 526 if (args->GetString(8, &country_code)) |
527 profile.SetCountryCode(country_code); | 527 profile.SetRawInfo(ADDRESS_HOME_COUNTRY, ASCIIToUTF16(country_code)); |
528 | 528 |
529 if (args->GetList(9, &list_value)) | 529 if (args->GetList(9, &list_value)) |
530 SetValueList(list_value, PHONE_HOME_WHOLE_NUMBER, &profile); | 530 SetValueList(list_value, PHONE_HOME_WHOLE_NUMBER, &profile); |
531 | 531 |
532 if (args->GetList(10, &list_value)) | 532 if (args->GetList(10, &list_value)) |
533 SetValueList(list_value, EMAIL_ADDRESS, &profile); | 533 SetValueList(list_value, EMAIL_ADDRESS, &profile); |
534 | 534 |
535 if (!base::IsValidGUID(profile.guid())) { | 535 if (!base::IsValidGUID(profile.guid())) { |
536 profile.set_guid(base::GenerateGUID()); | 536 profile.set_guid(base::GenerateGUID()); |
537 personal_data_->AddProfile(profile); | 537 personal_data_->AddProfile(profile); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
581 | 581 |
582 web_ui()->CallJavascriptFunction( | 582 web_ui()->CallJavascriptFunction( |
583 "AutofillEditAddressOverlay.setValidatedPhoneNumbers", *list_value); | 583 "AutofillEditAddressOverlay.setValidatedPhoneNumbers", *list_value); |
584 } | 584 } |
585 | 585 |
586 bool AutofillOptionsHandler::IsPersonalDataLoaded() const { | 586 bool AutofillOptionsHandler::IsPersonalDataLoaded() const { |
587 return personal_data_ && personal_data_->IsDataLoaded(); | 587 return personal_data_ && personal_data_->IsDataLoaded(); |
588 } | 588 } |
589 | 589 |
590 } // namespace options | 590 } // namespace options |
OLD | NEW |