Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(162)

Side by Side Diff: chrome/browser/sync/chrome_sync_client.cc

Issue 2511703004: [Sync] Remove UIDataTypeController (Closed)
Patch Set: Rebase. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 #include "components/dom_distiller/core/dom_distiller_service.h" 49 #include "components/dom_distiller/core/dom_distiller_service.h"
50 #include "components/history/core/browser/history_model_worker.h" 50 #include "components/history/core/browser/history_model_worker.h"
51 #include "components/history/core/browser/history_service.h" 51 #include "components/history/core/browser/history_service.h"
52 #include "components/invalidation/impl/profile_invalidation_provider.h" 52 #include "components/invalidation/impl/profile_invalidation_provider.h"
53 #include "components/password_manager/core/browser/password_store.h" 53 #include "components/password_manager/core/browser/password_store.h"
54 #include "components/password_manager/sync/browser/password_model_worker.h" 54 #include "components/password_manager/sync/browser/password_model_worker.h"
55 #include "components/search_engines/search_engine_data_type_controller.h" 55 #include "components/search_engines/search_engine_data_type_controller.h"
56 #include "components/signin/core/browser/profile_oauth2_token_service.h" 56 #include "components/signin/core/browser/profile_oauth2_token_service.h"
57 #include "components/spellcheck/spellcheck_build_features.h" 57 #include "components/spellcheck/spellcheck_build_features.h"
58 #include "components/sync/base/report_unrecoverable_error.h" 58 #include "components/sync/base/report_unrecoverable_error.h"
59 #include "components/sync/driver/non_ui_data_type_controller.h"
59 #include "components/sync/driver/sync_api_component_factory.h" 60 #include "components/sync/driver/sync_api_component_factory.h"
60 #include "components/sync/driver/sync_util.h" 61 #include "components/sync/driver/sync_util.h"
61 #include "components/sync/driver/ui_data_type_controller.h"
62 #include "components/sync/engine/browser_thread_model_worker.h" 62 #include "components/sync/engine/browser_thread_model_worker.h"
63 #include "components/sync/engine/passive_model_worker.h" 63 #include "components/sync/engine/passive_model_worker.h"
64 #include "components/sync/engine/ui_model_worker.h" 64 #include "components/sync/engine/ui_model_worker.h"
65 #include "components/sync_preferences/pref_service_syncable.h" 65 #include "components/sync_preferences/pref_service_syncable.h"
66 #include "components/sync_sessions/sync_sessions_client.h" 66 #include "components/sync_sessions/sync_sessions_client.h"
67 #include "content/public/browser/browser_thread.h" 67 #include "content/public/browser/browser_thread.h"
68 #include "extensions/features/features.h" 68 #include "extensions/features/features.h"
69 #include "ui/base/device_form_factor.h" 69 #include "ui/base/device_form_factor.h"
70 70
71 #if BUILDFLAG(ENABLE_APP_LIST) 71 #if BUILDFLAG(ENABLE_APP_LIST)
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 #include "components/sync_wifi/wifi_credential_syncable_service.h" 109 #include "components/sync_wifi/wifi_credential_syncable_service.h"
110 #include "components/sync_wifi/wifi_credential_syncable_service_factory.h" 110 #include "components/sync_wifi/wifi_credential_syncable_service_factory.h"
111 #endif 111 #endif
112 112
113 using content::BrowserThread; 113 using content::BrowserThread;
114 #if BUILDFLAG(ENABLE_EXTENSIONS) 114 #if BUILDFLAG(ENABLE_EXTENSIONS)
115 using browser_sync::ExtensionDataTypeController; 115 using browser_sync::ExtensionDataTypeController;
116 using browser_sync::ExtensionSettingDataTypeController; 116 using browser_sync::ExtensionSettingDataTypeController;
117 #endif 117 #endif
118 using browser_sync::SearchEngineDataTypeController; 118 using browser_sync::SearchEngineDataTypeController;
119 using syncer::UIDataTypeController; 119 using syncer::NonUIDataTypeController;
120 120
121 namespace browser_sync { 121 namespace browser_sync {
122 122
123 // Chrome implementation of SyncSessionsClient. Needs to be in a separate class 123 // Chrome implementation of SyncSessionsClient. Needs to be in a separate class
124 // due to possible multiple inheritance issues, wherein ChromeSyncClient might 124 // due to possible multiple inheritance issues, wherein ChromeSyncClient might
125 // inherit from other interfaces with same methods. 125 // inherit from other interfaces with same methods.
126 class SyncSessionsClientImpl : public sync_sessions::SyncSessionsClient { 126 class SyncSessionsClientImpl : public sync_sessions::SyncSessionsClient {
127 public: 127 public:
128 explicit SyncSessionsClientImpl(Profile* profile) : profile_(profile) { 128 explicit SyncSessionsClientImpl(Profile* profile) : profile_(profile) {
129 window_delegates_getter_.reset( 129 window_delegates_getter_.reset(
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 if (!disabled_types.Has(syncer::APP_SETTINGS)) { 570 if (!disabled_types.Has(syncer::APP_SETTINGS)) {
571 sync_service->RegisterDataTypeController( 571 sync_service->RegisterDataTypeController(
572 base::MakeUnique<ExtensionSettingDataTypeController>( 572 base::MakeUnique<ExtensionSettingDataTypeController>(
573 syncer::APP_SETTINGS, error_callback, this, profile_)); 573 syncer::APP_SETTINGS, error_callback, this, profile_));
574 } 574 }
575 #endif 575 #endif
576 576
577 #if BUILDFLAG(ENABLE_APP_LIST) 577 #if BUILDFLAG(ENABLE_APP_LIST)
578 if (app_list::switches::IsAppListSyncEnabled()) { 578 if (app_list::switches::IsAppListSyncEnabled()) {
579 sync_service->RegisterDataTypeController( 579 sync_service->RegisterDataTypeController(
580 base::MakeUnique<UIDataTypeController>(syncer::APP_LIST, error_callback, 580 base::MakeUnique<NonUIDataTypeController>(
581 this)); 581 syncer::APP_LIST, error_callback, this, syncer::GROUP_UI,
582 BrowserThread::GetTaskRunnerForThread(BrowserThread::UI)));
582 } 583 }
583 #endif 584 #endif
584 585
585 #if defined(OS_LINUX) || defined(OS_WIN) || defined(OS_CHROMEOS) 586 #if defined(OS_LINUX) || defined(OS_WIN) || defined(OS_CHROMEOS)
586 // Dictionary sync is enabled by default. 587 // Dictionary sync is enabled by default.
587 if (!disabled_types.Has(syncer::DICTIONARY)) { 588 if (!disabled_types.Has(syncer::DICTIONARY)) {
588 sync_service->RegisterDataTypeController( 589 sync_service->RegisterDataTypeController(
589 base::MakeUnique<UIDataTypeController>(syncer::DICTIONARY, 590 base::MakeUnique<NonUIDataTypeController>(
590 error_callback, this)); 591 syncer::DICTIONARY, error_callback, this, syncer::GROUP_UI,
592 BrowserThread::GetTaskRunnerForThread(BrowserThread::UI)));
591 } 593 }
592 #endif 594 #endif
593 595
594 #if BUILDFLAG(ENABLE_SUPERVISED_USERS) 596 #if BUILDFLAG(ENABLE_SUPERVISED_USERS)
595 sync_service->RegisterDataTypeController( 597 sync_service->RegisterDataTypeController(
596 base::MakeUnique<SupervisedUserSyncDataTypeController>( 598 base::MakeUnique<SupervisedUserSyncDataTypeController>(
597 syncer::SUPERVISED_USER_SETTINGS, error_callback, this, profile_)); 599 syncer::SUPERVISED_USER_SETTINGS, error_callback, this, profile_));
598 sync_service->RegisterDataTypeController( 600 sync_service->RegisterDataTypeController(
599 base::MakeUnique<SupervisedUserSyncDataTypeController>( 601 base::MakeUnique<SupervisedUserSyncDataTypeController>(
600 syncer::SUPERVISED_USER_WHITELISTS, error_callback, this, profile_)); 602 syncer::SUPERVISED_USER_WHITELISTS, error_callback, this, profile_));
601 sync_service->RegisterDataTypeController( 603 sync_service->RegisterDataTypeController(
602 base::MakeUnique<SupervisedUserSyncDataTypeController>( 604 base::MakeUnique<SupervisedUserSyncDataTypeController>(
603 syncer::SUPERVISED_USERS, error_callback, this, profile_)); 605 syncer::SUPERVISED_USERS, error_callback, this, profile_));
604 sync_service->RegisterDataTypeController( 606 sync_service->RegisterDataTypeController(
605 base::MakeUnique<SupervisedUserSyncDataTypeController>( 607 base::MakeUnique<SupervisedUserSyncDataTypeController>(
606 syncer::SUPERVISED_USER_SHARED_SETTINGS, error_callback, this, 608 syncer::SUPERVISED_USER_SHARED_SETTINGS, error_callback, this,
607 profile_)); 609 profile_));
608 #endif 610 #endif
609 611
610 #if defined(OS_CHROMEOS) 612 #if defined(OS_CHROMEOS)
611 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 613 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
612 switches::kEnableWifiCredentialSync) && 614 switches::kEnableWifiCredentialSync) &&
613 !disabled_types.Has(syncer::WIFI_CREDENTIALS)) { 615 !disabled_types.Has(syncer::WIFI_CREDENTIALS)) {
614 sync_service->RegisterDataTypeController( 616 sync_service->RegisterDataTypeController(
615 base::MakeUnique<UIDataTypeController>(syncer::WIFI_CREDENTIALS, 617 base::MakeUnique<NonUIDataTypeController>(
616 error_callback, this)); 618 syncer::WIFI_CREDENTIALS, error_callback, this, syncer::GROUP_UI,
619 BrowserThread::GetTaskRunnerForThread(BrowserThread::UI)));
617 } 620 }
618 // TODO(lgcheng): Add switch for this. 621 // TODO(lgcheng): Add switch for this.
619 sync_service->RegisterDataTypeController( 622 sync_service->RegisterDataTypeController(
620 base::MakeUnique<ArcPackageSyncDataTypeController>( 623 base::MakeUnique<ArcPackageSyncDataTypeController>(
621 syncer::ARC_PACKAGE, error_callback, this, profile_)); 624 syncer::ARC_PACKAGE, error_callback, this, profile_));
622 #endif 625 #endif
623 } 626 }
624 627
625 void ChromeSyncClient::RegisterAndroidDataTypes( 628 void ChromeSyncClient::RegisterAndroidDataTypes(
626 syncer::SyncService* sync_service, 629 syncer::SyncService* sync_service,
627 syncer::ModelTypeSet disabled_types, 630 syncer::ModelTypeSet disabled_types,
628 syncer::ModelTypeSet enabled_types) { 631 syncer::ModelTypeSet enabled_types) {
629 base::Closure error_callback = 632 base::Closure error_callback =
630 base::Bind(&syncer::ReportUnrecoverableError, chrome::GetChannel()); 633 base::Bind(&syncer::ReportUnrecoverableError, chrome::GetChannel());
631 #if BUILDFLAG(ENABLE_SUPERVISED_USERS) 634 #if BUILDFLAG(ENABLE_SUPERVISED_USERS)
632 sync_service->RegisterDataTypeController( 635 sync_service->RegisterDataTypeController(
633 base::MakeUnique<SupervisedUserSyncDataTypeController>( 636 base::MakeUnique<SupervisedUserSyncDataTypeController>(
634 syncer::SUPERVISED_USER_SETTINGS, error_callback, this, profile_)); 637 syncer::SUPERVISED_USER_SETTINGS, error_callback, this, profile_));
635 sync_service->RegisterDataTypeController( 638 sync_service->RegisterDataTypeController(
636 base::MakeUnique<SupervisedUserSyncDataTypeController>( 639 base::MakeUnique<SupervisedUserSyncDataTypeController>(
637 syncer::SUPERVISED_USER_WHITELISTS, error_callback, this, profile_)); 640 syncer::SUPERVISED_USER_WHITELISTS, error_callback, this, profile_));
638 #endif 641 #endif
639 } 642 }
640 643
641 } // namespace browser_sync 644 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698