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

Side by Side Diff: chrome/browser/webdata/autofill_profile_syncable_service.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: 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/webdata/autofill_profile_syncable_service.h" 5 #include "chrome/browser/webdata/autofill_profile_syncable_service.h"
6 6
7 #include "base/guid.h" 7 #include "base/guid.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
11 #include "chrome/browser/browser_process.h"
12 #include "components/autofill/browser/autofill_country.h"
11 #include "components/autofill/browser/autofill_profile.h" 13 #include "components/autofill/browser/autofill_profile.h"
12 #include "components/autofill/browser/form_group.h" 14 #include "components/autofill/browser/form_group.h"
13 #include "components/webdata/autofill/autofill_table.h" 15 #include "components/webdata/autofill/autofill_table.h"
14 #include "components/webdata/autofill/autofill_webdata_service.h" 16 #include "components/webdata/autofill/autofill_webdata_service.h"
15 #include "components/webdata/common/web_database.h" 17 #include "components/webdata/common/web_database.h"
16 #include "content/public/browser/browser_thread.h" 18 #include "content/public/browser/browser_thread.h"
17 #include "sync/api/sync_error.h" 19 #include "sync/api/sync_error.h"
18 #include "sync/api/sync_error_factory.h" 20 #include "sync/api/sync_error_factory.h"
19 #include "sync/protocol/sync.pb.h" 21 #include "sync/protocol/sync.pb.h"
20 22
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 diff = UpdateMultivaluedField(NAME_LAST, 310 diff = UpdateMultivaluedField(NAME_LAST,
309 specifics.name_last(), profile) || diff; 311 specifics.name_last(), profile) || diff;
310 diff = UpdateField(ADDRESS_HOME_LINE1, 312 diff = UpdateField(ADDRESS_HOME_LINE1,
311 specifics.address_home_line1(), profile) || diff; 313 specifics.address_home_line1(), profile) || diff;
312 diff = UpdateField(ADDRESS_HOME_LINE2, 314 diff = UpdateField(ADDRESS_HOME_LINE2,
313 specifics.address_home_line2(), profile) || diff; 315 specifics.address_home_line2(), profile) || diff;
314 diff = UpdateField(ADDRESS_HOME_CITY, 316 diff = UpdateField(ADDRESS_HOME_CITY,
315 specifics.address_home_city(), profile) || diff; 317 specifics.address_home_city(), profile) || diff;
316 diff = UpdateField(ADDRESS_HOME_STATE, 318 diff = UpdateField(ADDRESS_HOME_STATE,
317 specifics.address_home_state(), profile) || diff; 319 specifics.address_home_state(), profile) || diff;
318 diff = UpdateField(ADDRESS_HOME_COUNTRY, 320 string16 country_name_or_code =
319 specifics.address_home_country(), profile) || diff; 321 ASCIIToUTF16(specifics.address_home_country());
322 std::string country_code = AutofillCountry::GetCountryCode(
323 country_name_or_code, g_browser_process->GetApplicationLocale());
Ilya Sherman 2013/04/05 05:18:01 Again, this happens on the DB thread (I think), so
jam 2013/04/05 06:45:54 Done.
jam 2013/04/05 06:45:54 Done.
324 diff = UpdateField(ADDRESS_HOME_COUNTRY, country_code, profile) || diff;
320 diff = UpdateField(ADDRESS_HOME_ZIP, 325 diff = UpdateField(ADDRESS_HOME_ZIP,
321 specifics.address_home_zip(), profile) || diff; 326 specifics.address_home_zip(), profile) || diff;
322 diff = UpdateMultivaluedField(EMAIL_ADDRESS, 327 diff = UpdateMultivaluedField(EMAIL_ADDRESS,
323 specifics.email_address(), profile) || diff; 328 specifics.email_address(), profile) || diff;
324 diff = UpdateField(COMPANY_NAME, specifics.company_name(), profile) || diff; 329 diff = UpdateField(COMPANY_NAME, specifics.company_name(), profile) || diff;
325 diff = UpdateMultivaluedField(PHONE_HOME_WHOLE_NUMBER, 330 diff = UpdateMultivaluedField(PHONE_HOME_WHOLE_NUMBER,
326 specifics.phone_home_whole_number(), 331 specifics.phone_home_whole_number(),
327 profile) || diff; 332 profile) || diff;
328 return diff; 333 return diff;
329 } 334 }
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 return (merge_into->Compare(merge_from) != 0); 561 return (merge_into->Compare(merge_from) != 0);
557 } 562 }
558 563
559 AutofillTable* AutofillProfileSyncableService::GetAutofillTable() const { 564 AutofillTable* AutofillProfileSyncableService::GetAutofillTable() const {
560 return AutofillTable::FromWebDatabase(web_data_service_->GetDatabase()); 565 return AutofillTable::FromWebDatabase(web_data_service_->GetDatabase());
561 } 566 }
562 567
563 AutofillProfileSyncableService::DataBundle::DataBundle() {} 568 AutofillProfileSyncableService::DataBundle::DataBundle() {}
564 569
565 AutofillProfileSyncableService::DataBundle::~DataBundle() {} 570 AutofillProfileSyncableService::DataBundle::~DataBundle() {}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698