| 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/search_engine_data_type_controller.h" | 5 #include "chrome/browser/sync/glue/search_engine_data_type_controller.h" |
| 6 | 6 |
| 7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
| 8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
| 9 #include "chrome/browser/search_engines/template_url_service.h" | 9 #include "chrome/browser/search_engines/template_url_service.h" |
| 10 #include "chrome/browser/search_engines/template_url_service_factory.h" | 10 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 11 #include "chrome/browser/sync/api/syncable_service.h" | 11 #include "chrome/browser/sync/api/syncable_service.h" |
| 12 #include "chrome/browser/sync/glue/generic_change_processor.h" | |
| 13 #include "chrome/browser/sync/profile_sync_factory.h" | 12 #include "chrome/browser/sync/profile_sync_factory.h" |
| 14 #include "chrome/browser/sync/profile_sync_service.h" | 13 #include "chrome/browser/sync/profile_sync_service.h" |
| 15 #include "chrome/common/chrome_notification_types.h" | 14 #include "chrome/common/chrome_notification_types.h" |
| 16 #include "content/common/notification_source.h" | 15 #include "content/common/notification_source.h" |
| 17 | 16 |
| 18 namespace browser_sync { | 17 namespace browser_sync { |
| 19 | 18 |
| 20 SearchEngineDataTypeController::SearchEngineDataTypeController( | 19 SearchEngineDataTypeController::SearchEngineDataTypeController( |
| 21 ProfileSyncFactory* profile_sync_factory, | 20 ProfileSyncFactory* profile_sync_factory, |
| 22 Profile* profile, | 21 Profile* profile, |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 // Cleanup for our extra registrar usage. | 62 // Cleanup for our extra registrar usage. |
| 64 void SearchEngineDataTypeController::CleanUpState() { | 63 void SearchEngineDataTypeController::CleanUpState() { |
| 65 registrar_.RemoveAll(); | 64 registrar_.RemoveAll(); |
| 66 } | 65 } |
| 67 | 66 |
| 68 void SearchEngineDataTypeController::CreateSyncComponents() { | 67 void SearchEngineDataTypeController::CreateSyncComponents() { |
| 69 ProfileSyncFactory::SyncComponents sync_components = | 68 ProfileSyncFactory::SyncComponents sync_components = |
| 70 profile_sync_factory_->CreateSearchEngineSyncComponents(sync_service_, | 69 profile_sync_factory_->CreateSearchEngineSyncComponents(sync_service_, |
| 71 this); | 70 this); |
| 72 set_model_associator(sync_components.model_associator); | 71 set_model_associator(sync_components.model_associator); |
| 73 set_change_processor(sync_components.change_processor); | 72 generic_change_processor_.reset(static_cast<GenericChangeProcessor*>( |
| 73 sync_components.change_processor)); |
| 74 } |
| 75 |
| 76 GenericChangeProcessor* SearchEngineDataTypeController::change_processor() |
| 77 const { |
| 78 return generic_change_processor_.get(); |
| 74 } | 79 } |
| 75 | 80 |
| 76 void SearchEngineDataTypeController::RecordUnrecoverableError( | 81 void SearchEngineDataTypeController::RecordUnrecoverableError( |
| 77 const tracked_objects::Location& from_here, | 82 const tracked_objects::Location& from_here, |
| 78 const std::string& message) { | 83 const std::string& message) { |
| 79 UMA_HISTOGRAM_COUNTS("Sync.SearchEngineRunFailures", 1); | 84 UMA_HISTOGRAM_COUNTS("Sync.SearchEngineRunFailures", 1); |
| 80 } | 85 } |
| 81 | 86 |
| 82 void SearchEngineDataTypeController::RecordAssociationTime( | 87 void SearchEngineDataTypeController::RecordAssociationTime( |
| 83 base::TimeDelta time) { | 88 base::TimeDelta time) { |
| 84 UMA_HISTOGRAM_TIMES("Sync.SearchEngineAssociationTime", time); | 89 UMA_HISTOGRAM_TIMES("Sync.SearchEngineAssociationTime", time); |
| 85 } | 90 } |
| 86 | 91 |
| 87 void SearchEngineDataTypeController::RecordStartFailure(StartResult result) { | 92 void SearchEngineDataTypeController::RecordStartFailure(StartResult result) { |
| 88 UMA_HISTOGRAM_ENUMERATION("Sync.SearchEngineStartFailures", | 93 UMA_HISTOGRAM_ENUMERATION("Sync.SearchEngineStartFailures", |
| 89 result, | 94 result, |
| 90 MAX_START_RESULT); | 95 MAX_START_RESULT); |
| 91 } | 96 } |
| 92 | 97 |
| 93 } // namespace browser_sync | 98 } // namespace browser_sync |
| OLD | NEW |