| 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_data_type_controller.h" | 5 #include "chrome/browser/sync/glue/autofill_profile_data_type_controller.h" |
| 6 | 6 |
| 7 #include "chrome/browser/sync/glue/autofill_data_type_controller.h" | 7 #include "base/metrics/histogram.h" |
| 8 #include "chrome/browser/sync/profile_sync_factory.h" | 8 #include "chrome/browser/sync/profile_sync_factory.h" |
| 9 | 9 |
| 10 namespace browser_sync { | 10 namespace browser_sync { |
| 11 | 11 |
| 12 AutofillProfileDataTypeController::AutofillProfileDataTypeController( | 12 AutofillProfileDataTypeController::AutofillProfileDataTypeController( |
| 13 ProfileSyncFactory* profile_sync_factory, | 13 ProfileSyncFactory* profile_sync_factory, |
| 14 Profile* profile, | 14 Profile* profile, |
| 15 ProfileSyncService* sync_service) : AutofillDataTypeController( | 15 ProfileSyncService* sync_service) : AutofillDataTypeController( |
| 16 profile_sync_factory, | 16 profile_sync_factory, |
| 17 profile, | 17 profile, |
| 18 sync_service) {} | 18 sync_service) {} |
| 19 | 19 |
| 20 AutofillProfileDataTypeController::~AutofillProfileDataTypeController() {} | 20 AutofillProfileDataTypeController::~AutofillProfileDataTypeController() {} |
| 21 | 21 |
| 22 syncable::ModelType AutofillProfileDataTypeController::type() const { | 22 syncable::ModelType AutofillProfileDataTypeController::type() const { |
| 23 return syncable::AUTOFILL_PROFILE; | 23 return syncable::AUTOFILL_PROFILE; |
| 24 } | 24 } |
| 25 | 25 |
| 26 std::string AutofillProfileDataTypeController::name() const { | 26 void AutofillProfileDataTypeController::CreateSyncComponents() { |
| 27 // For logging only. | 27 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); |
| 28 return "autofill_profile"; | 28 ProfileSyncFactory::SyncComponents sync_components = profile_sync_factory_-> |
| 29 CreateAutofillProfileSyncComponents( |
| 30 sync_service_, |
| 31 web_data_service_->GetDatabase(), |
| 32 personal_data_, |
| 33 this); |
| 34 model_associator_.reset(sync_components.model_associator); |
| 35 change_processor_.reset(sync_components.change_processor); |
| 29 } | 36 } |
| 30 | 37 |
| 31 ProfileSyncFactory::SyncComponents | 38 void AutofillProfileDataTypeController::RecordUnrecoverableError( |
| 32 AutofillProfileDataTypeController::CreateSyncComponents( | 39 const tracked_objects::Location& from_here, |
| 33 ProfileSyncService* profile_sync_service, | 40 const std::string& message) { |
| 34 WebDatabase* web_database, | 41 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); |
| 35 PersonalDataManager* personal_data, | 42 UMA_HISTOGRAM_COUNTS("Sync.AutofillProfileRunFailures", 1); |
| 36 browser_sync::UnrecoverableErrorHandler* error_handler) { | |
| 37 return profile_sync_factory_->CreateAutofillProfileSyncComponents( | |
| 38 profile_sync_service, | |
| 39 web_database, | |
| 40 personal_data, | |
| 41 this); | |
| 42 } | 43 } |
| 44 |
| 45 void AutofillProfileDataTypeController::RecordAssociationTime( |
| 46 base::TimeDelta time) { |
| 47 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); |
| 48 UMA_HISTOGRAM_TIMES("Sync.AutofillProfileAssociationTime", time); |
| 49 } |
| 50 |
| 51 void AutofillProfileDataTypeController::RecordStartFailure(StartResult result) { |
| 52 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 53 UMA_HISTOGRAM_ENUMERATION("Sync.AutofillProfileStartFailures", |
| 54 result, |
| 55 MAX_START_RESULT); |
| 56 } |
| 57 |
| 43 } // namepsace browser_sync | 58 } // namepsace browser_sync |
| 44 | 59 |
| OLD | NEW |