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/app_data_type_controller.h" | 9 #include "chrome/browser/sync/glue/app_data_type_controller.h" |
10 #include "chrome/browser/sync/glue/autofill_change_processor.h" | 10 #include "chrome/browser/sync/glue/autofill_change_processor.h" |
11 #include "chrome/browser/sync/glue/autofill_data_type_controller.h" | 11 #include "chrome/browser/sync/glue/autofill_data_type_controller.h" |
12 #include "chrome/browser/sync/glue/autofill_model_associator.h" | 12 #include "chrome/browser/sync/glue/autofill_model_associator.h" |
13 #include "chrome/browser/sync/glue/bookmark_change_processor.h" | 13 #include "chrome/browser/sync/glue/bookmark_change_processor.h" |
14 #include "chrome/browser/sync/glue/bookmark_data_type_controller.h" | 14 #include "chrome/browser/sync/glue/bookmark_data_type_controller.h" |
15 #include "chrome/browser/sync/glue/bookmark_model_associator.h" | 15 #include "chrome/browser/sync/glue/bookmark_model_associator.h" |
16 #include "chrome/browser/sync/glue/data_type_manager_impl.h" | 16 #include "chrome/browser/sync/glue/data_type_manager_impl.h" |
17 #include "chrome/browser/sync/glue/extension_change_processor.h" | 17 #include "chrome/browser/sync/glue/extension_change_processor.h" |
18 #include "chrome/browser/sync/glue/extension_data_type_controller.h" | 18 #include "chrome/browser/sync/glue/extension_data_type_controller.h" |
19 #include "chrome/browser/sync/glue/extension_model_associator.h" | 19 #include "chrome/browser/sync/glue/extension_model_associator.h" |
20 #include "chrome/browser/sync/glue/extension_sync_traits.h" | 20 #include "chrome/browser/sync/glue/extension_sync_traits.h" |
21 #include "chrome/browser/sync/glue/password_change_processor.h" | 21 #include "chrome/browser/sync/glue/password_change_processor.h" |
22 #include "chrome/browser/sync/glue/password_data_type_controller.h" | 22 #include "chrome/browser/sync/glue/password_data_type_controller.h" |
23 #include "chrome/browser/sync/glue/password_model_associator.h" | 23 #include "chrome/browser/sync/glue/password_model_associator.h" |
24 #include "chrome/browser/sync/glue/preference_change_processor.h" | 24 #include "chrome/browser/sync/glue/preference_change_processor.h" |
25 #include "chrome/browser/sync/glue/preference_data_type_controller.h" | 25 #include "chrome/browser/sync/glue/preference_data_type_controller.h" |
26 #include "chrome/browser/sync/glue/preference_model_associator.h" | 26 #include "chrome/browser/sync/glue/preference_model_associator.h" |
| 27 #include "chrome/browser/sync/glue/session_change_processor.h" |
| 28 #include "chrome/browser/sync/glue/session_data_type_controller.h" |
| 29 #include "chrome/browser/sync/glue/session_model_associator.h" |
27 #include "chrome/browser/sync/glue/sync_backend_host.h" | 30 #include "chrome/browser/sync/glue/sync_backend_host.h" |
28 #include "chrome/browser/sync/glue/theme_change_processor.h" | 31 #include "chrome/browser/sync/glue/theme_change_processor.h" |
29 #include "chrome/browser/sync/glue/theme_data_type_controller.h" | 32 #include "chrome/browser/sync/glue/theme_data_type_controller.h" |
30 #include "chrome/browser/sync/glue/theme_model_associator.h" | 33 #include "chrome/browser/sync/glue/theme_model_associator.h" |
31 #include "chrome/browser/sync/glue/typed_url_change_processor.h" | 34 #include "chrome/browser/sync/glue/typed_url_change_processor.h" |
32 #include "chrome/browser/sync/glue/typed_url_data_type_controller.h" | 35 #include "chrome/browser/sync/glue/typed_url_data_type_controller.h" |
33 #include "chrome/browser/sync/glue/typed_url_model_associator.h" | 36 #include "chrome/browser/sync/glue/typed_url_model_associator.h" |
34 #include "chrome/browser/sync/profile_sync_service.h" | 37 #include "chrome/browser/sync/profile_sync_service.h" |
35 #include "chrome/browser/sync/profile_sync_factory_impl.h" | 38 #include "chrome/browser/sync/profile_sync_factory_impl.h" |
36 #include "chrome/browser/webdata/web_data_service.h" | 39 #include "chrome/browser/webdata/web_data_service.h" |
(...skipping 11 matching lines...) Expand all Loading... |
48 using browser_sync::DataTypeManagerImpl; | 51 using browser_sync::DataTypeManagerImpl; |
49 using browser_sync::ExtensionChangeProcessor; | 52 using browser_sync::ExtensionChangeProcessor; |
50 using browser_sync::ExtensionDataTypeController; | 53 using browser_sync::ExtensionDataTypeController; |
51 using browser_sync::ExtensionModelAssociator; | 54 using browser_sync::ExtensionModelAssociator; |
52 using browser_sync::PasswordChangeProcessor; | 55 using browser_sync::PasswordChangeProcessor; |
53 using browser_sync::PasswordDataTypeController; | 56 using browser_sync::PasswordDataTypeController; |
54 using browser_sync::PasswordModelAssociator; | 57 using browser_sync::PasswordModelAssociator; |
55 using browser_sync::PreferenceChangeProcessor; | 58 using browser_sync::PreferenceChangeProcessor; |
56 using browser_sync::PreferenceDataTypeController; | 59 using browser_sync::PreferenceDataTypeController; |
57 using browser_sync::PreferenceModelAssociator; | 60 using browser_sync::PreferenceModelAssociator; |
| 61 using browser_sync::SessionChangeProcessor; |
| 62 using browser_sync::SessionDataTypeController; |
| 63 using browser_sync::SessionModelAssociator; |
58 using browser_sync::SyncBackendHost; | 64 using browser_sync::SyncBackendHost; |
59 using browser_sync::ThemeChangeProcessor; | 65 using browser_sync::ThemeChangeProcessor; |
60 using browser_sync::ThemeDataTypeController; | 66 using browser_sync::ThemeDataTypeController; |
61 using browser_sync::ThemeModelAssociator; | 67 using browser_sync::ThemeModelAssociator; |
62 using browser_sync::TypedUrlChangeProcessor; | 68 using browser_sync::TypedUrlChangeProcessor; |
63 using browser_sync::TypedUrlDataTypeController; | 69 using browser_sync::TypedUrlDataTypeController; |
64 using browser_sync::TypedUrlModelAssociator; | 70 using browser_sync::TypedUrlModelAssociator; |
65 using browser_sync::UnrecoverableErrorHandler; | 71 using browser_sync::UnrecoverableErrorHandler; |
66 | 72 |
67 ProfileSyncFactoryImpl::ProfileSyncFactoryImpl(Profile* profile, | 73 ProfileSyncFactoryImpl::ProfileSyncFactoryImpl(Profile* profile, |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 new ThemeDataTypeController(this, profile_, pss)); | 128 new ThemeDataTypeController(this, profile_, pss)); |
123 } | 129 } |
124 | 130 |
125 // TypedUrl sync is disabled by default. Register only if | 131 // TypedUrl sync is disabled by default. Register only if |
126 // explicitly enabled. | 132 // explicitly enabled. |
127 if (command_line_->HasSwitch(switches::kEnableSyncTypedUrls)) { | 133 if (command_line_->HasSwitch(switches::kEnableSyncTypedUrls)) { |
128 pss->RegisterDataTypeController( | 134 pss->RegisterDataTypeController( |
129 new TypedUrlDataTypeController(this, profile_, pss)); | 135 new TypedUrlDataTypeController(this, profile_, pss)); |
130 } | 136 } |
131 | 137 |
| 138 // Session sync is enabled by default. Register unless explicitly |
| 139 // disabled. |
| 140 if (!command_line_->HasSwitch(switches::kDisableSyncSessions)) { |
| 141 pss->RegisterDataTypeController( |
| 142 new SessionDataTypeController(this, pss)); |
| 143 } |
132 return pss; | 144 return pss; |
133 } | 145 } |
134 | 146 |
135 DataTypeManager* ProfileSyncFactoryImpl::CreateDataTypeManager( | 147 DataTypeManager* ProfileSyncFactoryImpl::CreateDataTypeManager( |
136 SyncBackendHost* backend, | 148 SyncBackendHost* backend, |
137 const DataTypeController::TypeMap& controllers) { | 149 const DataTypeController::TypeMap& controllers) { |
138 return new DataTypeManagerImpl(backend, controllers); | 150 return new DataTypeManagerImpl(backend, controllers); |
139 } | 151 } |
140 | 152 |
141 ProfileSyncFactory::SyncComponents | 153 ProfileSyncFactory::SyncComponents |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 browser_sync::UnrecoverableErrorHandler* error_handler) { | 254 browser_sync::UnrecoverableErrorHandler* error_handler) { |
243 TypedUrlModelAssociator* model_associator = | 255 TypedUrlModelAssociator* model_associator = |
244 new TypedUrlModelAssociator(profile_sync_service, | 256 new TypedUrlModelAssociator(profile_sync_service, |
245 history_backend); | 257 history_backend); |
246 TypedUrlChangeProcessor* change_processor = | 258 TypedUrlChangeProcessor* change_processor = |
247 new TypedUrlChangeProcessor(model_associator, | 259 new TypedUrlChangeProcessor(model_associator, |
248 history_backend, | 260 history_backend, |
249 error_handler); | 261 error_handler); |
250 return SyncComponents(model_associator, change_processor); | 262 return SyncComponents(model_associator, change_processor); |
251 } | 263 } |
| 264 |
| 265 ProfileSyncFactory::SyncComponents |
| 266 ProfileSyncFactoryImpl::CreateSessionSyncComponents( |
| 267 ProfileSyncService* profile_sync_service, |
| 268 UnrecoverableErrorHandler* error_handler) { |
| 269 SessionModelAssociator* model_associator = |
| 270 new SessionModelAssociator(profile_sync_service); |
| 271 SessionChangeProcessor* change_processor = |
| 272 new SessionChangeProcessor(error_handler, model_associator); |
| 273 return SyncComponents(model_associator, change_processor); |
| 274 } |
| 275 |
OLD | NEW |