| 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 <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/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
| 12 #include "base/path_service.h" | 12 #include "base/path_service.h" |
| 13 #include "base/syslog_logging.h" | 13 #include "base/syslog_logging.h" |
| 14 #include "build/build_config.h" | 14 #include "build/build_config.h" |
| 15 #include "chrome/browser/autofill/personal_data_manager_factory.h" | 15 #include "chrome/browser/autofill/personal_data_manager_factory.h" |
| 16 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 16 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| 17 #include "chrome/browser/browser_process.h" | 17 #include "chrome/browser/browser_process.h" |
| 18 #include "chrome/browser/dom_distiller/dom_distiller_service_factory.h" | 18 #include "chrome/browser/dom_distiller/dom_distiller_service_factory.h" |
| 19 #include "chrome/browser/extensions/api/storage/backend_task_runner.h" |
| 19 #include "chrome/browser/favicon/favicon_service_factory.h" | 20 #include "chrome/browser/favicon/favicon_service_factory.h" |
| 20 #include "chrome/browser/history/history_service_factory.h" | 21 #include "chrome/browser/history/history_service_factory.h" |
| 21 #include "chrome/browser/invalidation/profile_invalidation_provider_factory.h" | 22 #include "chrome/browser/invalidation/profile_invalidation_provider_factory.h" |
| 22 #include "chrome/browser/password_manager/password_store_factory.h" | 23 #include "chrome/browser/password_manager/password_store_factory.h" |
| 23 #include "chrome/browser/prefs/pref_service_syncable_util.h" | 24 #include "chrome/browser/prefs/pref_service_syncable_util.h" |
| 24 #include "chrome/browser/profiles/profile.h" | 25 #include "chrome/browser/profiles/profile.h" |
| 25 #include "chrome/browser/profiles/profile_manager.h" | 26 #include "chrome/browser/profiles/profile_manager.h" |
| 26 #include "chrome/browser/search_engines/template_url_service_factory.h" | 27 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 27 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 28 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
| 28 #include "chrome/browser/sync/glue/sync_start_util.h" | 29 #include "chrome/browser/sync/glue/sync_start_util.h" |
| (...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 529 } | 530 } |
| 530 | 531 |
| 531 scoped_refptr<syncer::ModelSafeWorker> | 532 scoped_refptr<syncer::ModelSafeWorker> |
| 532 ChromeSyncClient::CreateModelWorkerForGroup(syncer::ModelSafeGroup group) { | 533 ChromeSyncClient::CreateModelWorkerForGroup(syncer::ModelSafeGroup group) { |
| 533 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 534 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 534 switch (group) { | 535 switch (group) { |
| 535 case syncer::GROUP_DB: | 536 case syncer::GROUP_DB: |
| 536 return new syncer::SequencedModelWorker( | 537 return new syncer::SequencedModelWorker( |
| 537 BrowserThread::GetTaskRunnerForThread(BrowserThread::DB), | 538 BrowserThread::GetTaskRunnerForThread(BrowserThread::DB), |
| 538 syncer::GROUP_DB); | 539 syncer::GROUP_DB); |
| 540 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 541 // TODO(stanisc): crbug.com/731903: Rename GROUP_FILE to reflect that it is |
| 542 // used only for app and extension settings. |
| 539 case syncer::GROUP_FILE: | 543 case syncer::GROUP_FILE: |
| 540 return new syncer::SequencedModelWorker( | 544 return new syncer::SequencedModelWorker( |
| 541 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE), | 545 extensions::GetBackendTaskRunner(), syncer::GROUP_FILE); |
| 542 syncer::GROUP_FILE); | 546 #endif // BUILDFLAG(ENABLE_EXTENSIONS) |
| 543 case syncer::GROUP_UI: | 547 case syncer::GROUP_UI: |
| 544 return new syncer::UIModelWorker( | 548 return new syncer::UIModelWorker( |
| 545 BrowserThread::GetTaskRunnerForThread(BrowserThread::UI)); | 549 BrowserThread::GetTaskRunnerForThread(BrowserThread::UI)); |
| 546 case syncer::GROUP_PASSIVE: | 550 case syncer::GROUP_PASSIVE: |
| 547 return new syncer::PassiveModelWorker(); | 551 return new syncer::PassiveModelWorker(); |
| 548 case syncer::GROUP_HISTORY: { | 552 case syncer::GROUP_HISTORY: { |
| 549 history::HistoryService* history_service = GetHistoryService(); | 553 history::HistoryService* history_service = GetHistoryService(); |
| 550 if (!history_service) | 554 if (!history_service) |
| 551 return nullptr; | 555 return nullptr; |
| 552 return new HistoryModelWorker( | 556 return new HistoryModelWorker( |
| 553 history_service->AsWeakPtr(), | 557 history_service->AsWeakPtr(), |
| 554 BrowserThread::GetTaskRunnerForThread(BrowserThread::UI)); | 558 BrowserThread::GetTaskRunnerForThread(BrowserThread::UI)); |
| 555 } | 559 } |
| 556 case syncer::GROUP_PASSWORD: { | 560 case syncer::GROUP_PASSWORD: { |
| 557 if (!password_store_.get()) | 561 if (!password_store_.get()) |
| 558 return nullptr; | 562 return nullptr; |
| 559 return new PasswordModelWorker(password_store_); | 563 return new PasswordModelWorker(password_store_); |
| 560 } | 564 } |
| 561 default: | 565 default: |
| 566 NOTREACHED(); |
| 562 return nullptr; | 567 return nullptr; |
| 563 } | 568 } |
| 564 } | 569 } |
| 565 | 570 |
| 566 syncer::SyncApiComponentFactory* | 571 syncer::SyncApiComponentFactory* |
| 567 ChromeSyncClient::GetSyncApiComponentFactory() { | 572 ChromeSyncClient::GetSyncApiComponentFactory() { |
| 568 return component_factory_.get(); | 573 return component_factory_.get(); |
| 569 } | 574 } |
| 570 | 575 |
| 571 void ChromeSyncClient::SetSyncApiComponentFactoryForTesting( | 576 void ChromeSyncClient::SetSyncApiComponentFactoryForTesting( |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 718 sync_service->RegisterDataTypeController( | 723 sync_service->RegisterDataTypeController( |
| 719 base::MakeUnique<SupervisedUserSyncDataTypeController>( | 724 base::MakeUnique<SupervisedUserSyncDataTypeController>( |
| 720 syncer::SUPERVISED_USER_SETTINGS, error_callback, this, profile_)); | 725 syncer::SUPERVISED_USER_SETTINGS, error_callback, this, profile_)); |
| 721 sync_service->RegisterDataTypeController( | 726 sync_service->RegisterDataTypeController( |
| 722 base::MakeUnique<SupervisedUserSyncDataTypeController>( | 727 base::MakeUnique<SupervisedUserSyncDataTypeController>( |
| 723 syncer::SUPERVISED_USER_WHITELISTS, error_callback, this, profile_)); | 728 syncer::SUPERVISED_USER_WHITELISTS, error_callback, this, profile_)); |
| 724 #endif // BUILDFLAG(ENABLE_SUPERVISED_USERS) | 729 #endif // BUILDFLAG(ENABLE_SUPERVISED_USERS) |
| 725 } | 730 } |
| 726 | 731 |
| 727 } // namespace browser_sync | 732 } // namespace browser_sync |
| OLD | NEW |