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/about_flags.h" | 7 #include "chrome/browser/about_flags.h" |
8 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 8 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/extensions/api/storage/settings_frontend.h" | 10 #include "chrome/browser/extensions/api/storage/settings_frontend.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 #include "chrome/browser/sync/glue/sync_backend_host.h" | 44 #include "chrome/browser/sync/glue/sync_backend_host.h" |
45 #include "chrome/browser/sync/glue/sync_backend_host_impl.h" | 45 #include "chrome/browser/sync/glue/sync_backend_host_impl.h" |
46 #include "chrome/browser/sync/glue/theme_data_type_controller.h" | 46 #include "chrome/browser/sync/glue/theme_data_type_controller.h" |
47 #include "chrome/browser/sync/glue/typed_url_change_processor.h" | 47 #include "chrome/browser/sync/glue/typed_url_change_processor.h" |
48 #include "chrome/browser/sync/glue/typed_url_data_type_controller.h" | 48 #include "chrome/browser/sync/glue/typed_url_data_type_controller.h" |
49 #include "chrome/browser/sync/glue/typed_url_model_associator.h" | 49 #include "chrome/browser/sync/glue/typed_url_model_associator.h" |
50 #include "chrome/browser/sync/glue/ui_data_type_controller.h" | 50 #include "chrome/browser/sync/glue/ui_data_type_controller.h" |
51 #include "chrome/browser/sync/profile_sync_components_factory_impl.h" | 51 #include "chrome/browser/sync/profile_sync_components_factory_impl.h" |
52 #include "chrome/browser/sync/profile_sync_service.h" | 52 #include "chrome/browser/sync/profile_sync_service.h" |
53 #include "chrome/browser/sync/profile_sync_service_factory.h" | 53 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 54 #include "chrome/browser/sync/sessions2/session_data_type_controller2.h" |
54 #include "chrome/browser/themes/theme_service.h" | 55 #include "chrome/browser/themes/theme_service.h" |
55 #include "chrome/browser/themes/theme_service_factory.h" | 56 #include "chrome/browser/themes/theme_service_factory.h" |
56 #include "chrome/browser/themes/theme_syncable_service.h" | 57 #include "chrome/browser/themes/theme_syncable_service.h" |
57 #include "chrome/browser/webdata/autocomplete_syncable_service.h" | 58 #include "chrome/browser/webdata/autocomplete_syncable_service.h" |
58 #include "chrome/browser/webdata/autofill_profile_syncable_service.h" | 59 #include "chrome/browser/webdata/autofill_profile_syncable_service.h" |
59 #include "chrome/common/chrome_switches.h" | 60 #include "chrome/common/chrome_switches.h" |
60 #include "chrome/common/pref_names.h" | 61 #include "chrome/common/pref_names.h" |
61 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" | 62 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" |
62 #include "content/public/browser/browser_thread.h" | 63 #include "content/public/browser/browser_thread.h" |
63 #include "sync/api/syncable_service.h" | 64 #include "sync/api/syncable_service.h" |
(...skipping 29 matching lines...) Expand all Loading... |
93 using browser_sync::ExtensionDataTypeController; | 94 using browser_sync::ExtensionDataTypeController; |
94 using browser_sync::ExtensionSettingDataTypeController; | 95 using browser_sync::ExtensionSettingDataTypeController; |
95 using browser_sync::GenericChangeProcessor; | 96 using browser_sync::GenericChangeProcessor; |
96 using browser_sync::PasswordChangeProcessor; | 97 using browser_sync::PasswordChangeProcessor; |
97 using browser_sync::PasswordDataTypeController; | 98 using browser_sync::PasswordDataTypeController; |
98 using browser_sync::PasswordModelAssociator; | 99 using browser_sync::PasswordModelAssociator; |
99 using browser_sync::ProxyDataTypeController; | 100 using browser_sync::ProxyDataTypeController; |
100 using browser_sync::SearchEngineDataTypeController; | 101 using browser_sync::SearchEngineDataTypeController; |
101 using browser_sync::SessionChangeProcessor; | 102 using browser_sync::SessionChangeProcessor; |
102 using browser_sync::SessionDataTypeController; | 103 using browser_sync::SessionDataTypeController; |
| 104 using browser_sync::SessionDataTypeController2; |
103 using browser_sync::SessionModelAssociator; | 105 using browser_sync::SessionModelAssociator; |
104 using browser_sync::SharedChangeProcessor; | 106 using browser_sync::SharedChangeProcessor; |
105 using browser_sync::SyncBackendHost; | 107 using browser_sync::SyncBackendHost; |
106 using browser_sync::ThemeDataTypeController; | 108 using browser_sync::ThemeDataTypeController; |
107 using browser_sync::TypedUrlChangeProcessor; | 109 using browser_sync::TypedUrlChangeProcessor; |
108 using browser_sync::TypedUrlDataTypeController; | 110 using browser_sync::TypedUrlDataTypeController; |
109 using browser_sync::TypedUrlModelAssociator; | 111 using browser_sync::TypedUrlModelAssociator; |
110 using browser_sync::UIDataTypeController; | 112 using browser_sync::UIDataTypeController; |
111 using content::BrowserThread; | 113 using content::BrowserThread; |
112 | 114 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 // Delete directive sync is enabled by default. Register unless full history | 167 // Delete directive sync is enabled by default. Register unless full history |
166 // sync is disabled. | 168 // sync is disabled. |
167 if (!command_line_->HasSwitch(switches::kHistoryDisableFullHistorySync)) { | 169 if (!command_line_->HasSwitch(switches::kHistoryDisableFullHistorySync)) { |
168 pss->RegisterDataTypeController( | 170 pss->RegisterDataTypeController( |
169 new UIDataTypeController( | 171 new UIDataTypeController( |
170 syncer::HISTORY_DELETE_DIRECTIVES, this, profile_, pss)); | 172 syncer::HISTORY_DELETE_DIRECTIVES, this, profile_, pss)); |
171 } | 173 } |
172 | 174 |
173 // Session sync is enabled by default. Register unless explicitly disabled. | 175 // Session sync is enabled by default. Register unless explicitly disabled. |
174 if (!command_line_->HasSwitch(switches::kDisableSyncTabs)) { | 176 if (!command_line_->HasSwitch(switches::kDisableSyncTabs)) { |
175 pss->RegisterDataTypeController( | 177 pss->RegisterDataTypeController( |
176 new ProxyDataTypeController(syncer::PROXY_TABS)); | 178 new ProxyDataTypeController(syncer::PROXY_TABS)); |
177 pss->RegisterDataTypeController( | 179 if (!command_line_->HasSwitch(switches::kEnableSyncSessionsV2)) { |
178 new SessionDataTypeController(this, profile_, pss)); | 180 pss->RegisterDataTypeController( |
| 181 new SessionDataTypeController(this, profile_, pss)); |
| 182 } else { |
| 183 pss->RegisterDataTypeController( |
| 184 new SessionDataTypeController2(this, profile_, pss)); |
| 185 } |
179 } | 186 } |
180 | 187 |
181 // Favicon sync is enabled by default. Register unless explicitly disabled. | 188 // Favicon sync is enabled by default. Register unless explicitly disabled. |
182 if (!command_line_->HasSwitch(switches::kDisableSyncFavicons)) { | 189 if (!command_line_->HasSwitch(switches::kDisableSyncFavicons)) { |
183 pss->RegisterDataTypeController( | 190 pss->RegisterDataTypeController( |
184 new UIDataTypeController(syncer::FAVICON_IMAGES, | 191 new UIDataTypeController(syncer::FAVICON_IMAGES, |
185 this, | 192 this, |
186 profile_, | 193 profile_, |
187 pss)); | 194 pss)); |
188 pss->RegisterDataTypeController( | 195 pss->RegisterDataTypeController( |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 : base::WeakPtr<syncer::SyncableService>(); | 397 : base::WeakPtr<syncer::SyncableService>(); |
391 } | 398 } |
392 #endif | 399 #endif |
393 #if defined(ENABLE_SPELLCHECK) | 400 #if defined(ENABLE_SPELLCHECK) |
394 case syncer::DICTIONARY: | 401 case syncer::DICTIONARY: |
395 return SpellcheckServiceFactory::GetForContext(profile_)-> | 402 return SpellcheckServiceFactory::GetForContext(profile_)-> |
396 GetCustomDictionary()->AsWeakPtr(); | 403 GetCustomDictionary()->AsWeakPtr(); |
397 #endif | 404 #endif |
398 case syncer::FAVICON_IMAGES: | 405 case syncer::FAVICON_IMAGES: |
399 case syncer::FAVICON_TRACKING: { | 406 case syncer::FAVICON_TRACKING: { |
400 browser_sync::SessionModelAssociator* model_associator = | 407 browser_sync::FaviconCache* favicons = |
401 ProfileSyncServiceFactory::GetForProfile(profile_)-> | 408 ProfileSyncServiceFactory::GetForProfile(profile_)-> |
402 GetSessionModelAssociator(); | 409 GetFaviconCache(); |
403 if (!model_associator) | 410 return favicons ? favicons->AsWeakPtr() |
404 return base::WeakPtr<syncer::SyncableService>(); | 411 : base::WeakPtr<syncer::SyncableService>(); |
405 return model_associator->GetFaviconCache()->AsWeakPtr(); | |
406 } | 412 } |
407 #if defined(ENABLE_MANAGED_USERS) | 413 #if defined(ENABLE_MANAGED_USERS) |
408 case syncer::MANAGED_USER_SETTINGS: | 414 case syncer::MANAGED_USER_SETTINGS: |
409 return ManagedUserSettingsServiceFactory::GetForProfile(profile_)-> | 415 return ManagedUserSettingsServiceFactory::GetForProfile(profile_)-> |
410 AsWeakPtr(); | 416 AsWeakPtr(); |
411 case syncer::MANAGED_USERS: | 417 case syncer::MANAGED_USERS: |
412 return ManagedUserSyncServiceFactory::GetForProfile(profile_)-> | 418 return ManagedUserSyncServiceFactory::GetForProfile(profile_)-> |
413 AsWeakPtr(); | 419 AsWeakPtr(); |
414 #endif | 420 #endif |
415 case syncer::ARTICLES: | 421 case syncer::ARTICLES: |
416 // TODO(nyquist) Hook up real syncer::SyncableService API here. | 422 // TODO(nyquist) Hook up real syncer::SyncableService API here. |
417 return base::WeakPtr<syncer::SyncableService>(); | 423 return base::WeakPtr<syncer::SyncableService>(); |
| 424 case syncer::SESSIONS: |
| 425 DCHECK(command_line_->HasSwitch(switches::kEnableSyncSessionsV2)); |
| 426 return ProfileSyncServiceFactory::GetForProfile(profile_)-> |
| 427 GetSessionsSyncableService()->AsWeakPtr(); |
418 default: | 428 default: |
419 // The following datatypes still need to be transitioned to the | 429 // The following datatypes still need to be transitioned to the |
420 // syncer::SyncableService API: | 430 // syncer::SyncableService API: |
421 // Bookmarks | 431 // Bookmarks |
422 // Passwords | 432 // Passwords |
423 // Sessions | |
424 // Typed URLs | 433 // Typed URLs |
425 NOTREACHED(); | 434 NOTREACHED(); |
426 return base::WeakPtr<syncer::SyncableService>(); | 435 return base::WeakPtr<syncer::SyncableService>(); |
427 } | 436 } |
428 } | 437 } |
429 | 438 |
430 ProfileSyncComponentsFactory::SyncComponents | 439 ProfileSyncComponentsFactory::SyncComponents |
431 ProfileSyncComponentsFactoryImpl::CreateBookmarkSyncComponents( | 440 ProfileSyncComponentsFactoryImpl::CreateBookmarkSyncComponents( |
432 ProfileSyncService* profile_sync_service, | 441 ProfileSyncService* profile_sync_service, |
433 DataTypeErrorHandler* error_handler) { | 442 DataTypeErrorHandler* error_handler) { |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 ProfileSyncComponentsFactory::SyncComponents | 497 ProfileSyncComponentsFactory::SyncComponents |
489 ProfileSyncComponentsFactoryImpl::CreateSessionSyncComponents( | 498 ProfileSyncComponentsFactoryImpl::CreateSessionSyncComponents( |
490 ProfileSyncService* profile_sync_service, | 499 ProfileSyncService* profile_sync_service, |
491 DataTypeErrorHandler* error_handler) { | 500 DataTypeErrorHandler* error_handler) { |
492 SessionModelAssociator* model_associator = | 501 SessionModelAssociator* model_associator = |
493 new SessionModelAssociator(profile_sync_service, error_handler); | 502 new SessionModelAssociator(profile_sync_service, error_handler); |
494 SessionChangeProcessor* change_processor = | 503 SessionChangeProcessor* change_processor = |
495 new SessionChangeProcessor(error_handler, model_associator); | 504 new SessionChangeProcessor(error_handler, model_associator); |
496 return SyncComponents(model_associator, change_processor); | 505 return SyncComponents(model_associator, change_processor); |
497 } | 506 } |
OLD | NEW |