OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "build/build_config.h" | 6 #include "build/build_config.h" |
7 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 7 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
8 #include "chrome/browser/bookmarks/enhanced_bookmarks_features.h" | 8 #include "chrome/browser/bookmarks/enhanced_bookmarks_features.h" |
9 #include "chrome/browser/dom_distiller/dom_distiller_service_factory.h" | 9 #include "chrome/browser/dom_distiller/dom_distiller_service_factory.h" |
10 #include "chrome/browser/history/history_service.h" | 10 #include "chrome/browser/history/history_service.h" |
11 #include "chrome/browser/history/history_service_factory.h" | 11 #include "chrome/browser/history/history_service_factory.h" |
12 #include "chrome/browser/notifications/sync_notifier/chrome_notifier_service.h" | 12 #include "chrome/browser/notifications/sync_notifier/chrome_notifier_service.h" |
13 #include "chrome/browser/notifications/sync_notifier/chrome_notifier_service_fac
tory.h" | 13 #include "chrome/browser/notifications/sync_notifier/chrome_notifier_service_fac
tory.h" |
14 #include "chrome/browser/password_manager/password_store_factory.h" | 14 #include "chrome/browser/password_manager/password_store_factory.h" |
15 #include "chrome/browser/pref_service_flags_storage.h" | 15 #include "chrome/browser/pref_service_flags_storage.h" |
16 #include "chrome/browser/prefs/pref_model_associator.h" | 16 #include "chrome/browser/prefs/pref_model_associator.h" |
17 #include "chrome/browser/prefs/pref_service_syncable.h" | 17 #include "chrome/browser/prefs/pref_service_syncable.h" |
18 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
19 #include "chrome/browser/search_engines/template_url_service_factory.h" | 19 #include "chrome/browser/search_engines/template_url_service_factory.h" |
20 #include "chrome/browser/signin/signin_manager_factory.h" | 20 #include "chrome/browser/signin/signin_manager_factory.h" |
21 #include "chrome/browser/sync/glue/autofill_data_type_controller.h" | 21 #include "chrome/browser/sync/glue/autofill_data_type_controller.h" |
22 #include "chrome/browser/sync/glue/autofill_profile_data_type_controller.h" | 22 #include "chrome/browser/sync/glue/autofill_profile_data_type_controller.h" |
23 #include "chrome/browser/sync/glue/bookmark_change_processor.h" | 23 #include "chrome/browser/sync/glue/bookmark_change_processor.h" |
24 #include "chrome/browser/sync/glue/bookmark_data_type_controller.h" | 24 #include "chrome/browser/sync/glue/bookmark_data_type_controller.h" |
25 #include "chrome/browser/sync/glue/bookmark_model_associator.h" | 25 #include "chrome/browser/sync/glue/bookmark_model_associator.h" |
26 #include "chrome/browser/sync/glue/chrome_report_unrecoverable_error.h" | 26 #include "chrome/browser/sync/glue/chrome_report_unrecoverable_error.h" |
27 #include "chrome/browser/sync/glue/device_info_data_type_controller.h" | |
28 #include "chrome/browser/sync/glue/extension_backed_data_type_controller.h" | 27 #include "chrome/browser/sync/glue/extension_backed_data_type_controller.h" |
29 #include "chrome/browser/sync/glue/extension_data_type_controller.h" | 28 #include "chrome/browser/sync/glue/extension_data_type_controller.h" |
30 #include "chrome/browser/sync/glue/extension_setting_data_type_controller.h" | 29 #include "chrome/browser/sync/glue/extension_setting_data_type_controller.h" |
31 #include "chrome/browser/sync/glue/history_delete_directives_data_type_controlle
r.h" | 30 #include "chrome/browser/sync/glue/history_delete_directives_data_type_controlle
r.h" |
32 #include "chrome/browser/sync/glue/local_device_info_provider_impl.h" | 31 #include "chrome/browser/sync/glue/local_device_info_provider_impl.h" |
33 #include "chrome/browser/sync/glue/password_data_type_controller.h" | 32 #include "chrome/browser/sync/glue/password_data_type_controller.h" |
34 #include "chrome/browser/sync/glue/search_engine_data_type_controller.h" | 33 #include "chrome/browser/sync/glue/search_engine_data_type_controller.h" |
35 #include "chrome/browser/sync/glue/sync_backend_host.h" | 34 #include "chrome/browser/sync/glue/sync_backend_host.h" |
36 #include "chrome/browser/sync/glue/sync_backend_host_impl.h" | 35 #include "chrome/browser/sync/glue/sync_backend_host_impl.h" |
37 #include "chrome/browser/sync/glue/theme_data_type_controller.h" | 36 #include "chrome/browser/sync/glue/theme_data_type_controller.h" |
(...skipping 13 matching lines...) Expand all Loading... |
51 #include "chrome/common/chrome_version_info.h" | 50 #include "chrome/common/chrome_version_info.h" |
52 #include "chrome/common/pref_names.h" | 51 #include "chrome/common/pref_names.h" |
53 #include "components/autofill/core/browser/webdata/autofill_profile_syncable_ser
vice.h" | 52 #include "components/autofill/core/browser/webdata/autofill_profile_syncable_ser
vice.h" |
54 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" | 53 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" |
55 #include "components/dom_distiller/core/dom_distiller_service.h" | 54 #include "components/dom_distiller/core/dom_distiller_service.h" |
56 #include "components/password_manager/core/browser/password_store.h" | 55 #include "components/password_manager/core/browser/password_store.h" |
57 #include "components/search_engines/template_url_service.h" | 56 #include "components/search_engines/template_url_service.h" |
58 #include "components/signin/core/browser/signin_manager.h" | 57 #include "components/signin/core/browser/signin_manager.h" |
59 #include "components/sync_driver/data_type_manager_impl.h" | 58 #include "components/sync_driver/data_type_manager_impl.h" |
60 #include "components/sync_driver/data_type_manager_observer.h" | 59 #include "components/sync_driver/data_type_manager_observer.h" |
| 60 #include "components/sync_driver/device_info_data_type_controller.h" |
61 #include "components/sync_driver/generic_change_processor.h" | 61 #include "components/sync_driver/generic_change_processor.h" |
62 #include "components/sync_driver/proxy_data_type_controller.h" | 62 #include "components/sync_driver/proxy_data_type_controller.h" |
63 #include "components/sync_driver/shared_change_processor.h" | 63 #include "components/sync_driver/shared_change_processor.h" |
64 #include "components/sync_driver/ui_data_type_controller.h" | 64 #include "components/sync_driver/ui_data_type_controller.h" |
65 #include "content/public/browser/browser_thread.h" | 65 #include "content/public/browser/browser_thread.h" |
66 #include "google_apis/gaia/oauth2_token_service_request.h" | 66 #include "google_apis/gaia/oauth2_token_service_request.h" |
67 #include "net/url_request/url_request_context_getter.h" | 67 #include "net/url_request/url_request_context_getter.h" |
68 #include "sync/api/attachments/fake_attachment_store.h" | 68 #include "sync/api/attachments/fake_attachment_store.h" |
69 #include "sync/api/syncable_service.h" | 69 #include "sync/api/syncable_service.h" |
70 #include "sync/internal_api/public/attachments/attachment_downloader.h" | 70 #include "sync/internal_api/public/attachments/attachment_downloader.h" |
(...skipping 27 matching lines...) Expand all Loading... |
98 #include "chrome/browser/spellchecker/spellcheck_factory.h" | 98 #include "chrome/browser/spellchecker/spellcheck_factory.h" |
99 #include "chrome/browser/spellchecker/spellcheck_service.h" | 99 #include "chrome/browser/spellchecker/spellcheck_service.h" |
100 #endif | 100 #endif |
101 | 101 |
102 using browser_sync::AutofillDataTypeController; | 102 using browser_sync::AutofillDataTypeController; |
103 using browser_sync::AutofillProfileDataTypeController; | 103 using browser_sync::AutofillProfileDataTypeController; |
104 using browser_sync::BookmarkChangeProcessor; | 104 using browser_sync::BookmarkChangeProcessor; |
105 using browser_sync::BookmarkDataTypeController; | 105 using browser_sync::BookmarkDataTypeController; |
106 using browser_sync::BookmarkModelAssociator; | 106 using browser_sync::BookmarkModelAssociator; |
107 using browser_sync::ChromeReportUnrecoverableError; | 107 using browser_sync::ChromeReportUnrecoverableError; |
108 using browser_sync::DeviceInfoDataTypeController; | |
109 using browser_sync::ExtensionBackedDataTypeController; | 108 using browser_sync::ExtensionBackedDataTypeController; |
110 using browser_sync::ExtensionDataTypeController; | 109 using browser_sync::ExtensionDataTypeController; |
111 using browser_sync::ExtensionSettingDataTypeController; | 110 using browser_sync::ExtensionSettingDataTypeController; |
112 using browser_sync::HistoryDeleteDirectivesDataTypeController; | 111 using browser_sync::HistoryDeleteDirectivesDataTypeController; |
113 using browser_sync::PasswordDataTypeController; | 112 using browser_sync::PasswordDataTypeController; |
114 using browser_sync::SearchEngineDataTypeController; | 113 using browser_sync::SearchEngineDataTypeController; |
115 using browser_sync::SessionDataTypeController; | 114 using browser_sync::SessionDataTypeController; |
116 using browser_sync::SyncBackendHost; | 115 using browser_sync::SyncBackendHost; |
117 using browser_sync::ThemeDataTypeController; | 116 using browser_sync::ThemeDataTypeController; |
118 using browser_sync::TypedUrlChangeProcessor; | 117 using browser_sync::TypedUrlChangeProcessor; |
119 using browser_sync::TypedUrlDataTypeController; | 118 using browser_sync::TypedUrlDataTypeController; |
120 using browser_sync::TypedUrlModelAssociator; | 119 using browser_sync::TypedUrlModelAssociator; |
121 using content::BrowserThread; | 120 using content::BrowserThread; |
122 using sync_driver::DataTypeController; | 121 using sync_driver::DataTypeController; |
123 using sync_driver::DataTypeErrorHandler; | 122 using sync_driver::DataTypeErrorHandler; |
124 using sync_driver::DataTypeManager; | 123 using sync_driver::DataTypeManager; |
125 using sync_driver::DataTypeManagerImpl; | 124 using sync_driver::DataTypeManagerImpl; |
126 using sync_driver::DataTypeManagerObserver; | 125 using sync_driver::DataTypeManagerObserver; |
| 126 using sync_driver::DeviceInfoDataTypeController; |
127 using sync_driver::ProxyDataTypeController; | 127 using sync_driver::ProxyDataTypeController; |
128 using sync_driver::SharedChangeProcessor; | 128 using sync_driver::SharedChangeProcessor; |
129 using sync_driver::UIDataTypeController; | 129 using sync_driver::UIDataTypeController; |
130 | 130 |
131 namespace { | 131 namespace { |
132 | 132 |
133 syncer::ModelTypeSet GetDisabledTypesFromCommandLine( | 133 syncer::ModelTypeSet GetDisabledTypesFromCommandLine( |
134 const CommandLine& command_line) { | 134 const CommandLine& command_line) { |
135 syncer::ModelTypeSet disabled_types; | 135 syncer::ModelTypeSet disabled_types; |
136 std::string disabled_types_str = | 136 std::string disabled_types_str = |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 RegisterDesktopDataTypes(disabled_types, enabled_types, pss); | 182 RegisterDesktopDataTypes(disabled_types, enabled_types, pss); |
183 #endif | 183 #endif |
184 } | 184 } |
185 | 185 |
186 void ProfileSyncComponentsFactoryImpl::RegisterCommonDataTypes( | 186 void ProfileSyncComponentsFactoryImpl::RegisterCommonDataTypes( |
187 syncer::ModelTypeSet disabled_types, | 187 syncer::ModelTypeSet disabled_types, |
188 syncer::ModelTypeSet enabled_types, | 188 syncer::ModelTypeSet enabled_types, |
189 ProfileSyncService* pss) { | 189 ProfileSyncService* pss) { |
190 // TODO(stanisc): can DEVICE_INFO be one of disabled datatypes? | 190 // TODO(stanisc): can DEVICE_INFO be one of disabled datatypes? |
191 pss->RegisterDataTypeController(new DeviceInfoDataTypeController( | 191 pss->RegisterDataTypeController(new DeviceInfoDataTypeController( |
192 this, pss->GetLocalDeviceInfoProvider())); | 192 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), |
| 193 base::Bind(&ChromeReportUnrecoverableError), |
| 194 this, |
| 195 pss->GetLocalDeviceInfoProvider())); |
193 | 196 |
194 // Autofill sync is enabled by default. Register unless explicitly | 197 // Autofill sync is enabled by default. Register unless explicitly |
195 // disabled. | 198 // disabled. |
196 if (!disabled_types.Has(syncer::AUTOFILL)) { | 199 if (!disabled_types.Has(syncer::AUTOFILL)) { |
197 pss->RegisterDataTypeController( | 200 pss->RegisterDataTypeController( |
198 new AutofillDataTypeController(this, profile_)); | 201 new AutofillDataTypeController(this, profile_)); |
199 } | 202 } |
200 | 203 |
201 // Autofill profile sync is enabled by default. Register unless explicitly | 204 // Autofill profile sync is enabled by default. Register unless explicitly |
202 // disabled. | 205 // disabled. |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 ProfileSyncComponentsFactoryImpl::CreateSyncBackendHost( | 433 ProfileSyncComponentsFactoryImpl::CreateSyncBackendHost( |
431 const std::string& name, | 434 const std::string& name, |
432 Profile* profile, | 435 Profile* profile, |
433 invalidation::InvalidationService* invalidator, | 436 invalidation::InvalidationService* invalidator, |
434 const base::WeakPtr<sync_driver::SyncPrefs>& sync_prefs, | 437 const base::WeakPtr<sync_driver::SyncPrefs>& sync_prefs, |
435 const base::FilePath& sync_folder) { | 438 const base::FilePath& sync_folder) { |
436 return new browser_sync::SyncBackendHostImpl(name, profile, invalidator, | 439 return new browser_sync::SyncBackendHostImpl(name, profile, invalidator, |
437 sync_prefs, sync_folder); | 440 sync_prefs, sync_folder); |
438 } | 441 } |
439 | 442 |
440 scoped_ptr<browser_sync::LocalDeviceInfoProvider> | 443 scoped_ptr<sync_driver::LocalDeviceInfoProvider> |
441 ProfileSyncComponentsFactoryImpl::CreateLocalDeviceInfoProvider() { | 444 ProfileSyncComponentsFactoryImpl::CreateLocalDeviceInfoProvider() { |
442 return scoped_ptr<browser_sync::LocalDeviceInfoProvider>( | 445 return scoped_ptr<sync_driver::LocalDeviceInfoProvider>( |
443 new browser_sync::LocalDeviceInfoProviderImpl()); | 446 new browser_sync::LocalDeviceInfoProviderImpl()); |
444 } | 447 } |
445 | 448 |
446 base::WeakPtr<syncer::SyncableService> ProfileSyncComponentsFactoryImpl:: | 449 base::WeakPtr<syncer::SyncableService> ProfileSyncComponentsFactoryImpl:: |
447 GetSyncableServiceForType(syncer::ModelType type) { | 450 GetSyncableServiceForType(syncer::ModelType type) { |
448 if (!profile_) { // For tests. | 451 if (!profile_) { // For tests. |
449 return base::WeakPtr<syncer::SyncableService>(); | 452 return base::WeakPtr<syncer::SyncableService>(); |
450 } | 453 } |
451 switch (type) { | 454 switch (type) { |
452 case syncer::DEVICE_INFO: | 455 case syncer::DEVICE_INFO: |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
692 new TypedUrlModelAssociator(profile_sync_service, | 695 new TypedUrlModelAssociator(profile_sync_service, |
693 history_backend, | 696 history_backend, |
694 error_handler); | 697 error_handler); |
695 TypedUrlChangeProcessor* change_processor = | 698 TypedUrlChangeProcessor* change_processor = |
696 new TypedUrlChangeProcessor(profile_, | 699 new TypedUrlChangeProcessor(profile_, |
697 model_associator, | 700 model_associator, |
698 history_backend, | 701 history_backend, |
699 error_handler); | 702 error_handler); |
700 return SyncComponents(model_associator, change_processor); | 703 return SyncComponents(model_associator, change_processor); |
701 } | 704 } |
OLD | NEW |