| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/glue/sync_backend_host_impl.h" | 5 #include "chrome/browser/sync/glue/sync_backend_host_impl.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| 11 #include "chrome/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
| 12 #include "chrome/browser/chrome_notification_types.h" | 12 #include "chrome/browser/chrome_notification_types.h" |
| 13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
| 14 #include "chrome/browser/signin/chrome_signin_client_factory.h" | 14 #include "chrome/browser/signin/chrome_signin_client_factory.h" |
| 15 #include "chrome/browser/sync/glue/sync_backend_host_core.h" | 15 #include "chrome/browser/sync/glue/sync_backend_host_core.h" |
| 16 #include "chrome/browser/sync/glue/sync_backend_registrar.h" | 16 #include "chrome/browser/sync/glue/sync_backend_registrar.h" |
| 17 #include "chrome/common/chrome_switches.h" | 17 #include "chrome/common/chrome_switches.h" |
| 18 #include "components/invalidation/public/invalidation_service.h" | 18 #include "components/invalidation/public/invalidation_service.h" |
| 19 #include "components/invalidation/public/object_id_invalidation_map.h" | 19 #include "components/invalidation/public/object_id_invalidation_map.h" |
| 20 #include "components/network_time/network_time_tracker.h" | 20 #include "components/network_time/network_time_tracker.h" |
| 21 #include "components/signin/core/browser/signin_client.h" | 21 #include "components/signin/core/browser/signin_client.h" |
| 22 #include "components/sync_driver/invalidation_helper.h" | 22 #include "components/sync_driver/invalidation_helper.h" |
| 23 #include "components/sync_driver/sync_driver_switches.h" | 23 #include "components/sync_driver/sync_driver_switches.h" |
| 24 #include "components/sync_driver/sync_frontend.h" | 24 #include "components/sync_driver/sync_frontend.h" |
| 25 #include "components/sync_driver/sync_prefs.h" | 25 #include "components/sync_driver/sync_prefs.h" |
| 26 #include "content/public/browser/notification_details.h" | 26 #include "content/public/browser/notification_details.h" |
| 27 #include "content/public/browser/notification_source.h" | 27 #include "content/public/browser/notification_source.h" |
| 28 #include "sync/internal_api/public/activation_context.h" |
| 28 #include "sync/internal_api/public/base_transaction.h" | 29 #include "sync/internal_api/public/base_transaction.h" |
| 29 #include "sync/internal_api/public/events/protocol_event.h" | 30 #include "sync/internal_api/public/events/protocol_event.h" |
| 30 #include "sync/internal_api/public/http_bridge.h" | 31 #include "sync/internal_api/public/http_bridge.h" |
| 31 #include "sync/internal_api/public/internal_components_factory.h" | 32 #include "sync/internal_api/public/internal_components_factory.h" |
| 32 #include "sync/internal_api/public/internal_components_factory_impl.h" | 33 #include "sync/internal_api/public/internal_components_factory_impl.h" |
| 33 #include "sync/internal_api/public/network_resources.h" | 34 #include "sync/internal_api/public/network_resources.h" |
| 34 #include "sync/internal_api/public/sync_manager.h" | 35 #include "sync/internal_api/public/sync_manager.h" |
| 35 #include "sync/internal_api/public/sync_manager_factory.h" | 36 #include "sync/internal_api/public/sync_manager_factory.h" |
| 36 #include "sync/internal_api/public/util/experiments.h" | 37 #include "sync/internal_api/public/util/experiments.h" |
| 37 #include "sync/internal_api/public/util/sync_string_conversions.h" | 38 #include "sync/internal_api/public/util/sync_string_conversions.h" |
| (...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 DCHECK(syncer::Intersection(active_types, inactive_types).Empty()); | 446 DCHECK(syncer::Intersection(active_types, inactive_types).Empty()); |
| 446 return syncer::Difference(active_types, types_to_download); | 447 return syncer::Difference(active_types, types_to_download); |
| 447 } | 448 } |
| 448 | 449 |
| 449 void SyncBackendHostImpl::EnableEncryptEverything() { | 450 void SyncBackendHostImpl::EnableEncryptEverything() { |
| 450 registrar_->sync_thread()->task_runner()->PostTask( | 451 registrar_->sync_thread()->task_runner()->PostTask( |
| 451 FROM_HERE, | 452 FROM_HERE, |
| 452 base::Bind(&SyncBackendHostCore::DoEnableEncryptEverything, core_.get())); | 453 base::Bind(&SyncBackendHostCore::DoEnableEncryptEverything, core_.get())); |
| 453 } | 454 } |
| 454 | 455 |
| 455 void SyncBackendHostImpl::ActivateDataType( | 456 void SyncBackendHostImpl::ActivateDirectoryDataType( |
| 456 syncer::ModelType type, syncer::ModelSafeGroup group, | 457 syncer::ModelType type, |
| 458 syncer::ModelSafeGroup group, |
| 457 sync_driver::ChangeProcessor* change_processor) { | 459 sync_driver::ChangeProcessor* change_processor) { |
| 458 registrar_->ActivateDataType(type, group, change_processor, GetUserShare()); | 460 registrar_->ActivateDataType(type, group, change_processor, GetUserShare()); |
| 459 } | 461 } |
| 460 | 462 |
| 461 void SyncBackendHostImpl::DeactivateDataType(syncer::ModelType type) { | 463 void SyncBackendHostImpl::DeactivateDirectoryDataType(syncer::ModelType type) { |
| 462 registrar_->DeactivateDataType(type); | 464 registrar_->DeactivateDataType(type); |
| 463 } | 465 } |
| 464 | 466 |
| 467 void SyncBackendHostImpl::ActivateNonBlockingDataType( |
| 468 syncer::ModelType type, |
| 469 scoped_ptr<syncer_v2::ActivationContext> activation_context) { |
| 470 sync_context_proxy_->ConnectTypeToSync(type, activation_context.Pass()); |
| 471 } |
| 472 |
| 473 void SyncBackendHostImpl::DeactivateNonBlockingDataType( |
| 474 syncer::ModelType type) { |
| 475 sync_context_proxy_->Disconnect(type); |
| 476 } |
| 477 |
| 465 syncer::UserShare* SyncBackendHostImpl::GetUserShare() const { | 478 syncer::UserShare* SyncBackendHostImpl::GetUserShare() const { |
| 466 return core_->sync_manager()->GetUserShare(); | 479 return core_->sync_manager()->GetUserShare(); |
| 467 } | 480 } |
| 468 | 481 |
| 469 scoped_ptr<syncer_v2::SyncContextProxy> | 482 scoped_ptr<syncer_v2::SyncContextProxy> |
| 470 SyncBackendHostImpl::GetSyncContextProxy() { | 483 SyncBackendHostImpl::GetSyncContextProxy() { |
| 471 return sync_context_proxy_.get() ? scoped_ptr<syncer_v2::SyncContextProxy>( | 484 return sync_context_proxy_.get() ? scoped_ptr<syncer_v2::SyncContextProxy>( |
| 472 sync_context_proxy_->Clone()) | 485 sync_context_proxy_->Clone()) |
| 473 : scoped_ptr<syncer_v2::SyncContextProxy>(); | 486 : scoped_ptr<syncer_v2::SyncContextProxy>(); |
| 474 } | 487 } |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 897 const syncer::SyncManager::ClearServerDataCallback& frontend_callback) { | 910 const syncer::SyncManager::ClearServerDataCallback& frontend_callback) { |
| 898 DCHECK(ui_thread_->BelongsToCurrentThread()); | 911 DCHECK(ui_thread_->BelongsToCurrentThread()); |
| 899 frontend_callback.Run(); | 912 frontend_callback.Run(); |
| 900 } | 913 } |
| 901 | 914 |
| 902 } // namespace browser_sync | 915 } // namespace browser_sync |
| 903 | 916 |
| 904 #undef SDVLOG | 917 #undef SDVLOG |
| 905 | 918 |
| 906 #undef SLOG | 919 #undef SLOG |
| OLD | NEW |