| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/engine_impl/sync_manager_impl.h" | 5 #include "components/sync/engine_impl/sync_manager_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 #include "components/sync/syncable/base_node.h" | 40 #include "components/sync/syncable/base_node.h" |
| 41 #include "components/sync/syncable/directory.h" | 41 #include "components/sync/syncable/directory.h" |
| 42 #include "components/sync/syncable/entry.h" | 42 #include "components/sync/syncable/entry.h" |
| 43 #include "components/sync/syncable/in_memory_directory_backing_store.h" | 43 #include "components/sync/syncable/in_memory_directory_backing_store.h" |
| 44 #include "components/sync/syncable/on_disk_directory_backing_store.h" | 44 #include "components/sync/syncable/on_disk_directory_backing_store.h" |
| 45 #include "components/sync/syncable/read_node.h" | 45 #include "components/sync/syncable/read_node.h" |
| 46 #include "components/sync/syncable/read_transaction.h" | 46 #include "components/sync/syncable/read_transaction.h" |
| 47 #include "components/sync/syncable/write_node.h" | 47 #include "components/sync/syncable/write_node.h" |
| 48 #include "components/sync/syncable/write_transaction.h" | 48 #include "components/sync/syncable/write_transaction.h" |
| 49 | 49 |
| 50 #if defined(OS_WIN) | |
| 51 #include "components/sync/engine_impl/loopback_server/loopback_connection_manage
r.h" | |
| 52 #endif | |
| 53 | |
| 54 using base::TimeDelta; | 50 using base::TimeDelta; |
| 55 using sync_pb::GetUpdatesCallerInfo; | 51 using sync_pb::GetUpdatesCallerInfo; |
| 56 | 52 |
| 57 class GURL; | 53 class GURL; |
| 58 | 54 |
| 59 namespace syncer { | 55 namespace syncer { |
| 60 | 56 |
| 61 using syncable::ImmutableWriteTransactionInfo; | 57 using syncable::ImmutableWriteTransactionInfo; |
| 62 using syncable::SPECIFICS; | 58 using syncable::SPECIFICS; |
| 63 using syncable::UNIQUE_POSITION; | 59 using syncable::UNIQUE_POSITION; |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 return; | 275 return; |
| 280 } | 276 } |
| 281 | 277 |
| 282 // Now that we have opened the Directory we can restore any previously saved | 278 // Now that we have opened the Directory we can restore any previously saved |
| 283 // nigori specifics. | 279 // nigori specifics. |
| 284 if (args->saved_nigori_state) { | 280 if (args->saved_nigori_state) { |
| 285 sync_encryption_handler_->RestoreNigori(*args->saved_nigori_state); | 281 sync_encryption_handler_->RestoreNigori(*args->saved_nigori_state); |
| 286 args->saved_nigori_state.reset(); | 282 args->saved_nigori_state.reset(); |
| 287 } | 283 } |
| 288 | 284 |
| 289 if (args->enable_local_sync_backend) { | 285 connection_manager_ = base::MakeUnique<SyncServerConnectionManager>( |
| 290 #if defined(OS_WIN) | 286 args->service_url.host() + args->service_url.path(), |
| 291 VLOG(1) << "Running against local sync backend."; | 287 args->service_url.EffectiveIntPort(), |
| 292 connection_manager_ = base::MakeUnique<LoopbackConnectionManager>( | 288 args->service_url.SchemeIsCryptographic(), args->post_factory.release(), |
| 293 args->cancelation_signal, args->local_sync_backend_folder); | 289 args->cancelation_signal); |
| 294 #else | |
| 295 NOTREACHED(); | |
| 296 #endif // defined(OS_WIN) | |
| 297 } else { | |
| 298 connection_manager_ = base::MakeUnique<SyncServerConnectionManager>( | |
| 299 args->service_url.host() + args->service_url.path(), | |
| 300 args->service_url.EffectiveIntPort(), | |
| 301 args->service_url.SchemeIsCryptographic(), args->post_factory.release(), | |
| 302 args->cancelation_signal); | |
| 303 } | |
| 304 connection_manager_->set_client_id(directory()->cache_guid()); | 290 connection_manager_->set_client_id(directory()->cache_guid()); |
| 305 connection_manager_->AddListener(this); | 291 connection_manager_->AddListener(this); |
| 306 | 292 |
| 307 std::string sync_id = directory()->cache_guid(); | 293 std::string sync_id = directory()->cache_guid(); |
| 308 | 294 |
| 309 DVLOG(1) << "Setting sync client ID: " << sync_id; | 295 DVLOG(1) << "Setting sync client ID: " << sync_id; |
| 310 allstatus_.SetSyncId(sync_id); | 296 allstatus_.SetSyncId(sync_id); |
| 311 DVLOG(1) << "Setting invalidator client ID: " << args->invalidator_client_id; | 297 DVLOG(1) << "Setting invalidator client ID: " << args->invalidator_client_id; |
| 312 allstatus_.SetInvalidatorClientId(args->invalidator_client_id); | 298 allstatus_.SetInvalidatorClientId(args->invalidator_client_id); |
| 313 | 299 |
| (...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1012 } | 998 } |
| 1013 | 999 |
| 1014 void SyncManagerImpl::OnCookieJarChanged(bool account_mismatch, | 1000 void SyncManagerImpl::OnCookieJarChanged(bool account_mismatch, |
| 1015 bool empty_jar) { | 1001 bool empty_jar) { |
| 1016 DCHECK(thread_checker_.CalledOnValidThread()); | 1002 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1017 cycle_context_->set_cookie_jar_mismatch(account_mismatch); | 1003 cycle_context_->set_cookie_jar_mismatch(account_mismatch); |
| 1018 cycle_context_->set_cookie_jar_empty(empty_jar); | 1004 cycle_context_->set_cookie_jar_empty(empty_jar); |
| 1019 } | 1005 } |
| 1020 | 1006 |
| 1021 } // namespace syncer | 1007 } // namespace syncer |
| OLD | NEW |