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/webdata/autofill_profile_syncable_service.h" | 5 #include "chrome/browser/webdata/autofill_profile_syncable_service.h" |
6 | 6 |
7 #include "base/location.h" | 7 #include "base/location.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/autofill/autofill_profile.h" | 10 #include "chrome/browser/autofill/autofill_profile.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 AutofillFieldType field_type, | 27 AutofillFieldType field_type, |
28 const std::string& specifics_field) { | 28 const std::string& specifics_field) { |
29 if (UTF16ToUTF8(form_group->GetInfo(field_type)) == specifics_field) | 29 if (UTF16ToUTF8(form_group->GetInfo(field_type)) == specifics_field) |
30 return false; | 30 return false; |
31 form_group->SetInfo(field_type, UTF8ToUTF16(specifics_field)); | 31 form_group->SetInfo(field_type, UTF8ToUTF16(specifics_field)); |
32 return true; | 32 return true; |
33 } | 33 } |
34 | 34 |
35 } // namespace | 35 } // namespace |
36 | 36 |
37 namespace browser_sync { | |
38 | |
39 const char kAutofillProfileTag[] = "google_chrome_autofill_profiles"; | 37 const char kAutofillProfileTag[] = "google_chrome_autofill_profiles"; |
40 | 38 |
41 AutofillProfileSyncableService::AutofillProfileSyncableService( | 39 AutofillProfileSyncableService::AutofillProfileSyncableService( |
42 WebDatabase* web_database, | 40 WebDatabase* web_database, |
43 Profile* profile) | 41 Profile* profile) |
44 : web_database_(web_database), | 42 : web_database_(web_database), |
45 profile_(profile), | 43 profile_(profile), |
46 sync_processor_(NULL) { | 44 sync_processor_(NULL) { |
47 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); | 45 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); |
48 DCHECK(web_database_); | 46 DCHECK(web_database_); |
49 DCHECK(profile); | 47 DCHECK(profile); |
50 notification_registrar_.Add(this, | 48 notification_registrar_.Add(this, |
51 chrome::NOTIFICATION_AUTOFILL_PROFILE_CHANGED, | 49 chrome::NOTIFICATION_AUTOFILL_PROFILE_CHANGED, |
52 Source<WebDataService>( | 50 Source<WebDataService>( |
53 profile_->GetWebDataService(Profile::EXPLICIT_ACCESS))); | 51 profile_->GetWebDataService(Profile::EXPLICIT_ACCESS))); |
54 } | 52 } |
55 | 53 |
56 AutofillProfileSyncableService::~AutofillProfileSyncableService() { | 54 AutofillProfileSyncableService::~AutofillProfileSyncableService() { |
57 DCHECK(CalledOnValidThread()); | 55 DCHECK(CalledOnValidThread()); |
58 } | 56 } |
59 | 57 |
60 AutofillProfileSyncableService::AutofillProfileSyncableService() | 58 AutofillProfileSyncableService::AutofillProfileSyncableService() |
61 : web_database_(NULL), | 59 : web_database_(NULL), |
62 profile_(NULL), | 60 profile_(NULL), |
63 sync_processor_(NULL) { | 61 sync_processor_(NULL) { |
| 62 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); |
64 } | 63 } |
65 | 64 |
66 SyncError AutofillProfileSyncableService::MergeDataAndStartSyncing( | 65 SyncError AutofillProfileSyncableService::MergeDataAndStartSyncing( |
67 syncable::ModelType type, | 66 syncable::ModelType type, |
68 const SyncDataList& initial_sync_data, | 67 const SyncDataList& initial_sync_data, |
69 SyncChangeProcessor* sync_processor) { | 68 SyncChangeProcessor* sync_processor) { |
70 DCHECK(CalledOnValidThread()); | 69 DCHECK(CalledOnValidThread()); |
71 DCHECK(sync_processor_ == NULL); | 70 DCHECK(sync_processor_ == NULL); |
72 VLOG(1) << "Associating Autofill: MergeDataAndStartSyncing"; | 71 VLOG(1) << "Associating Autofill: MergeDataAndStartSyncing"; |
73 | 72 |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 const AutofillProfile& profile) { | 404 const AutofillProfile& profile) { |
406 sync_pb::EntitySpecifics specifics; | 405 sync_pb::EntitySpecifics specifics; |
407 WriteAutofillProfile(profile, &specifics); | 406 WriteAutofillProfile(profile, &specifics); |
408 return SyncData::CreateLocalData(profile.guid(), profile.guid(), specifics); | 407 return SyncData::CreateLocalData(profile.guid(), profile.guid(), specifics); |
409 } | 408 } |
410 | 409 |
411 AutofillProfileSyncableService::DataBundle::DataBundle() {} | 410 AutofillProfileSyncableService::DataBundle::DataBundle() {} |
412 | 411 |
413 AutofillProfileSyncableService::DataBundle::~DataBundle() { | 412 AutofillProfileSyncableService::DataBundle::~DataBundle() { |
414 } | 413 } |
415 | |
416 } // namespace browser_sync | |
OLD | NEW |