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_factory.h" | 10 #include "chrome/browser/history/history_service_factory.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 #include "chrome/browser/sync/sessions/session_data_type_controller.h" | 38 #include "chrome/browser/sync/sessions/session_data_type_controller.h" |
39 #include "chrome/browser/themes/theme_service.h" | 39 #include "chrome/browser/themes/theme_service.h" |
40 #include "chrome/browser/themes/theme_service_factory.h" | 40 #include "chrome/browser/themes/theme_service_factory.h" |
41 #include "chrome/browser/themes/theme_syncable_service.h" | 41 #include "chrome/browser/themes/theme_syncable_service.h" |
42 #include "chrome/browser/webdata/web_data_service_factory.h" | 42 #include "chrome/browser/webdata/web_data_service_factory.h" |
43 #include "chrome/common/chrome_switches.h" | 43 #include "chrome/common/chrome_switches.h" |
44 #include "chrome/common/chrome_version_info.h" | 44 #include "chrome/common/chrome_version_info.h" |
45 #include "chrome/common/pref_names.h" | 45 #include "chrome/common/pref_names.h" |
46 #include "components/autofill/core/browser/webdata/autocomplete_syncable_service
.h" | 46 #include "components/autofill/core/browser/webdata/autocomplete_syncable_service
.h" |
47 #include "components/autofill/core/browser/webdata/autofill_profile_syncable_ser
vice.h" | 47 #include "components/autofill/core/browser/webdata/autofill_profile_syncable_ser
vice.h" |
| 48 #include "components/autofill/core/browser/webdata/autofill_wallet_metadata_sync
able_service.h" |
48 #include "components/autofill/core/browser/webdata/autofill_wallet_syncable_serv
ice.h" | 49 #include "components/autofill/core/browser/webdata/autofill_wallet_syncable_serv
ice.h" |
49 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" | 50 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" |
50 #include "components/autofill/core/common/autofill_pref_names.h" | 51 #include "components/autofill/core/common/autofill_pref_names.h" |
51 #include "components/autofill/core/common/autofill_switches.h" | 52 #include "components/autofill/core/common/autofill_switches.h" |
52 #include "components/dom_distiller/core/dom_distiller_service.h" | 53 #include "components/dom_distiller/core/dom_distiller_service.h" |
53 #include "components/history/core/browser/history_service.h" | 54 #include "components/history/core/browser/history_service.h" |
54 #include "components/password_manager/core/browser/password_store.h" | 55 #include "components/password_manager/core/browser/password_store.h" |
55 #include "components/search_engines/template_url_service.h" | 56 #include "components/search_engines/template_url_service.h" |
56 #include "components/signin/core/browser/signin_manager.h" | 57 #include "components/signin/core/browser/signin_manager.h" |
57 #include "components/sync_driver/data_type_manager_impl.h" | 58 #include "components/sync_driver/data_type_manager_impl.h" |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 new AutofillDataTypeController(this, profile_)); | 223 new AutofillDataTypeController(this, profile_)); |
223 } | 224 } |
224 | 225 |
225 // Autofill profile sync is enabled by default. Register unless explicitly | 226 // Autofill profile sync is enabled by default. Register unless explicitly |
226 // disabled. | 227 // disabled. |
227 if (!disabled_types.Has(syncer::AUTOFILL_PROFILE)) { | 228 if (!disabled_types.Has(syncer::AUTOFILL_PROFILE)) { |
228 pss->RegisterDataTypeController( | 229 pss->RegisterDataTypeController( |
229 new AutofillProfileDataTypeController(this, profile_)); | 230 new AutofillProfileDataTypeController(this, profile_)); |
230 } | 231 } |
231 | 232 |
232 // Autofill wallet sync is enabled by default, but behind a syncer experiment | 233 // Wallet data sync is enabled by default, but behind a syncer experiment |
233 // enforced by the datatype controller. Register unless explicitly disabled. | 234 // enforced by the datatype controller. Register unless explicitly disabled. |
234 if (!disabled_types.Has(syncer::AUTOFILL_WALLET_DATA)) { | 235 bool wallet_disabled = disabled_types.Has(syncer::AUTOFILL_WALLET_DATA); |
| 236 if (!wallet_disabled) { |
235 pss->RegisterDataTypeController( | 237 pss->RegisterDataTypeController( |
236 new browser_sync::AutofillWalletDataTypeController(this, profile_)); | 238 new browser_sync::AutofillWalletDataTypeController( |
| 239 this, profile_, syncer::AUTOFILL_WALLET_DATA)); |
| 240 } |
| 241 |
| 242 // Wallet metadata sync is enabled by default. Same as wallet data, the |
| 243 // metadata sync is behind an experiment enforced by the controller. Register |
| 244 // if wallet data is syncing and metadata sync is not explicitly disabled. |
| 245 if (!disabled_types.Has(syncer::AUTOFILL_WALLET_METADATA) && |
| 246 !wallet_disabled) { |
| 247 pss->RegisterDataTypeController( |
| 248 new browser_sync::AutofillWalletDataTypeController( |
| 249 this, profile_, syncer::AUTOFILL_WALLET_METADATA)); |
237 } | 250 } |
238 | 251 |
239 // Bookmark sync is enabled by default. Register unless explicitly | 252 // Bookmark sync is enabled by default. Register unless explicitly |
240 // disabled. | 253 // disabled. |
241 if (!disabled_types.Has(syncer::BOOKMARKS)) { | 254 if (!disabled_types.Has(syncer::BOOKMARKS)) { |
242 pss->RegisterDataTypeController( | 255 pss->RegisterDataTypeController( |
243 new BookmarkDataTypeController(this, profile_, pss)); | 256 new BookmarkDataTypeController(this, profile_, pss)); |
244 } | 257 } |
245 | 258 |
246 const bool history_disabled = | 259 const bool history_disabled = |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 ->GetDeviceInfoSyncableService() | 500 ->GetDeviceInfoSyncableService() |
488 ->AsWeakPtr(); | 501 ->AsWeakPtr(); |
489 case syncer::PREFERENCES: | 502 case syncer::PREFERENCES: |
490 return PrefServiceSyncable::FromProfile( | 503 return PrefServiceSyncable::FromProfile( |
491 profile_)->GetSyncableService(syncer::PREFERENCES)->AsWeakPtr(); | 504 profile_)->GetSyncableService(syncer::PREFERENCES)->AsWeakPtr(); |
492 case syncer::PRIORITY_PREFERENCES: | 505 case syncer::PRIORITY_PREFERENCES: |
493 return PrefServiceSyncable::FromProfile(profile_)->GetSyncableService( | 506 return PrefServiceSyncable::FromProfile(profile_)->GetSyncableService( |
494 syncer::PRIORITY_PREFERENCES)->AsWeakPtr(); | 507 syncer::PRIORITY_PREFERENCES)->AsWeakPtr(); |
495 case syncer::AUTOFILL: | 508 case syncer::AUTOFILL: |
496 case syncer::AUTOFILL_PROFILE: | 509 case syncer::AUTOFILL_PROFILE: |
497 case syncer::AUTOFILL_WALLET_DATA: { | 510 case syncer::AUTOFILL_WALLET_DATA: |
| 511 case syncer::AUTOFILL_WALLET_METADATA: { |
498 if (!web_data_service_.get()) | 512 if (!web_data_service_.get()) |
499 return base::WeakPtr<syncer::SyncableService>(); | 513 return base::WeakPtr<syncer::SyncableService>(); |
500 if (type == syncer::AUTOFILL) { | 514 if (type == syncer::AUTOFILL) { |
501 return autofill::AutocompleteSyncableService::FromWebDataService( | 515 return autofill::AutocompleteSyncableService::FromWebDataService( |
502 web_data_service_.get())->AsWeakPtr(); | 516 web_data_service_.get())->AsWeakPtr(); |
503 } else if (type == syncer::AUTOFILL_PROFILE) { | 517 } else if (type == syncer::AUTOFILL_PROFILE) { |
504 return autofill::AutofillProfileSyncableService::FromWebDataService( | 518 return autofill::AutofillProfileSyncableService::FromWebDataService( |
505 web_data_service_.get())->AsWeakPtr(); | 519 web_data_service_.get())->AsWeakPtr(); |
| 520 } else if (type == syncer::AUTOFILL_WALLET_METADATA) { |
| 521 return autofill::AutofillWalletMetadataSyncableService:: |
| 522 FromWebDataService(web_data_service_.get())->AsWeakPtr(); |
506 } | 523 } |
507 return autofill::AutofillWalletSyncableService::FromWebDataService( | 524 return autofill::AutofillWalletSyncableService::FromWebDataService( |
508 web_data_service_.get())->AsWeakPtr(); | 525 web_data_service_.get())->AsWeakPtr(); |
509 } | 526 } |
510 case syncer::SEARCH_ENGINES: | 527 case syncer::SEARCH_ENGINES: |
511 return TemplateURLServiceFactory::GetForProfile(profile_)->AsWeakPtr(); | 528 return TemplateURLServiceFactory::GetForProfile(profile_)->AsWeakPtr(); |
512 #if defined(ENABLE_EXTENSIONS) | 529 #if defined(ENABLE_EXTENSIONS) |
513 case syncer::APPS: | 530 case syncer::APPS: |
514 case syncer::EXTENSIONS: | 531 case syncer::EXTENSIONS: |
515 return ExtensionSyncService::Get(profile_)->AsWeakPtr(); | 532 return ExtensionSyncService::Get(profile_)->AsWeakPtr(); |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
722 new TypedUrlModelAssociator(profile_sync_service, | 739 new TypedUrlModelAssociator(profile_sync_service, |
723 history_backend, | 740 history_backend, |
724 error_handler); | 741 error_handler); |
725 TypedUrlChangeProcessor* change_processor = | 742 TypedUrlChangeProcessor* change_processor = |
726 new TypedUrlChangeProcessor(profile_, | 743 new TypedUrlChangeProcessor(profile_, |
727 model_associator, | 744 model_associator, |
728 history_backend, | 745 history_backend, |
729 error_handler); | 746 error_handler); |
730 return SyncComponents(model_associator, change_processor); | 747 return SyncComponents(model_associator, change_processor); |
731 } | 748 } |
OLD | NEW |