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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "chrome/browser/autofill/personal_data_manager_factory.h" | 9 #include "chrome/browser/autofill/personal_data_manager_factory.h" |
10 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 10 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 #include "chrome/browser/sync/glue/theme_data_type_controller.h" | 22 #include "chrome/browser/sync/glue/theme_data_type_controller.h" |
23 #include "chrome/browser/sync/profile_sync_service_factory.h" | 23 #include "chrome/browser/sync/profile_sync_service_factory.h" |
24 #include "chrome/browser/sync/sessions/notification_service_sessions_router.h" | 24 #include "chrome/browser/sync/sessions/notification_service_sessions_router.h" |
25 #include "chrome/browser/themes/theme_service.h" | 25 #include "chrome/browser/themes/theme_service.h" |
26 #include "chrome/browser/themes/theme_service_factory.h" | 26 #include "chrome/browser/themes/theme_service_factory.h" |
27 #include "chrome/browser/themes/theme_syncable_service.h" | 27 #include "chrome/browser/themes/theme_syncable_service.h" |
28 #include "chrome/browser/ui/sync/browser_synced_window_delegates_getter.h" | 28 #include "chrome/browser/ui/sync/browser_synced_window_delegates_getter.h" |
29 #include "chrome/browser/undo/bookmark_undo_service_factory.h" | 29 #include "chrome/browser/undo/bookmark_undo_service_factory.h" |
30 #include "chrome/browser/web_data_service_factory.h" | 30 #include "chrome/browser/web_data_service_factory.h" |
31 #include "chrome/common/channel_info.h" | 31 #include "chrome/common/channel_info.h" |
| 32 #include "chrome/common/features.h" |
32 #include "chrome/common/pref_names.h" | 33 #include "chrome/common/pref_names.h" |
33 #include "chrome/common/url_constants.h" | 34 #include "chrome/common/url_constants.h" |
34 #include "components/autofill/core/browser/webdata/autocomplete_syncable_service
.h" | 35 #include "components/autofill/core/browser/webdata/autocomplete_syncable_service
.h" |
35 #include "components/autofill/core/browser/webdata/autofill_profile_syncable_ser
vice.h" | 36 #include "components/autofill/core/browser/webdata/autofill_profile_syncable_ser
vice.h" |
36 #include "components/autofill/core/browser/webdata/autofill_wallet_metadata_sync
able_service.h" | 37 #include "components/autofill/core/browser/webdata/autofill_wallet_metadata_sync
able_service.h" |
37 #include "components/autofill/core/browser/webdata/autofill_wallet_syncable_serv
ice.h" | 38 #include "components/autofill/core/browser/webdata/autofill_wallet_syncable_serv
ice.h" |
38 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" | 39 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" |
39 #include "components/browser_sync/browser/profile_sync_components_factory_impl.h
" | 40 #include "components/browser_sync/browser/profile_sync_components_factory_impl.h
" |
40 #include "components/browser_sync/browser/profile_sync_service.h" | 41 #include "components/browser_sync/browser/profile_sync_service.h" |
41 #include "components/browser_sync/common/browser_sync_switches.h" | 42 #include "components/browser_sync/common/browser_sync_switches.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 #include "chrome/browser/supervised_user/supervised_user_settings_service_factor
y.h" | 84 #include "chrome/browser/supervised_user/supervised_user_settings_service_factor
y.h" |
84 #include "chrome/browser/supervised_user/supervised_user_sync_data_type_controll
er.h" | 85 #include "chrome/browser/supervised_user/supervised_user_sync_data_type_controll
er.h" |
85 #include "chrome/browser/supervised_user/supervised_user_whitelist_service.h" | 86 #include "chrome/browser/supervised_user/supervised_user_whitelist_service.h" |
86 #endif | 87 #endif |
87 | 88 |
88 #if defined(ENABLE_SPELLCHECK) | 89 #if defined(ENABLE_SPELLCHECK) |
89 #include "chrome/browser/spellchecker/spellcheck_factory.h" | 90 #include "chrome/browser/spellchecker/spellcheck_factory.h" |
90 #include "chrome/browser/spellchecker/spellcheck_service.h" | 91 #include "chrome/browser/spellchecker/spellcheck_service.h" |
91 #endif | 92 #endif |
92 | 93 |
93 #if defined(OS_ANDROID) | 94 #if BUILDFLAG(ANDROID_JAVA_UI) |
94 #include "chrome/browser/sync/glue/synced_window_delegates_getter_android.h" | 95 #include "chrome/browser/sync/glue/synced_window_delegates_getter_android.h" |
95 #endif | 96 #endif |
96 | 97 |
97 #if defined(OS_CHROMEOS) | 98 #if defined(OS_CHROMEOS) |
98 #include "components/wifi_sync/wifi_credential_syncable_service.h" | 99 #include "components/wifi_sync/wifi_credential_syncable_service.h" |
99 #include "components/wifi_sync/wifi_credential_syncable_service_factory.h" | 100 #include "components/wifi_sync/wifi_credential_syncable_service_factory.h" |
100 #endif | 101 #endif |
101 | 102 |
102 using content::BrowserThread; | 103 using content::BrowserThread; |
103 #if defined(ENABLE_EXTENSIONS) | 104 #if defined(ENABLE_EXTENSIONS) |
104 using browser_sync::ExtensionDataTypeController; | 105 using browser_sync::ExtensionDataTypeController; |
105 using browser_sync::ExtensionSettingDataTypeController; | 106 using browser_sync::ExtensionSettingDataTypeController; |
106 #endif | 107 #endif |
107 using browser_sync::SearchEngineDataTypeController; | 108 using browser_sync::SearchEngineDataTypeController; |
108 using sync_driver::UIDataTypeController; | 109 using sync_driver::UIDataTypeController; |
109 | 110 |
110 namespace browser_sync { | 111 namespace browser_sync { |
111 | 112 |
112 // Chrome implementation of SyncSessionsClient. Needs to be in a separate class | 113 // Chrome implementation of SyncSessionsClient. Needs to be in a separate class |
113 // due to possible multiple inheritance issues, wherein ChromeSyncClient might | 114 // due to possible multiple inheritance issues, wherein ChromeSyncClient might |
114 // inherit from other interfaces with same methods. | 115 // inherit from other interfaces with same methods. |
115 class SyncSessionsClientImpl : public sync_sessions::SyncSessionsClient { | 116 class SyncSessionsClientImpl : public sync_sessions::SyncSessionsClient { |
116 public: | 117 public: |
117 explicit SyncSessionsClientImpl(Profile* profile) : profile_(profile) { | 118 explicit SyncSessionsClientImpl(Profile* profile) : profile_(profile) { |
118 window_delegates_getter_.reset( | 119 window_delegates_getter_.reset( |
119 #if defined(OS_ANDROID) | 120 #if BUILDFLAG(ANDROID_JAVA_UI) |
120 // Android doesn't have multi-profile support, so no need to pass the | 121 // Android doesn't have multi-profile support, so no need to pass the |
121 // profile in. | 122 // profile in. |
122 new browser_sync::SyncedWindowDelegatesGetterAndroid()); | 123 new browser_sync::SyncedWindowDelegatesGetterAndroid()); |
123 #else | 124 #else |
124 new browser_sync::BrowserSyncedWindowDelegatesGetter(profile)); | 125 new browser_sync::BrowserSyncedWindowDelegatesGetter(profile)); |
125 #endif | 126 #endif |
126 } | 127 } |
127 ~SyncSessionsClientImpl() override {} | 128 ~SyncSessionsClientImpl() override {} |
128 | 129 |
129 // SyncSessionsClient implementation. | 130 // SyncSessionsClient implementation. |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 | 256 |
256 base::Closure ChromeSyncClient::GetPasswordStateChangedCallback() { | 257 base::Closure ChromeSyncClient::GetPasswordStateChangedCallback() { |
257 return base::Bind( | 258 return base::Bind( |
258 &PasswordStoreFactory::OnPasswordsSyncedStatePotentiallyChanged, | 259 &PasswordStoreFactory::OnPasswordsSyncedStatePotentiallyChanged, |
259 base::Unretained(profile_)); | 260 base::Unretained(profile_)); |
260 } | 261 } |
261 | 262 |
262 sync_driver::SyncApiComponentFactory::RegisterDataTypesMethod | 263 sync_driver::SyncApiComponentFactory::RegisterDataTypesMethod |
263 ChromeSyncClient::GetRegisterPlatformTypesCallback() { | 264 ChromeSyncClient::GetRegisterPlatformTypesCallback() { |
264 return base::Bind( | 265 return base::Bind( |
265 #ifdef OS_ANDROID | 266 #if BUILDFLAG(ANDROID_JAVA_UI) |
266 &ChromeSyncClient::RegisterAndroidDataTypes, | 267 &ChromeSyncClient::RegisterAndroidDataTypes, |
267 #else | 268 #else |
268 &ChromeSyncClient::RegisterDesktopDataTypes, | 269 &ChromeSyncClient::RegisterDesktopDataTypes, |
269 #endif // OS_ANDROID | 270 #endif // BUILDFLAG(ANDROID_JAVA_UI) |
270 weak_ptr_factory_.GetWeakPtr()); | 271 weak_ptr_factory_.GetWeakPtr()); |
271 } | 272 } |
272 | 273 |
273 scoped_refptr<autofill::AutofillWebDataService> | 274 scoped_refptr<autofill::AutofillWebDataService> |
274 ChromeSyncClient::GetWebDataService() { | 275 ChromeSyncClient::GetWebDataService() { |
275 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 276 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
276 return WebDataServiceFactory::GetAutofillWebDataForProfile( | 277 return WebDataServiceFactory::GetAutofillWebDataForProfile( |
277 profile_, ServiceAccessType::EXPLICIT_ACCESS); | 278 profile_, ServiceAccessType::EXPLICIT_ACCESS); |
278 } | 279 } |
279 | 280 |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
610 sync_service->RegisterDataTypeController( | 611 sync_service->RegisterDataTypeController( |
611 new SupervisedUserSyncDataTypeController(syncer::SUPERVISED_USER_SETTINGS, | 612 new SupervisedUserSyncDataTypeController(syncer::SUPERVISED_USER_SETTINGS, |
612 error_callback, this, profile_)); | 613 error_callback, this, profile_)); |
613 sync_service->RegisterDataTypeController( | 614 sync_service->RegisterDataTypeController( |
614 new SupervisedUserSyncDataTypeController( | 615 new SupervisedUserSyncDataTypeController( |
615 syncer::SUPERVISED_USER_WHITELISTS, error_callback, this, profile_)); | 616 syncer::SUPERVISED_USER_WHITELISTS, error_callback, this, profile_)); |
616 #endif | 617 #endif |
617 } | 618 } |
618 | 619 |
619 } // namespace browser_sync | 620 } // namespace browser_sync |
OLD | NEW |