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" |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 } | 98 } |
99 | 99 |
100 void SyncBackendHostImpl::Initialize( | 100 void SyncBackendHostImpl::Initialize( |
101 sync_driver::SyncFrontend* frontend, | 101 sync_driver::SyncFrontend* frontend, |
102 scoped_ptr<base::Thread> sync_thread, | 102 scoped_ptr<base::Thread> sync_thread, |
103 const syncer::WeakHandle<syncer::JsEventHandler>& event_handler, | 103 const syncer::WeakHandle<syncer::JsEventHandler>& event_handler, |
104 const GURL& sync_service_url, | 104 const GURL& sync_service_url, |
105 const syncer::SyncCredentials& credentials, | 105 const syncer::SyncCredentials& credentials, |
106 bool delete_sync_data_folder, | 106 bool delete_sync_data_folder, |
107 scoped_ptr<syncer::SyncManagerFactory> sync_manager_factory, | 107 scoped_ptr<syncer::SyncManagerFactory> sync_manager_factory, |
108 scoped_ptr<syncer::UnrecoverableErrorHandler> unrecoverable_error_handler, | 108 const syncer::WeakHandle<syncer::UnrecoverableErrorHandler>& |
| 109 unrecoverable_error_handler, |
109 const base::Closure& report_unrecoverable_error_function, | 110 const base::Closure& report_unrecoverable_error_function, |
110 syncer::NetworkResources* network_resources, | 111 syncer::NetworkResources* network_resources, |
111 scoped_ptr<syncer::SyncEncryptionHandler::NigoriState> saved_nigori_state) { | 112 scoped_ptr<syncer::SyncEncryptionHandler::NigoriState> saved_nigori_state) { |
112 registrar_.reset(new browser_sync::SyncBackendRegistrar(name_, | 113 registrar_.reset(new browser_sync::SyncBackendRegistrar(name_, |
113 profile_, | 114 profile_, |
114 sync_thread.Pass())); | 115 sync_thread.Pass())); |
115 CHECK(registrar_->sync_thread()); | 116 CHECK(registrar_->sync_thread()); |
116 | 117 |
117 frontend_ = frontend; | 118 frontend_ = frontend; |
118 DCHECK(frontend); | 119 DCHECK(frontend); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 make_scoped_refptr(profile_->GetRequestContext()), | 153 make_scoped_refptr(profile_->GetRequestContext()), |
153 base::Bind(&UpdateNetworkTime), | 154 base::Bind(&UpdateNetworkTime), |
154 core_->GetRequestContextCancelationSignal()), | 155 core_->GetRequestContextCancelationSignal()), |
155 credentials, invalidator_ ? invalidator_->GetInvalidatorClientId() : "", | 156 credentials, invalidator_ ? invalidator_->GetInvalidatorClientId() : "", |
156 sync_manager_factory.Pass(), delete_sync_data_folder, | 157 sync_manager_factory.Pass(), delete_sync_data_folder, |
157 sync_prefs_->GetEncryptionBootstrapToken(), | 158 sync_prefs_->GetEncryptionBootstrapToken(), |
158 sync_prefs_->GetKeystoreEncryptionBootstrapToken(), | 159 sync_prefs_->GetKeystoreEncryptionBootstrapToken(), |
159 scoped_ptr<InternalComponentsFactory>( | 160 scoped_ptr<InternalComponentsFactory>( |
160 new syncer::InternalComponentsFactoryImpl(factory_switches)) | 161 new syncer::InternalComponentsFactoryImpl(factory_switches)) |
161 .Pass(), | 162 .Pass(), |
162 unrecoverable_error_handler.Pass(), report_unrecoverable_error_function, | 163 unrecoverable_error_handler, report_unrecoverable_error_function, |
163 saved_nigori_state.Pass(), clear_data_option, invalidation_versions)); | 164 saved_nigori_state.Pass(), clear_data_option, invalidation_versions)); |
164 InitCore(init_opts.Pass()); | 165 InitCore(init_opts.Pass()); |
165 } | 166 } |
166 | 167 |
167 void SyncBackendHostImpl::UpdateCredentials( | 168 void SyncBackendHostImpl::UpdateCredentials( |
168 const syncer::SyncCredentials& credentials) { | 169 const syncer::SyncCredentials& credentials) { |
169 DCHECK(registrar_->sync_thread()->IsRunning()); | 170 DCHECK(registrar_->sync_thread()->IsRunning()); |
170 registrar_->sync_thread()->task_runner()->PostTask( | 171 registrar_->sync_thread()->task_runner()->PostTask( |
171 FROM_HERE, base::Bind(&SyncBackendHostCore::DoUpdateCredentials, | 172 FROM_HERE, base::Bind(&SyncBackendHostCore::DoUpdateCredentials, |
172 core_.get(), credentials)); | 173 core_.get(), credentials)); |
(...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
892 const syncer::SyncManager::ClearServerDataCallback& frontend_callback) { | 893 const syncer::SyncManager::ClearServerDataCallback& frontend_callback) { |
893 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 894 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
894 frontend_callback.Run(); | 895 frontend_callback.Run(); |
895 } | 896 } |
896 | 897 |
897 } // namespace browser_sync | 898 } // namespace browser_sync |
898 | 899 |
899 #undef SDVLOG | 900 #undef SDVLOG |
900 | 901 |
901 #undef SLOG | 902 #undef SLOG |
OLD | NEW |