OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "base/logging.h" | 6 #include "base/logging.h" |
7 #include "chrome/browser/defaults.h" | 7 #include "chrome/browser/defaults.h" |
8 #include "chrome/browser/profile.h" | 8 #include "chrome/browser/profile.h" |
9 #include "chrome/browser/sync/glue/autofill_change_processor.h" | 9 #include "chrome/browser/sync/glue/autofill_change_processor.h" |
10 #include "chrome/browser/sync/glue/autofill_data_type_controller.h" | 10 #include "chrome/browser/sync/glue/autofill_data_type_controller.h" |
11 #include "chrome/browser/sync/glue/autofill_model_associator.h" | 11 #include "chrome/browser/sync/glue/autofill_model_associator.h" |
12 #include "chrome/browser/sync/glue/bookmark_change_processor.h" | 12 #include "chrome/browser/sync/glue/bookmark_change_processor.h" |
13 #include "chrome/browser/sync/glue/bookmark_data_type_controller.h" | 13 #include "chrome/browser/sync/glue/bookmark_data_type_controller.h" |
14 #include "chrome/browser/sync/glue/bookmark_model_associator.h" | 14 #include "chrome/browser/sync/glue/bookmark_model_associator.h" |
15 #include "chrome/browser/sync/glue/data_type_manager_impl.h" | 15 #include "chrome/browser/sync/glue/data_type_manager_impl.h" |
16 #include "chrome/browser/sync/glue/extension_change_processor.h" | 16 #include "chrome/browser/sync/glue/extension_change_processor.h" |
17 #include "chrome/browser/sync/glue/extension_data_type_controller.h" | 17 #include "chrome/browser/sync/glue/extension_data_type_controller.h" |
18 #include "chrome/browser/sync/glue/extension_model_associator.h" | 18 #include "chrome/browser/sync/glue/extension_model_associator.h" |
19 #include "chrome/browser/sync/glue/password_change_processor.h" | 19 #include "chrome/browser/sync/glue/password_change_processor.h" |
20 #include "chrome/browser/sync/glue/password_data_type_controller.h" | 20 #include "chrome/browser/sync/glue/password_data_type_controller.h" |
21 #include "chrome/browser/sync/glue/password_model_associator.h" | 21 #include "chrome/browser/sync/glue/password_model_associator.h" |
22 #include "chrome/browser/sync/glue/preference_change_processor.h" | 22 #include "chrome/browser/sync/glue/preference_change_processor.h" |
23 #include "chrome/browser/sync/glue/preference_data_type_controller.h" | 23 #include "chrome/browser/sync/glue/preference_data_type_controller.h" |
24 #include "chrome/browser/sync/glue/preference_model_associator.h" | 24 #include "chrome/browser/sync/glue/preference_model_associator.h" |
| 25 #include "chrome/browser/sync/glue/session_change_processor.h" |
| 26 #include "chrome/browser/sync/glue/session_data_type_controller.h" |
| 27 #include "chrome/browser/sync/glue/session_model_associator.h" |
25 #include "chrome/browser/sync/glue/sync_backend_host.h" | 28 #include "chrome/browser/sync/glue/sync_backend_host.h" |
26 #include "chrome/browser/sync/glue/theme_change_processor.h" | 29 #include "chrome/browser/sync/glue/theme_change_processor.h" |
27 #include "chrome/browser/sync/glue/theme_data_type_controller.h" | 30 #include "chrome/browser/sync/glue/theme_data_type_controller.h" |
28 #include "chrome/browser/sync/glue/theme_model_associator.h" | 31 #include "chrome/browser/sync/glue/theme_model_associator.h" |
29 #include "chrome/browser/sync/glue/typed_url_change_processor.h" | 32 #include "chrome/browser/sync/glue/typed_url_change_processor.h" |
30 #include "chrome/browser/sync/glue/typed_url_data_type_controller.h" | 33 #include "chrome/browser/sync/glue/typed_url_data_type_controller.h" |
31 #include "chrome/browser/sync/glue/typed_url_model_associator.h" | 34 #include "chrome/browser/sync/glue/typed_url_model_associator.h" |
32 #include "chrome/browser/sync/profile_sync_service.h" | 35 #include "chrome/browser/sync/profile_sync_service.h" |
33 #include "chrome/browser/sync/profile_sync_factory_impl.h" | 36 #include "chrome/browser/sync/profile_sync_factory_impl.h" |
34 #include "chrome/browser/webdata/web_data_service.h" | 37 #include "chrome/browser/webdata/web_data_service.h" |
(...skipping 10 matching lines...) Expand all Loading... |
45 using browser_sync::DataTypeManagerImpl; | 48 using browser_sync::DataTypeManagerImpl; |
46 using browser_sync::ExtensionChangeProcessor; | 49 using browser_sync::ExtensionChangeProcessor; |
47 using browser_sync::ExtensionDataTypeController; | 50 using browser_sync::ExtensionDataTypeController; |
48 using browser_sync::ExtensionModelAssociator; | 51 using browser_sync::ExtensionModelAssociator; |
49 using browser_sync::PasswordChangeProcessor; | 52 using browser_sync::PasswordChangeProcessor; |
50 using browser_sync::PasswordDataTypeController; | 53 using browser_sync::PasswordDataTypeController; |
51 using browser_sync::PasswordModelAssociator; | 54 using browser_sync::PasswordModelAssociator; |
52 using browser_sync::PreferenceChangeProcessor; | 55 using browser_sync::PreferenceChangeProcessor; |
53 using browser_sync::PreferenceDataTypeController; | 56 using browser_sync::PreferenceDataTypeController; |
54 using browser_sync::PreferenceModelAssociator; | 57 using browser_sync::PreferenceModelAssociator; |
| 58 using browser_sync::SessionChangeProcessor; |
| 59 using browser_sync::SessionDataTypeController; |
| 60 using browser_sync::SessionModelAssociator; |
55 using browser_sync::SyncBackendHost; | 61 using browser_sync::SyncBackendHost; |
56 using browser_sync::ThemeChangeProcessor; | 62 using browser_sync::ThemeChangeProcessor; |
57 using browser_sync::ThemeDataTypeController; | 63 using browser_sync::ThemeDataTypeController; |
58 using browser_sync::ThemeModelAssociator; | 64 using browser_sync::ThemeModelAssociator; |
59 using browser_sync::TypedUrlChangeProcessor; | 65 using browser_sync::TypedUrlChangeProcessor; |
60 using browser_sync::TypedUrlDataTypeController; | 66 using browser_sync::TypedUrlDataTypeController; |
61 using browser_sync::TypedUrlModelAssociator; | 67 using browser_sync::TypedUrlModelAssociator; |
62 using browser_sync::UnrecoverableErrorHandler; | 68 using browser_sync::UnrecoverableErrorHandler; |
63 | 69 |
64 ProfileSyncFactoryImpl::ProfileSyncFactoryImpl(Profile* profile, | 70 ProfileSyncFactoryImpl::ProfileSyncFactoryImpl(Profile* profile, |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 new ThemeDataTypeController(this, profile_, pss)); | 118 new ThemeDataTypeController(this, profile_, pss)); |
113 } | 119 } |
114 | 120 |
115 // TypedUrl sync is disabled by default. Register only if | 121 // TypedUrl sync is disabled by default. Register only if |
116 // explicitly enabled. | 122 // explicitly enabled. |
117 if (command_line_->HasSwitch(switches::kEnableSyncTypedUrls)) { | 123 if (command_line_->HasSwitch(switches::kEnableSyncTypedUrls)) { |
118 pss->RegisterDataTypeController( | 124 pss->RegisterDataTypeController( |
119 new TypedUrlDataTypeController(this, profile_, pss)); | 125 new TypedUrlDataTypeController(this, profile_, pss)); |
120 } | 126 } |
121 | 127 |
| 128 // Session sync is enabled by default. Register unless explicitly |
| 129 // disabled. |
| 130 if (!command_line_->HasSwitch(switches::kDisableSyncSessions)) { |
| 131 pss->RegisterDataTypeController( |
| 132 new SessionDataTypeController(this, pss)); |
| 133 } |
122 return pss; | 134 return pss; |
123 } | 135 } |
124 | 136 |
125 DataTypeManager* ProfileSyncFactoryImpl::CreateDataTypeManager( | 137 DataTypeManager* ProfileSyncFactoryImpl::CreateDataTypeManager( |
126 SyncBackendHost* backend, | 138 SyncBackendHost* backend, |
127 const DataTypeController::TypeMap& controllers) { | 139 const DataTypeController::TypeMap& controllers) { |
128 return new DataTypeManagerImpl(backend, controllers); | 140 return new DataTypeManagerImpl(backend, controllers); |
129 } | 141 } |
130 | 142 |
131 ProfileSyncFactory::SyncComponents | 143 ProfileSyncFactory::SyncComponents |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 browser_sync::UnrecoverableErrorHandler* error_handler) { | 227 browser_sync::UnrecoverableErrorHandler* error_handler) { |
216 TypedUrlModelAssociator* model_associator = | 228 TypedUrlModelAssociator* model_associator = |
217 new TypedUrlModelAssociator(profile_sync_service, | 229 new TypedUrlModelAssociator(profile_sync_service, |
218 history_backend); | 230 history_backend); |
219 TypedUrlChangeProcessor* change_processor = | 231 TypedUrlChangeProcessor* change_processor = |
220 new TypedUrlChangeProcessor(model_associator, | 232 new TypedUrlChangeProcessor(model_associator, |
221 history_backend, | 233 history_backend, |
222 error_handler); | 234 error_handler); |
223 return SyncComponents(model_associator, change_processor); | 235 return SyncComponents(model_associator, change_processor); |
224 } | 236 } |
| 237 |
| 238 ProfileSyncFactory::SyncComponents |
| 239 ProfileSyncFactoryImpl::CreateSessionSyncComponents( |
| 240 ProfileSyncService* profile_sync_service, |
| 241 UnrecoverableErrorHandler* error_handler) { |
| 242 SessionModelAssociator* model_associator = |
| 243 new SessionModelAssociator(profile_sync_service); |
| 244 SessionChangeProcessor* change_processor = |
| 245 new SessionChangeProcessor(error_handler, model_associator); |
| 246 return SyncComponents(model_associator, change_processor); |
| 247 } |
| 248 |
OLD | NEW |