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 <cstddef> | 5 #include <cstddef> |
6 #include <cstdio> | 6 #include <cstdio> |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/at_exit.h" | 9 #include "base/at_exit.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 LoggingChangeDelegate change_delegate; | 423 LoggingChangeDelegate change_delegate; |
424 const char kRestoredKeyForBootstrapping[] = ""; | 424 const char kRestoredKeyForBootstrapping[] = ""; |
425 const char kRestoredKeystoreKeyForBootstrapping[] = ""; | 425 const char kRestoredKeystoreKeyForBootstrapping[] = ""; |
426 NullEncryptor null_encryptor; | 426 NullEncryptor null_encryptor; |
427 InternalComponentsFactoryImpl::Switches factory_switches = { | 427 InternalComponentsFactoryImpl::Switches factory_switches = { |
428 InternalComponentsFactory::ENCRYPTION_KEYSTORE, | 428 InternalComponentsFactory::ENCRYPTION_KEYSTORE, |
429 InternalComponentsFactory::BACKOFF_NORMAL | 429 InternalComponentsFactory::BACKOFF_NORMAL |
430 }; | 430 }; |
431 CancelationSignal scm_cancelation_signal; | 431 CancelationSignal scm_cancelation_signal; |
432 | 432 |
433 sync_manager->Init(database_dir.path(), | 433 SyncManager::InitArgs args; |
434 WeakHandle<JsEventHandler>(js_event_handler.AsWeakPtr()), | 434 args.database_location = database_dir.path(); |
435 GURL(kSyncServiceURL), | 435 args.event_handler = WeakHandle<JsEventHandler>(js_event_handler.AsWeakPtr()); |
436 post_factory.Pass(), | 436 args.service_url = GURL(kSyncServiceURL); |
437 workers, | 437 args.post_factory = post_factory.Pass(); |
438 extensions_activity, | 438 args.workers = workers; |
439 &change_delegate, | 439 args.extensions_activity = extensions_activity; |
440 credentials, | 440 args.change_delegate = &change_delegate; |
441 invalidator_id, | 441 args.credentials = credentials; |
442 kRestoredKeyForBootstrapping, | 442 args.invalidator_client_id = invalidator_id; |
443 kRestoredKeystoreKeyForBootstrapping, | 443 args.restored_key_for_bootstrapping = kRestoredKeyForBootstrapping; |
444 new InternalComponentsFactoryImpl(factory_switches), | 444 args.restored_keystore_key_for_bootstrapping = |
445 &null_encryptor, | 445 kRestoredKeystoreKeyForBootstrapping; |
446 scoped_ptr<UnrecoverableErrorHandler>( | 446 args.internal_components_factory.reset( |
447 new LoggingUnrecoverableErrorHandler).Pass(), | 447 new InternalComponentsFactoryImpl(factory_switches)); |
448 &LogUnrecoverableErrorContext, | 448 args.encryptor = &null_encryptor; |
449 &scm_cancelation_signal); | 449 args.unrecoverable_error_handler.reset(new LoggingUnrecoverableErrorHandler); |
| 450 args.report_unrecoverable_error_function = &LogUnrecoverableErrorContext; |
| 451 args.cancelation_signal = &scm_cancelation_signal; |
| 452 sync_manager->Init(&args); |
450 // TODO(akalin): Avoid passing in model parameters multiple times by | 453 // TODO(akalin): Avoid passing in model parameters multiple times by |
451 // organizing handling of model types. | 454 // organizing handling of model types. |
452 invalidator->UpdateCredentials(credentials.email, credentials.sync_token); | 455 invalidator->UpdateCredentials(credentials.email, credentials.sync_token); |
453 scoped_ptr<InvalidatorShim> shim(new InvalidatorShim(sync_manager.get())); | 456 scoped_ptr<InvalidatorShim> shim(new InvalidatorShim(sync_manager.get())); |
454 invalidator->RegisterHandler(shim.get()); | 457 invalidator->RegisterHandler(shim.get()); |
455 invalidator->UpdateRegisteredIds( | 458 invalidator->UpdateRegisteredIds( |
456 shim.get(), ModelTypeSetToObjectIdSet(model_types)); | 459 shim.get(), ModelTypeSetToObjectIdSet(model_types)); |
457 sync_manager->StartSyncingNormally(routing_info); | 460 sync_manager->StartSyncingNormally(routing_info); |
458 | 461 |
459 sync_loop.Run(); | 462 sync_loop.Run(); |
460 | 463 |
461 io_thread.Stop(); | 464 io_thread.Stop(); |
462 return 0; | 465 return 0; |
463 } | 466 } |
464 | 467 |
465 } // namespace | 468 } // namespace |
466 } // namespace syncer | 469 } // namespace syncer |
467 | 470 |
468 int main(int argc, char* argv[]) { | 471 int main(int argc, char* argv[]) { |
469 return syncer::SyncClientMain(argc, argv); | 472 return syncer::SyncClientMain(argc, argv); |
470 } | 473 } |
OLD | NEW |