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