OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "chrome/browser/sync/chrome_sync_client.h" | 5 #include "chrome/browser/sync/chrome_sync_client.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 #include "components/dom_distiller/core/dom_distiller_service.h" | 50 #include "components/dom_distiller/core/dom_distiller_service.h" |
51 #include "components/history/core/browser/history_model_worker.h" | 51 #include "components/history/core/browser/history_model_worker.h" |
52 #include "components/history/core/browser/history_service.h" | 52 #include "components/history/core/browser/history_service.h" |
53 #include "components/invalidation/impl/profile_invalidation_provider.h" | 53 #include "components/invalidation/impl/profile_invalidation_provider.h" |
54 #include "components/password_manager/core/browser/password_store.h" | 54 #include "components/password_manager/core/browser/password_store.h" |
55 #include "components/password_manager/sync/browser/password_model_worker.h" | 55 #include "components/password_manager/sync/browser/password_model_worker.h" |
56 #include "components/search_engines/search_engine_data_type_controller.h" | 56 #include "components/search_engines/search_engine_data_type_controller.h" |
57 #include "components/signin/core/browser/profile_oauth2_token_service.h" | 57 #include "components/signin/core/browser/profile_oauth2_token_service.h" |
58 #include "components/spellcheck/spellcheck_build_features.h" | 58 #include "components/spellcheck/spellcheck_build_features.h" |
59 #include "components/sync/base/report_unrecoverable_error.h" | 59 #include "components/sync/base/report_unrecoverable_error.h" |
60 #include "components/sync/driver/non_ui_data_type_controller.h" | 60 #include "components/sync/driver/async_directory_type_controller.h" |
61 #include "components/sync/driver/sync_api_component_factory.h" | 61 #include "components/sync/driver/sync_api_component_factory.h" |
62 #include "components/sync/driver/sync_util.h" | 62 #include "components/sync/driver/sync_util.h" |
63 #include "components/sync/engine/browser_thread_model_worker.h" | 63 #include "components/sync/engine/browser_thread_model_worker.h" |
64 #include "components/sync/engine/passive_model_worker.h" | 64 #include "components/sync/engine/passive_model_worker.h" |
65 #include "components/sync/engine/ui_model_worker.h" | 65 #include "components/sync/engine/ui_model_worker.h" |
66 #include "components/sync_preferences/pref_service_syncable.h" | 66 #include "components/sync_preferences/pref_service_syncable.h" |
67 #include "components/sync_sessions/sync_sessions_client.h" | 67 #include "components/sync_sessions/sync_sessions_client.h" |
68 #include "content/public/browser/browser_thread.h" | 68 #include "content/public/browser/browser_thread.h" |
69 #include "extensions/features/features.h" | 69 #include "extensions/features/features.h" |
70 #include "ui/base/device_form_factor.h" | 70 #include "ui/base/device_form_factor.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 #include "components/sync_wifi/wifi_credential_syncable_service.h" | 110 #include "components/sync_wifi/wifi_credential_syncable_service.h" |
111 #include "components/sync_wifi/wifi_credential_syncable_service_factory.h" | 111 #include "components/sync_wifi/wifi_credential_syncable_service_factory.h" |
112 #endif | 112 #endif |
113 | 113 |
114 using content::BrowserThread; | 114 using content::BrowserThread; |
115 #if BUILDFLAG(ENABLE_EXTENSIONS) | 115 #if BUILDFLAG(ENABLE_EXTENSIONS) |
116 using browser_sync::ExtensionDataTypeController; | 116 using browser_sync::ExtensionDataTypeController; |
117 using browser_sync::ExtensionSettingDataTypeController; | 117 using browser_sync::ExtensionSettingDataTypeController; |
118 #endif | 118 #endif |
119 using browser_sync::SearchEngineDataTypeController; | 119 using browser_sync::SearchEngineDataTypeController; |
120 using syncer::NonUIDataTypeController; | 120 using syncer::AsyncDirectoryTypeController; |
121 | 121 |
122 namespace browser_sync { | 122 namespace browser_sync { |
123 | 123 |
124 // Chrome implementation of SyncSessionsClient. Needs to be in a separate class | 124 // Chrome implementation of SyncSessionsClient. Needs to be in a separate class |
125 // due to possible multiple inheritance issues, wherein ChromeSyncClient might | 125 // due to possible multiple inheritance issues, wherein ChromeSyncClient might |
126 // inherit from other interfaces with same methods. | 126 // inherit from other interfaces with same methods. |
127 class SyncSessionsClientImpl : public sync_sessions::SyncSessionsClient { | 127 class SyncSessionsClientImpl : public sync_sessions::SyncSessionsClient { |
128 public: | 128 public: |
129 explicit SyncSessionsClientImpl(Profile* profile) : profile_(profile) { | 129 explicit SyncSessionsClientImpl(Profile* profile) : profile_(profile) { |
130 window_delegates_getter_.reset( | 130 window_delegates_getter_.reset( |
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
575 if (!disabled_types.Has(syncer::APP_SETTINGS)) { | 575 if (!disabled_types.Has(syncer::APP_SETTINGS)) { |
576 sync_service->RegisterDataTypeController( | 576 sync_service->RegisterDataTypeController( |
577 base::MakeUnique<ExtensionSettingDataTypeController>( | 577 base::MakeUnique<ExtensionSettingDataTypeController>( |
578 syncer::APP_SETTINGS, error_callback, this, profile_)); | 578 syncer::APP_SETTINGS, error_callback, this, profile_)); |
579 } | 579 } |
580 #endif | 580 #endif |
581 | 581 |
582 #if BUILDFLAG(ENABLE_APP_LIST) | 582 #if BUILDFLAG(ENABLE_APP_LIST) |
583 if (app_list::switches::IsAppListSyncEnabled()) { | 583 if (app_list::switches::IsAppListSyncEnabled()) { |
584 sync_service->RegisterDataTypeController( | 584 sync_service->RegisterDataTypeController( |
585 base::MakeUnique<NonUIDataTypeController>( | 585 base::MakeUnique<AsyncDirectoryTypeController>( |
586 syncer::APP_LIST, error_callback, this, syncer::GROUP_UI, | 586 syncer::APP_LIST, error_callback, this, syncer::GROUP_UI, |
587 BrowserThread::GetTaskRunnerForThread(BrowserThread::UI))); | 587 BrowserThread::GetTaskRunnerForThread(BrowserThread::UI))); |
588 } | 588 } |
589 #endif | 589 #endif |
590 | 590 |
591 #if defined(OS_LINUX) || defined(OS_WIN) || defined(OS_CHROMEOS) | 591 #if defined(OS_LINUX) || defined(OS_WIN) || defined(OS_CHROMEOS) |
592 // Dictionary sync is enabled by default. | 592 // Dictionary sync is enabled by default. |
593 if (!disabled_types.Has(syncer::DICTIONARY)) { | 593 if (!disabled_types.Has(syncer::DICTIONARY)) { |
594 sync_service->RegisterDataTypeController( | 594 sync_service->RegisterDataTypeController( |
595 base::MakeUnique<NonUIDataTypeController>( | 595 base::MakeUnique<AsyncDirectoryTypeController>( |
596 syncer::DICTIONARY, error_callback, this, syncer::GROUP_UI, | 596 syncer::DICTIONARY, error_callback, this, syncer::GROUP_UI, |
597 BrowserThread::GetTaskRunnerForThread(BrowserThread::UI))); | 597 BrowserThread::GetTaskRunnerForThread(BrowserThread::UI))); |
598 } | 598 } |
599 #endif | 599 #endif |
600 | 600 |
601 #if BUILDFLAG(ENABLE_SUPERVISED_USERS) | 601 #if BUILDFLAG(ENABLE_SUPERVISED_USERS) |
602 sync_service->RegisterDataTypeController( | 602 sync_service->RegisterDataTypeController( |
603 base::MakeUnique<SupervisedUserSyncDataTypeController>( | 603 base::MakeUnique<SupervisedUserSyncDataTypeController>( |
604 syncer::SUPERVISED_USER_SETTINGS, error_callback, this, profile_)); | 604 syncer::SUPERVISED_USER_SETTINGS, error_callback, this, profile_)); |
605 sync_service->RegisterDataTypeController( | 605 sync_service->RegisterDataTypeController( |
606 base::MakeUnique<SupervisedUserSyncDataTypeController>( | 606 base::MakeUnique<SupervisedUserSyncDataTypeController>( |
607 syncer::SUPERVISED_USER_WHITELISTS, error_callback, this, profile_)); | 607 syncer::SUPERVISED_USER_WHITELISTS, error_callback, this, profile_)); |
608 sync_service->RegisterDataTypeController( | 608 sync_service->RegisterDataTypeController( |
609 base::MakeUnique<SupervisedUserSyncDataTypeController>( | 609 base::MakeUnique<SupervisedUserSyncDataTypeController>( |
610 syncer::SUPERVISED_USERS, error_callback, this, profile_)); | 610 syncer::SUPERVISED_USERS, error_callback, this, profile_)); |
611 sync_service->RegisterDataTypeController( | 611 sync_service->RegisterDataTypeController( |
612 base::MakeUnique<SupervisedUserSyncDataTypeController>( | 612 base::MakeUnique<SupervisedUserSyncDataTypeController>( |
613 syncer::SUPERVISED_USER_SHARED_SETTINGS, error_callback, this, | 613 syncer::SUPERVISED_USER_SHARED_SETTINGS, error_callback, this, |
614 profile_)); | 614 profile_)); |
615 #endif | 615 #endif |
616 | 616 |
617 #if defined(OS_CHROMEOS) | 617 #if defined(OS_CHROMEOS) |
618 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 618 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
619 switches::kEnableWifiCredentialSync) && | 619 switches::kEnableWifiCredentialSync) && |
620 !disabled_types.Has(syncer::WIFI_CREDENTIALS)) { | 620 !disabled_types.Has(syncer::WIFI_CREDENTIALS)) { |
621 sync_service->RegisterDataTypeController( | 621 sync_service->RegisterDataTypeController( |
622 base::MakeUnique<NonUIDataTypeController>( | 622 base::MakeUnique<AsyncDirectoryTypeController>( |
623 syncer::WIFI_CREDENTIALS, error_callback, this, syncer::GROUP_UI, | 623 syncer::WIFI_CREDENTIALS, error_callback, this, syncer::GROUP_UI, |
624 BrowserThread::GetTaskRunnerForThread(BrowserThread::UI))); | 624 BrowserThread::GetTaskRunnerForThread(BrowserThread::UI))); |
625 } | 625 } |
626 // TODO(lgcheng): Add switch for this. | 626 // TODO(lgcheng): Add switch for this. |
627 sync_service->RegisterDataTypeController( | 627 sync_service->RegisterDataTypeController( |
628 base::MakeUnique<ArcPackageSyncDataTypeController>( | 628 base::MakeUnique<ArcPackageSyncDataTypeController>( |
629 syncer::ARC_PACKAGE, error_callback, this, profile_)); | 629 syncer::ARC_PACKAGE, error_callback, this, profile_)); |
630 #endif | 630 #endif |
631 } | 631 } |
632 | 632 |
633 void ChromeSyncClient::RegisterAndroidDataTypes( | 633 void ChromeSyncClient::RegisterAndroidDataTypes( |
634 syncer::SyncService* sync_service, | 634 syncer::SyncService* sync_service, |
635 syncer::ModelTypeSet disabled_types, | 635 syncer::ModelTypeSet disabled_types, |
636 syncer::ModelTypeSet enabled_types) { | 636 syncer::ModelTypeSet enabled_types) { |
637 base::Closure error_callback = | 637 base::Closure error_callback = |
638 base::Bind(&syncer::ReportUnrecoverableError, chrome::GetChannel()); | 638 base::Bind(&syncer::ReportUnrecoverableError, chrome::GetChannel()); |
639 #if BUILDFLAG(ENABLE_SUPERVISED_USERS) | 639 #if BUILDFLAG(ENABLE_SUPERVISED_USERS) |
640 sync_service->RegisterDataTypeController( | 640 sync_service->RegisterDataTypeController( |
641 base::MakeUnique<SupervisedUserSyncDataTypeController>( | 641 base::MakeUnique<SupervisedUserSyncDataTypeController>( |
642 syncer::SUPERVISED_USER_SETTINGS, error_callback, this, profile_)); | 642 syncer::SUPERVISED_USER_SETTINGS, error_callback, this, profile_)); |
643 sync_service->RegisterDataTypeController( | 643 sync_service->RegisterDataTypeController( |
644 base::MakeUnique<SupervisedUserSyncDataTypeController>( | 644 base::MakeUnique<SupervisedUserSyncDataTypeController>( |
645 syncer::SUPERVISED_USER_WHITELISTS, error_callback, this, profile_)); | 645 syncer::SUPERVISED_USER_WHITELISTS, error_callback, this, profile_)); |
646 #endif | 646 #endif |
647 } | 647 } |
648 | 648 |
649 } // namespace browser_sync | 649 } // namespace browser_sync |
OLD | NEW |