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

Unified Diff: chrome/browser/ui/webui/options/autofill_options_handler.cc

Issue 399003002: Parse full name set in chrome://settings/autofill (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: satisfy msvc? Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | components/autofill/core/browser/autofill_profile.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/options/autofill_options_handler.cc
diff --git a/chrome/browser/ui/webui/options/autofill_options_handler.cc b/chrome/browser/ui/webui/options/autofill_options_handler.cc
index 45087bfa6de7aa47af43f3685940c8fbdbc41499..ba38dd5e465481f1d996f1102c7facb8a5f2671e 100644
--- a/chrome/browser/ui/webui/options/autofill_options_handler.cc
+++ b/chrome/browser/ui/webui/options/autofill_options_handler.cc
@@ -36,6 +36,7 @@
#include "ui/base/webui/web_ui_util.h"
using autofill::AutofillCountry;
+using autofill::AutofillType;
using autofill::ServerFieldType;
using autofill::AutofillProfile;
using autofill::CreditCard;
@@ -200,17 +201,15 @@ void GetValueList(const AutofillProfile& profile,
}
}
-// Set the multi-valued element for |type| from input |list| values.
-void SetValueList(const base::ListValue* list,
- ServerFieldType type,
- AutofillProfile* profile) {
- std::vector<base::string16> values(list->GetSize());
- for (size_t i = 0; i < list->GetSize(); ++i) {
+// Converts a ListValue of StringValues to a vector of string16s.
+void ListValueToStringVector(const base::ListValue& list,
+ std::vector<base::string16>* output) {
+ output->resize(list.GetSize());
+ for (size_t i = 0; i < list.GetSize(); ++i) {
base::string16 value;
- if (list->GetString(i, &value))
- values[i] = value;
+ if (list.GetString(i, &value))
+ (*output)[i].swap(value);
}
- profile->SetRawMultiInfo(type, values);
}
// Pulls the phone number |index|, |phone_number_list|, and |country_code| from
@@ -601,8 +600,13 @@ void AutofillOptionsHandler::SetAddress(const base::ListValue* args) {
base::string16 value;
const base::ListValue* list_value;
- if (args->GetList(arg_counter++, &list_value))
- SetValueList(list_value, autofill::NAME_FULL, &profile);
+ if (args->GetList(arg_counter++, &list_value)) {
+ std::vector<base::string16> values;
+ ListValueToStringVector(*list_value, &values);
+ profile.SetMultiInfo(AutofillType(autofill::NAME_FULL),
+ values,
+ g_browser_process->GetApplicationLocale());
+ }
if (args->GetString(arg_counter++, &value))
profile.SetRawInfo(autofill::COMPANY_NAME, value);
@@ -628,11 +632,17 @@ void AutofillOptionsHandler::SetAddress(const base::ListValue* args) {
if (args->GetString(arg_counter++, &value))
profile.SetRawInfo(autofill::ADDRESS_HOME_COUNTRY, value);
- if (args->GetList(arg_counter++, &list_value))
- SetValueList(list_value, autofill::PHONE_HOME_WHOLE_NUMBER, &profile);
+ if (args->GetList(arg_counter++, &list_value)) {
+ std::vector<base::string16> values;
+ ListValueToStringVector(*list_value, &values);
+ profile.SetRawMultiInfo(autofill::PHONE_HOME_WHOLE_NUMBER, values);
+ }
- if (args->GetList(arg_counter++, &list_value))
- SetValueList(list_value, autofill::EMAIL_ADDRESS, &profile);
+ if (args->GetList(arg_counter++, &list_value)) {
+ std::vector<base::string16> values;
+ ListValueToStringVector(*list_value, &values);
+ profile.SetRawMultiInfo(autofill::EMAIL_ADDRESS, values);
+ }
if (args->GetString(arg_counter++, &value))
profile.set_language_code(base::UTF16ToUTF8(value));
« no previous file with comments | « no previous file | components/autofill/core/browser/autofill_profile.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698