OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/sync/glue/autofill_profile_change_processor.h" | 5 #include "chrome/browser/sync/glue/autofill_profile_change_processor.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 sync_api::WriteNode* node) { | 319 sync_api::WriteNode* node) { |
320 sync_pb::AutofillProfileSpecifics specifics; | 320 sync_pb::AutofillProfileSpecifics specifics; |
321 | 321 |
322 // This would get compiled out in official builds. The caller is expected to | 322 // This would get compiled out in official builds. The caller is expected to |
323 // pass in a valid profile object with valid guid.(i.e., the caller might | 323 // pass in a valid profile object with valid guid.(i.e., the caller might |
324 // have to a DCHECK and log before calling. Having to check in 2 places is | 324 // have to a DCHECK and log before calling. Having to check in 2 places is |
325 // not optimal.) | 325 // not optimal.) |
326 DCHECK(guid::IsValidGUID(profile.guid())); | 326 DCHECK(guid::IsValidGUID(profile.guid())); |
327 | 327 |
328 specifics.set_guid(profile.guid()); | 328 specifics.set_guid(profile.guid()); |
329 specifics.set_name_first(UTF16ToUTF8( | 329 specifics.set_name_first(UTF16ToUTF8(profile.GetFieldText(NAME_FIRST))); |
330 profile.GetFieldText(AutofillType(NAME_FIRST)))); | 330 specifics.set_name_middle(UTF16ToUTF8(profile.GetFieldText(NAME_MIDDLE))); |
331 specifics.set_name_middle(UTF16ToUTF8( | 331 specifics.set_name_last(UTF16ToUTF8(profile.GetFieldText(NAME_LAST))); |
332 profile.GetFieldText(AutofillType(NAME_MIDDLE)))); | |
333 specifics.set_name_last( | |
334 UTF16ToUTF8(profile.GetFieldText(AutofillType(NAME_LAST)))); | |
335 specifics.set_address_home_line1( | 332 specifics.set_address_home_line1( |
336 UTF16ToUTF8(profile.GetFieldText(AutofillType(ADDRESS_HOME_LINE1)))); | 333 UTF16ToUTF8(profile.GetFieldText(ADDRESS_HOME_LINE1))); |
337 specifics.set_address_home_line2( | 334 specifics.set_address_home_line2( |
338 UTF16ToUTF8(profile.GetFieldText(AutofillType(ADDRESS_HOME_LINE2)))); | 335 UTF16ToUTF8(profile.GetFieldText(ADDRESS_HOME_LINE2))); |
339 specifics.set_address_home_city(UTF16ToUTF8(profile.GetFieldText( | 336 specifics.set_address_home_city(UTF16ToUTF8(profile.GetFieldText( |
340 AutofillType(ADDRESS_HOME_CITY)))); | 337 ADDRESS_HOME_CITY))); |
341 specifics.set_address_home_state(UTF16ToUTF8(profile.GetFieldText( | 338 specifics.set_address_home_state(UTF16ToUTF8(profile.GetFieldText( |
342 AutofillType(ADDRESS_HOME_STATE)))); | 339 ADDRESS_HOME_STATE))); |
343 specifics.set_address_home_country(UTF16ToUTF8(profile.GetFieldText( | 340 specifics.set_address_home_country(UTF16ToUTF8(profile.GetFieldText( |
344 AutofillType(ADDRESS_HOME_COUNTRY)))); | 341 ADDRESS_HOME_COUNTRY))); |
345 specifics.set_address_home_zip(UTF16ToUTF8(profile.GetFieldText( | 342 specifics.set_address_home_zip(UTF16ToUTF8(profile.GetFieldText( |
346 AutofillType(ADDRESS_HOME_ZIP)))); | 343 ADDRESS_HOME_ZIP))); |
347 specifics.set_email_address(UTF16ToUTF8(profile.GetFieldText( | 344 specifics.set_email_address(UTF16ToUTF8(profile.GetFieldText(EMAIL_ADDRESS))); |
348 AutofillType(EMAIL_ADDRESS)))); | 345 specifics.set_company_name(UTF16ToUTF8(profile.GetFieldText(COMPANY_NAME))); |
349 specifics.set_company_name(UTF16ToUTF8(profile.GetFieldText( | |
350 AutofillType(COMPANY_NAME)))); | |
351 specifics.set_phone_fax_whole_number(UTF16ToUTF8(profile.GetFieldText( | 346 specifics.set_phone_fax_whole_number(UTF16ToUTF8(profile.GetFieldText( |
352 AutofillType(PHONE_FAX_WHOLE_NUMBER)))); | 347 PHONE_FAX_WHOLE_NUMBER))); |
353 specifics.set_phone_home_whole_number(UTF16ToUTF8(profile.GetFieldText( | 348 specifics.set_phone_home_whole_number(UTF16ToUTF8(profile.GetFieldText( |
354 AutofillType(PHONE_HOME_WHOLE_NUMBER)))); | 349 PHONE_HOME_WHOLE_NUMBER))); |
355 node->SetAutofillProfileSpecifics(specifics); | 350 node->SetAutofillProfileSpecifics(specifics); |
356 } | 351 } |
357 | 352 |
358 } // namespace browser_sync | 353 } // namespace browser_sync |
OLD | NEW |