| 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 "ios/chrome/browser/sync/ios_chrome_sync_client.h" | 5 #include "ios/chrome/browser/sync/ios_chrome_sync_client.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/memory/ptr_util.h" | 13 #include "base/memory/ptr_util.h" |
| 14 #include "components/autofill/core/browser/webdata/autocomplete_sync_bridge.h" | 14 #include "components/autofill/core/browser/webdata/autocomplete_sync_bridge.h" |
| 15 #include "components/autofill/core/browser/webdata/autocomplete_syncable_service
.h" | 15 #include "components/autofill/core/browser/webdata/autocomplete_syncable_service
.h" |
| 16 #include "components/autofill/core/browser/webdata/autofill_profile_syncable_ser
vice.h" | 16 #include "components/autofill/core/browser/webdata/autofill_profile_syncable_ser
vice.h" |
| 17 #include "components/autofill/core/browser/webdata/autofill_wallet_metadata_sync
able_service.h" | 17 #include "components/autofill/core/browser/webdata/autofill_wallet_metadata_sync
able_service.h" |
| 18 #include "components/autofill/core/browser/webdata/autofill_wallet_syncable_serv
ice.h" | 18 #include "components/autofill/core/browser/webdata/autofill_wallet_syncable_serv
ice.h" |
| 19 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" | 19 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" |
| 20 #include "components/browser_sync/browser_sync_switches.h" | 20 #include "components/browser_sync/browser_sync_switches.h" |
| 21 #include "components/browser_sync/profile_sync_components_factory_impl.h" | 21 #include "components/browser_sync/profile_sync_components_factory_impl.h" |
| 22 #include "components/browser_sync/profile_sync_service.h" | 22 #include "components/browser_sync/profile_sync_service.h" |
| 23 #include "components/dom_distiller/core/dom_distiller_service.h" | 23 #include "components/dom_distiller/core/dom_distiller_service.h" |
| 24 #include "components/history/core/browser/history_model_worker.h" | 24 #include "components/history/core/browser/history_model_worker.h" |
| 25 #include "components/history/core/browser/history_service.h" | 25 #include "components/history/core/browser/history_service.h" |
| 26 #include "components/history/core/browser/typed_url_sync_bridge.h" |
| 27 #include "components/history/core/browser/typed_url_syncable_service.h" |
| 26 #include "components/invalidation/impl/profile_invalidation_provider.h" | 28 #include "components/invalidation/impl/profile_invalidation_provider.h" |
| 27 #include "components/keyed_service/core/service_access_type.h" | 29 #include "components/keyed_service/core/service_access_type.h" |
| 28 #include "components/password_manager/core/browser/password_store.h" | 30 #include "components/password_manager/core/browser/password_store.h" |
| 29 #include "components/password_manager/sync/browser/password_model_worker.h" | 31 #include "components/password_manager/sync/browser/password_model_worker.h" |
| 30 #include "components/reading_list/core/reading_list_switches.h" | 32 #include "components/reading_list/core/reading_list_switches.h" |
| 31 #include "components/reading_list/ios/reading_list_model.h" | 33 #include "components/reading_list/ios/reading_list_model.h" |
| 32 #include "components/search_engines/search_engine_data_type_controller.h" | 34 #include "components/search_engines/search_engine_data_type_controller.h" |
| 33 #include "components/signin/core/browser/profile_oauth2_token_service.h" | 35 #include "components/signin/core/browser/profile_oauth2_token_service.h" |
| 34 #include "components/sync/base/report_unrecoverable_error.h" | 36 #include "components/sync/base/report_unrecoverable_error.h" |
| 35 #include "components/sync/driver/sync_api_component_factory.h" | 37 #include "components/sync/driver/sync_api_component_factory.h" |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 case syncer::READING_LIST: { | 348 case syncer::READING_LIST: { |
| 347 DCHECK(reading_list::switches::IsReadingListEnabled()); | 349 DCHECK(reading_list::switches::IsReadingListEnabled()); |
| 348 ReadingListModel* reading_list_model = | 350 ReadingListModel* reading_list_model = |
| 349 ReadingListModelFactory::GetForBrowserState(browser_state_); | 351 ReadingListModelFactory::GetForBrowserState(browser_state_); |
| 350 return reading_list_model->GetModelTypeSyncBridge()->AsWeakPtr(); | 352 return reading_list_model->GetModelTypeSyncBridge()->AsWeakPtr(); |
| 351 } | 353 } |
| 352 case syncer::AUTOFILL: | 354 case syncer::AUTOFILL: |
| 353 return autofill::AutocompleteSyncBridge::FromWebDataService( | 355 return autofill::AutocompleteSyncBridge::FromWebDataService( |
| 354 web_data_service_.get()) | 356 web_data_service_.get()) |
| 355 ->AsWeakPtr(); | 357 ->AsWeakPtr(); |
| 358 case syncer::TYPED_URLS: { |
| 359 history::HistoryService* history = |
| 360 ios::HistoryServiceFactory::GetForBrowserState( |
| 361 browser_state_, ServiceAccessType::EXPLICIT_ACCESS); |
| 362 return history ? history->GetTypedURLSyncBridge()->AsWeakPtr() |
| 363 : base::WeakPtr<syncer::ModelTypeSyncBridge>(); |
| 364 } |
| 356 default: | 365 default: |
| 357 NOTREACHED(); | 366 NOTREACHED(); |
| 358 return base::WeakPtr<syncer::ModelTypeSyncBridge>(); | 367 return base::WeakPtr<syncer::ModelTypeSyncBridge>(); |
| 359 } | 368 } |
| 360 } | 369 } |
| 361 | 370 |
| 362 scoped_refptr<syncer::ModelSafeWorker> | 371 scoped_refptr<syncer::ModelSafeWorker> |
| 363 IOSChromeSyncClient::CreateModelWorkerForGroup(syncer::ModelSafeGroup group) { | 372 IOSChromeSyncClient::CreateModelWorkerForGroup(syncer::ModelSafeGroup group) { |
| 364 DCHECK_CURRENTLY_ON(web::WebThread::UI); | 373 DCHECK_CURRENTLY_ON(web::WebThread::UI); |
| 365 switch (group) { | 374 switch (group) { |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 IOSChromeProfileSyncServiceFactory::GetForBrowserState(browser_state); | 426 IOSChromeProfileSyncServiceFactory::GetForBrowserState(browser_state); |
| 418 if (profile_sync_service != nullptr) { | 427 if (profile_sync_service != nullptr) { |
| 419 const syncer::DeviceInfoTracker* tracker = | 428 const syncer::DeviceInfoTracker* tracker = |
| 420 profile_sync_service->GetDeviceInfoTracker(); | 429 profile_sync_service->GetDeviceInfoTracker(); |
| 421 if (tracker != nullptr) { | 430 if (tracker != nullptr) { |
| 422 trackers->push_back(tracker); | 431 trackers->push_back(tracker); |
| 423 } | 432 } |
| 424 } | 433 } |
| 425 } | 434 } |
| 426 } | 435 } |
| OLD | NEW |