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 "components/sync_driver/glue/sync_backend_host_impl.h" | 5 #include "components/sync_driver/glue/sync_backend_host_impl.h" |
6 | 6 |
| 7 #include <utility> |
| 8 |
7 #include "base/command_line.h" | 9 #include "base/command_line.h" |
8 #include "base/location.h" | 10 #include "base/location.h" |
9 #include "base/logging.h" | 11 #include "base/logging.h" |
10 #include "base/single_thread_task_runner.h" | 12 #include "base/single_thread_task_runner.h" |
11 #include "components/invalidation/public/invalidation_service.h" | 13 #include "components/invalidation/public/invalidation_service.h" |
12 #include "components/invalidation/public/object_id_invalidation_map.h" | 14 #include "components/invalidation/public/object_id_invalidation_map.h" |
13 #include "components/signin/core/browser/signin_client.h" | 15 #include "components/signin/core/browser/signin_client.h" |
14 #include "components/sync_driver/glue/sync_backend_host_core.h" | 16 #include "components/sync_driver/glue/sync_backend_host_core.h" |
15 #include "components/sync_driver/glue/sync_backend_registrar.h" | 17 #include "components/sync_driver/glue/sync_backend_registrar.h" |
16 #include "components/sync_driver/invalidation_helper.h" | 18 #include "components/sync_driver/invalidation_helper.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 const std::string& sync_user_agent, | 80 const std::string& sync_user_agent, |
79 const syncer::SyncCredentials& credentials, | 81 const syncer::SyncCredentials& credentials, |
80 bool delete_sync_data_folder, | 82 bool delete_sync_data_folder, |
81 scoped_ptr<syncer::SyncManagerFactory> sync_manager_factory, | 83 scoped_ptr<syncer::SyncManagerFactory> sync_manager_factory, |
82 const syncer::WeakHandle<syncer::UnrecoverableErrorHandler>& | 84 const syncer::WeakHandle<syncer::UnrecoverableErrorHandler>& |
83 unrecoverable_error_handler, | 85 unrecoverable_error_handler, |
84 const base::Closure& report_unrecoverable_error_function, | 86 const base::Closure& report_unrecoverable_error_function, |
85 const HttpPostProviderFactoryGetter& http_post_provider_factory_getter, | 87 const HttpPostProviderFactoryGetter& http_post_provider_factory_getter, |
86 scoped_ptr<syncer::SyncEncryptionHandler::NigoriState> saved_nigori_state) { | 88 scoped_ptr<syncer::SyncEncryptionHandler::NigoriState> saved_nigori_state) { |
87 registrar_.reset(new browser_sync::SyncBackendRegistrar( | 89 registrar_.reset(new browser_sync::SyncBackendRegistrar( |
88 name_, sync_client_, sync_thread.Pass(), ui_thread_, db_thread, | 90 name_, sync_client_, std::move(sync_thread), ui_thread_, db_thread, |
89 file_thread)); | 91 file_thread)); |
90 CHECK(registrar_->sync_thread()); | 92 CHECK(registrar_->sync_thread()); |
91 | 93 |
92 frontend_ = frontend; | 94 frontend_ = frontend; |
93 DCHECK(frontend); | 95 DCHECK(frontend); |
94 | 96 |
95 syncer::ModelSafeRoutingInfo routing_info; | 97 syncer::ModelSafeRoutingInfo routing_info; |
96 std::vector<scoped_refptr<syncer::ModelSafeWorker> > workers; | 98 std::vector<scoped_refptr<syncer::ModelSafeWorker> > workers; |
97 registrar_->GetModelSafeRoutingInfo(&routing_info); | 99 registrar_->GetModelSafeRoutingInfo(&routing_info); |
98 registrar_->GetWorkers(&workers); | 100 registrar_->GetWorkers(&workers); |
(...skipping 20 matching lines...) Expand all Loading... |
119 std::map<syncer::ModelType, int64_t> invalidation_versions; | 121 std::map<syncer::ModelType, int64_t> invalidation_versions; |
120 sync_prefs_->GetInvalidationVersions(&invalidation_versions); | 122 sync_prefs_->GetInvalidationVersions(&invalidation_versions); |
121 | 123 |
122 scoped_ptr<DoInitializeOptions> init_opts(new DoInitializeOptions( | 124 scoped_ptr<DoInitializeOptions> init_opts(new DoInitializeOptions( |
123 registrar_->sync_thread()->message_loop(), registrar_.get(), routing_info, | 125 registrar_->sync_thread()->message_loop(), registrar_.get(), routing_info, |
124 workers, sync_client_->GetExtensionsActivity(), event_handler, | 126 workers, sync_client_->GetExtensionsActivity(), event_handler, |
125 sync_service_url, sync_user_agent, | 127 sync_service_url, sync_user_agent, |
126 http_post_provider_factory_getter.Run( | 128 http_post_provider_factory_getter.Run( |
127 core_->GetRequestContextCancelationSignal()), | 129 core_->GetRequestContextCancelationSignal()), |
128 credentials, invalidator_ ? invalidator_->GetInvalidatorClientId() : "", | 130 credentials, invalidator_ ? invalidator_->GetInvalidatorClientId() : "", |
129 sync_manager_factory.Pass(), delete_sync_data_folder, | 131 std::move(sync_manager_factory), delete_sync_data_folder, |
130 sync_prefs_->GetEncryptionBootstrapToken(), | 132 sync_prefs_->GetEncryptionBootstrapToken(), |
131 sync_prefs_->GetKeystoreEncryptionBootstrapToken(), | 133 sync_prefs_->GetKeystoreEncryptionBootstrapToken(), |
132 scoped_ptr<InternalComponentsFactory>( | 134 scoped_ptr<InternalComponentsFactory>( |
133 new syncer::InternalComponentsFactoryImpl(factory_switches)) | 135 new syncer::InternalComponentsFactoryImpl(factory_switches)), |
134 .Pass(), | |
135 unrecoverable_error_handler, report_unrecoverable_error_function, | 136 unrecoverable_error_handler, report_unrecoverable_error_function, |
136 saved_nigori_state.Pass(), clear_data_option, invalidation_versions)); | 137 std::move(saved_nigori_state), clear_data_option, invalidation_versions)); |
137 InitCore(init_opts.Pass()); | 138 InitCore(std::move(init_opts)); |
138 } | 139 } |
139 | 140 |
140 void SyncBackendHostImpl::TriggerRefresh(const syncer::ModelTypeSet& types) { | 141 void SyncBackendHostImpl::TriggerRefresh(const syncer::ModelTypeSet& types) { |
141 DCHECK(ui_thread_->BelongsToCurrentThread()); | 142 DCHECK(ui_thread_->BelongsToCurrentThread()); |
142 registrar_->sync_thread()->task_runner()->PostTask( | 143 registrar_->sync_thread()->task_runner()->PostTask( |
143 FROM_HERE, | 144 FROM_HERE, |
144 base::Bind(&SyncBackendHostCore::DoRefreshTypes, core_.get(), types)); | 145 base::Bind(&SyncBackendHostCore::DoRefreshTypes, core_.get(), types)); |
145 } | 146 } |
146 | 147 |
147 void SyncBackendHostImpl::UpdateCredentials( | 148 void SyncBackendHostImpl::UpdateCredentials( |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 registrar_->ActivateDataType(type, group, change_processor, GetUserShare()); | 432 registrar_->ActivateDataType(type, group, change_processor, GetUserShare()); |
432 } | 433 } |
433 | 434 |
434 void SyncBackendHostImpl::DeactivateDirectoryDataType(syncer::ModelType type) { | 435 void SyncBackendHostImpl::DeactivateDirectoryDataType(syncer::ModelType type) { |
435 registrar_->DeactivateDataType(type); | 436 registrar_->DeactivateDataType(type); |
436 } | 437 } |
437 | 438 |
438 void SyncBackendHostImpl::ActivateNonBlockingDataType( | 439 void SyncBackendHostImpl::ActivateNonBlockingDataType( |
439 syncer::ModelType type, | 440 syncer::ModelType type, |
440 scoped_ptr<syncer_v2::ActivationContext> activation_context) { | 441 scoped_ptr<syncer_v2::ActivationContext> activation_context) { |
441 sync_context_proxy_->ConnectTypeToSync(type, activation_context.Pass()); | 442 sync_context_proxy_->ConnectTypeToSync(type, std::move(activation_context)); |
442 } | 443 } |
443 | 444 |
444 void SyncBackendHostImpl::DeactivateNonBlockingDataType( | 445 void SyncBackendHostImpl::DeactivateNonBlockingDataType( |
445 syncer::ModelType type) { | 446 syncer::ModelType type) { |
446 sync_context_proxy_->Disconnect(type); | 447 sync_context_proxy_->Disconnect(type); |
447 } | 448 } |
448 | 449 |
449 syncer::UserShare* SyncBackendHostImpl::GetUserShare() const { | 450 syncer::UserShare* SyncBackendHostImpl::GetUserShare() const { |
450 return core_->sync_manager()->GetUserShare(); | 451 return core_->sync_manager()->GetUserShare(); |
451 } | 452 } |
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
856 const syncer::SyncManager::ClearServerDataCallback& frontend_callback) { | 857 const syncer::SyncManager::ClearServerDataCallback& frontend_callback) { |
857 DCHECK(ui_thread_->BelongsToCurrentThread()); | 858 DCHECK(ui_thread_->BelongsToCurrentThread()); |
858 frontend_callback.Run(); | 859 frontend_callback.Run(); |
859 } | 860 } |
860 | 861 |
861 } // namespace browser_sync | 862 } // namespace browser_sync |
862 | 863 |
863 #undef SDVLOG | 864 #undef SDVLOG |
864 | 865 |
865 #undef SLOG | 866 #undef SLOG |
OLD | NEW |