| 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 WebDataService* web_data_service) | 40 WebDataService* web_data_service) |
| 43 : web_data_service_(web_data_service), | 41 : web_data_service_(web_data_service), |
| 44 sync_processor_(NULL) { | 42 sync_processor_(NULL) { |
| 45 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); | 43 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); |
| 46 DCHECK(web_data_service_); | 44 DCHECK(web_data_service_); |
| 47 notification_registrar_.Add(this, | 45 notification_registrar_.Add(this, |
| 48 chrome::NOTIFICATION_AUTOFILL_PROFILE_CHANGED, | 46 chrome::NOTIFICATION_AUTOFILL_PROFILE_CHANGED, |
| 49 Source<WebDataService>(web_data_service_)); | 47 Source<WebDataService>(web_data_service_)); |
| 50 } | 48 } |
| 51 | 49 |
| 52 AutofillProfileSyncableService::~AutofillProfileSyncableService() { | 50 AutofillProfileSyncableService::~AutofillProfileSyncableService() { |
| 53 DCHECK(CalledOnValidThread()); | 51 DCHECK(CalledOnValidThread()); |
| 54 } | 52 } |
| 55 | 53 |
| 56 AutofillProfileSyncableService::AutofillProfileSyncableService() | 54 AutofillProfileSyncableService::AutofillProfileSyncableService() |
| 57 : web_data_service_(NULL), | 55 : web_data_service_(NULL), |
| 58 sync_processor_(NULL) { | 56 sync_processor_(NULL) { |
| 57 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); |
| 59 } | 58 } |
| 60 | 59 |
| 61 SyncError AutofillProfileSyncableService::MergeDataAndStartSyncing( | 60 SyncError AutofillProfileSyncableService::MergeDataAndStartSyncing( |
| 62 syncable::ModelType type, | 61 syncable::ModelType type, |
| 63 const SyncDataList& initial_sync_data, | 62 const SyncDataList& initial_sync_data, |
| 64 SyncChangeProcessor* sync_processor) { | 63 SyncChangeProcessor* sync_processor) { |
| 65 DCHECK(CalledOnValidThread()); | 64 DCHECK(CalledOnValidThread()); |
| 66 DCHECK(sync_processor_ == NULL); | 65 DCHECK(sync_processor_ == NULL); |
| 67 VLOG(1) << "Associating Autofill: MergeDataAndStartSyncing"; | 66 VLOG(1) << "Associating Autofill: MergeDataAndStartSyncing"; |
| 68 | 67 |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 } | 400 } |
| 402 | 401 |
| 403 AutofillTable* AutofillProfileSyncableService::GetAutofillTable() const { | 402 AutofillTable* AutofillProfileSyncableService::GetAutofillTable() const { |
| 404 return web_data_service_->GetDatabase()->GetAutofillTable(); | 403 return web_data_service_->GetDatabase()->GetAutofillTable(); |
| 405 } | 404 } |
| 406 | 405 |
| 407 AutofillProfileSyncableService::DataBundle::DataBundle() {} | 406 AutofillProfileSyncableService::DataBundle::DataBundle() {} |
| 408 | 407 |
| 409 AutofillProfileSyncableService::DataBundle::~DataBundle() { | 408 AutofillProfileSyncableService::DataBundle::~DataBundle() { |
| 410 } | 409 } |
| 411 | |
| 412 } // namespace browser_sync | |
| OLD | NEW |