Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(47)

Side by Side Diff: chrome/browser/ui/webui/options/autofill_options_handler.cc

Issue 13697002: Make autofill's Address store country using the country code so that app locale isn't needed for th… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix remaining tests Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698