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

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

Issue 2511703004: [Sync] Remove UIDataTypeController (Closed)
Patch Set: Address comments 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 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 if (!disabled_types.Has(syncer::APP_SETTINGS)) { 566 if (!disabled_types.Has(syncer::APP_SETTINGS)) {
567 sync_service->RegisterDataTypeController( 567 sync_service->RegisterDataTypeController(
568 base::MakeUnique<ExtensionSettingDataTypeController>( 568 base::MakeUnique<ExtensionSettingDataTypeController>(
569 syncer::APP_SETTINGS, error_callback, this, profile_)); 569 syncer::APP_SETTINGS, error_callback, this, profile_));
570 } 570 }
571 #endif 571 #endif
572 572
573 #if BUILDFLAG(ENABLE_APP_LIST) 573 #if BUILDFLAG(ENABLE_APP_LIST)
574 if (app_list::switches::IsAppListSyncEnabled()) { 574 if (app_list::switches::IsAppListSyncEnabled()) {
575 sync_service->RegisterDataTypeController( 575 sync_service->RegisterDataTypeController(
576 base::MakeUnique<UIDataTypeController>(syncer::APP_LIST, error_callback, 576 base::MakeUnique<NonUIDataTypeController>(
577 this)); 577 syncer::APP_LIST, error_callback, this, syncer::GROUP_UI,
578 BrowserThread::GetTaskRunnerForThread(BrowserThread::UI)));
578 } 579 }
579 #endif 580 #endif
580 581
581 #if defined(OS_LINUX) || defined(OS_WIN) || defined(OS_CHROMEOS) 582 #if defined(OS_LINUX) || defined(OS_WIN) || defined(OS_CHROMEOS)
582 // Dictionary sync is enabled by default. 583 // Dictionary sync is enabled by default.
583 if (!disabled_types.Has(syncer::DICTIONARY)) { 584 if (!disabled_types.Has(syncer::DICTIONARY)) {
584 sync_service->RegisterDataTypeController( 585 sync_service->RegisterDataTypeController(
585 base::MakeUnique<UIDataTypeController>(syncer::DICTIONARY, 586 base::MakeUnique<NonUIDataTypeController>(
586 error_callback, this)); 587 syncer::DICTIONARY, error_callback, this, syncer::GROUP_UI,
588 BrowserThread::GetTaskRunnerForThread(BrowserThread::UI)));
587 } 589 }
588 #endif 590 #endif
589 591
590 #if BUILDFLAG(ENABLE_SUPERVISED_USERS) 592 #if BUILDFLAG(ENABLE_SUPERVISED_USERS)
591 sync_service->RegisterDataTypeController( 593 sync_service->RegisterDataTypeController(
592 base::MakeUnique<SupervisedUserSyncDataTypeController>( 594 base::MakeUnique<SupervisedUserSyncDataTypeController>(
593 syncer::SUPERVISED_USER_SETTINGS, error_callback, this, profile_)); 595 syncer::SUPERVISED_USER_SETTINGS, error_callback, this, profile_));
594 sync_service->RegisterDataTypeController( 596 sync_service->RegisterDataTypeController(
595 base::MakeUnique<SupervisedUserSyncDataTypeController>( 597 base::MakeUnique<SupervisedUserSyncDataTypeController>(
596 syncer::SUPERVISED_USER_WHITELISTS, error_callback, this, profile_)); 598 syncer::SUPERVISED_USER_WHITELISTS, error_callback, this, profile_));
597 sync_service->RegisterDataTypeController( 599 sync_service->RegisterDataTypeController(
598 base::MakeUnique<SupervisedUserSyncDataTypeController>( 600 base::MakeUnique<SupervisedUserSyncDataTypeController>(
599 syncer::SUPERVISED_USERS, error_callback, this, profile_)); 601 syncer::SUPERVISED_USERS, error_callback, this, profile_));
600 sync_service->RegisterDataTypeController( 602 sync_service->RegisterDataTypeController(
601 base::MakeUnique<SupervisedUserSyncDataTypeController>( 603 base::MakeUnique<SupervisedUserSyncDataTypeController>(
602 syncer::SUPERVISED_USER_SHARED_SETTINGS, error_callback, this, 604 syncer::SUPERVISED_USER_SHARED_SETTINGS, error_callback, this,
603 profile_)); 605 profile_));
604 #endif 606 #endif
605 607
606 #if defined(OS_CHROMEOS) 608 #if defined(OS_CHROMEOS)
607 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 609 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
608 switches::kEnableWifiCredentialSync) && 610 switches::kEnableWifiCredentialSync) &&
609 !disabled_types.Has(syncer::WIFI_CREDENTIALS)) { 611 !disabled_types.Has(syncer::WIFI_CREDENTIALS)) {
610 sync_service->RegisterDataTypeController( 612 sync_service->RegisterDataTypeController(
611 base::MakeUnique<UIDataTypeController>(syncer::WIFI_CREDENTIALS, 613 base::MakeUnique<NonUIDataTypeController>(
612 error_callback, this)); 614 syncer::WIFI_CREDENTIALS, error_callback, this, syncer::GROUP_UI,
615 BrowserThread::GetTaskRunnerForThread(BrowserThread::UI)));
613 } 616 }
614 // TODO(lgcheng): Add switch for this. 617 // TODO(lgcheng): Add switch for this.
615 sync_service->RegisterDataTypeController( 618 sync_service->RegisterDataTypeController(
616 base::MakeUnique<ArcPackageSyncDataTypeController>( 619 base::MakeUnique<ArcPackageSyncDataTypeController>(
617 syncer::ARC_PACKAGE, error_callback, this, profile_)); 620 syncer::ARC_PACKAGE, error_callback, this, profile_));
618 #endif 621 #endif
619 } 622 }
620 623
621 void ChromeSyncClient::RegisterAndroidDataTypes( 624 void ChromeSyncClient::RegisterAndroidDataTypes(
622 syncer::SyncService* sync_service, 625 syncer::SyncService* sync_service,
623 syncer::ModelTypeSet disabled_types, 626 syncer::ModelTypeSet disabled_types,
624 syncer::ModelTypeSet enabled_types) { 627 syncer::ModelTypeSet enabled_types) {
625 base::Closure error_callback = 628 base::Closure error_callback =
626 base::Bind(&syncer::ReportUnrecoverableError, chrome::GetChannel()); 629 base::Bind(&syncer::ReportUnrecoverableError, chrome::GetChannel());
627 #if BUILDFLAG(ENABLE_SUPERVISED_USERS) 630 #if BUILDFLAG(ENABLE_SUPERVISED_USERS)
628 sync_service->RegisterDataTypeController( 631 sync_service->RegisterDataTypeController(
629 base::MakeUnique<SupervisedUserSyncDataTypeController>( 632 base::MakeUnique<SupervisedUserSyncDataTypeController>(
630 syncer::SUPERVISED_USER_SETTINGS, error_callback, this, profile_)); 633 syncer::SUPERVISED_USER_SETTINGS, error_callback, this, profile_));
631 sync_service->RegisterDataTypeController( 634 sync_service->RegisterDataTypeController(
632 base::MakeUnique<SupervisedUserSyncDataTypeController>( 635 base::MakeUnique<SupervisedUserSyncDataTypeController>(
633 syncer::SUPERVISED_USER_WHITELISTS, error_callback, this, profile_)); 636 syncer::SUPERVISED_USER_WHITELISTS, error_callback, this, profile_));
634 #endif 637 #endif
635 } 638 }
636 639
637 } // namespace browser_sync 640 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698