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

Side by Side Diff: chrome/browser/webdata/autofill_profile_syncable_service.cc

Issue 22009003: [Autofill] Distinguish between native field types and potentially HTML field types. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 4 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/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
11 #include "components/autofill/core/browser/autofill_country.h" 11 #include "components/autofill/core/browser/autofill_country.h"
12 #include "components/autofill/core/browser/autofill_profile.h" 12 #include "components/autofill/core/browser/autofill_profile.h"
13 #include "components/autofill/core/browser/form_group.h" 13 #include "components/autofill/core/browser/form_group.h"
14 #include "components/autofill/core/browser/webdata/autofill_table.h" 14 #include "components/autofill/core/browser/webdata/autofill_table.h"
15 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" 15 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h"
16 #include "components/webdata/common/web_database.h" 16 #include "components/webdata/common/web_database.h"
17 #include "content/public/browser/browser_thread.h" 17 #include "content/public/browser/browser_thread.h"
18 #include "sync/api/sync_error.h" 18 #include "sync/api/sync_error.h"
19 #include "sync/api/sync_error_factory.h" 19 #include "sync/api/sync_error_factory.h"
20 #include "sync/protocol/sync.pb.h" 20 #include "sync/protocol/sync.pb.h"
21 21
22 using autofill::AutofillCountry; 22 using autofill::AutofillCountry;
23 using autofill::AutofillFieldType; 23 using autofill::ServerFieldType;
24 using autofill::AutofillProfile; 24 using autofill::AutofillProfile;
25 using autofill::AutofillProfileChange; 25 using autofill::AutofillProfileChange;
26 using autofill::AutofillTable; 26 using autofill::AutofillTable;
27 using autofill::AutofillWebDataService; 27 using autofill::AutofillWebDataService;
28 using content::BrowserThread; 28 using content::BrowserThread;
29 29
30 namespace { 30 namespace {
31 31
32 std::string LimitData(const std::string& data) { 32 std::string LimitData(const std::string& data) {
33 std::string sanitized_value(data); 33 std::string sanitized_value(data);
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 syncer::SyncData AutofillProfileSyncableService::CreateData( 559 syncer::SyncData AutofillProfileSyncableService::CreateData(
560 const AutofillProfile& profile) { 560 const AutofillProfile& profile) {
561 sync_pb::EntitySpecifics specifics; 561 sync_pb::EntitySpecifics specifics;
562 WriteAutofillProfile(profile, &specifics); 562 WriteAutofillProfile(profile, &specifics);
563 return 563 return
564 syncer::SyncData::CreateLocalData( 564 syncer::SyncData::CreateLocalData(
565 profile.guid(), profile.guid(), specifics); 565 profile.guid(), profile.guid(), specifics);
566 } 566 }
567 567
568 bool AutofillProfileSyncableService::UpdateField( 568 bool AutofillProfileSyncableService::UpdateField(
569 AutofillFieldType field_type, 569 ServerFieldType field_type,
570 const std::string& new_value, 570 const std::string& new_value,
571 AutofillProfile* autofill_profile) { 571 AutofillProfile* autofill_profile) {
572 if (UTF16ToUTF8(autofill_profile->GetRawInfo(field_type)) == new_value) 572 if (UTF16ToUTF8(autofill_profile->GetRawInfo(field_type)) == new_value)
573 return false; 573 return false;
574 autofill_profile->SetRawInfo(field_type, UTF8ToUTF16(new_value)); 574 autofill_profile->SetRawInfo(field_type, UTF8ToUTF16(new_value));
575 return true; 575 return true;
576 } 576 }
577 577
578 bool AutofillProfileSyncableService::UpdateMultivaluedField( 578 bool AutofillProfileSyncableService::UpdateMultivaluedField(
579 AutofillFieldType field_type, 579 ServerFieldType field_type,
580 const ::google::protobuf::RepeatedPtrField<std::string>& new_values, 580 const ::google::protobuf::RepeatedPtrField<std::string>& new_values,
581 AutofillProfile* autofill_profile) { 581 AutofillProfile* autofill_profile) {
582 std::vector<string16> values; 582 std::vector<string16> values;
583 autofill_profile->GetRawMultiInfo(field_type, &values); 583 autofill_profile->GetRawMultiInfo(field_type, &values);
584 bool changed = false; 584 bool changed = false;
585 if (static_cast<size_t>(new_values.size()) != values.size()) { 585 if (static_cast<size_t>(new_values.size()) != values.size()) {
586 values.clear(); 586 values.clear();
587 values.resize(static_cast<size_t>(new_values.size())); 587 values.resize(static_cast<size_t>(new_values.size()));
588 changed = true; 588 changed = true;
589 } 589 }
(...skipping 24 matching lines...) Expand all
614 } 614 }
615 615
616 void AutofillProfileSyncableService::InjectStartSyncFlare( 616 void AutofillProfileSyncableService::InjectStartSyncFlare(
617 const syncer::SyncableService::StartSyncFlare& flare) { 617 const syncer::SyncableService::StartSyncFlare& flare) {
618 flare_ = flare; 618 flare_ = flare;
619 } 619 }
620 620
621 AutofillProfileSyncableService::DataBundle::DataBundle() {} 621 AutofillProfileSyncableService::DataBundle::DataBundle() {}
622 622
623 AutofillProfileSyncableService::DataBundle::~DataBundle() {} 623 AutofillProfileSyncableService::DataBundle::~DataBundle() {}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698