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 <stdint.h> | 5 #include <stdint.h> |
6 | 6 |
7 #include <cstddef> | 7 #include <cstddef> |
8 #include <cstdio> | 8 #include <cstdio> |
9 #include <memory> | 9 #include <memory> |
10 #include <string> | 10 #include <string> |
(...skipping 16 matching lines...) Expand all Loading... |
27 #include "base/threading/thread.h" | 27 #include "base/threading/thread.h" |
28 #include "build/build_config.h" | 28 #include "build/build_config.h" |
29 #include "components/invalidation/impl/non_blocking_invalidator.h" | 29 #include "components/invalidation/impl/non_blocking_invalidator.h" |
30 #include "components/invalidation/public/object_id_invalidation_map.h" | 30 #include "components/invalidation/public/object_id_invalidation_map.h" |
31 #include "components/sync/base/cancelation_signal.h" | 31 #include "components/sync/base/cancelation_signal.h" |
32 #include "components/sync/base/fake_encryptor.h" | 32 #include "components/sync/base/fake_encryptor.h" |
33 #include "components/sync/base/invalidation_helper.h" | 33 #include "components/sync/base/invalidation_helper.h" |
34 #include "components/sync/base/model_type.h" | 34 #include "components/sync/base/model_type.h" |
35 #include "components/sync/base/unrecoverable_error_handler.h" | 35 #include "components/sync/base/unrecoverable_error_handler.h" |
36 #include "components/sync/base/weak_handle.h" | 36 #include "components/sync/base/weak_handle.h" |
37 #include "components/sync/core/internal_components_factory_impl.h" | 37 #include "components/sync/engine/engine_components_factory_impl.h" |
38 #include "components/sync/core/sync_manager.h" | |
39 #include "components/sync/core/sync_manager_factory.h" | |
40 #include "components/sync/engine/net/http_bridge.h" | 38 #include "components/sync/engine/net/http_bridge.h" |
41 #include "components/sync/engine/net/http_post_provider_factory.h" | 39 #include "components/sync/engine/net/http_post_provider_factory.h" |
42 #include "components/sync/engine/passive_model_worker.h" | 40 #include "components/sync/engine/passive_model_worker.h" |
| 41 #include "components/sync/engine/sync_manager.h" |
| 42 #include "components/sync/engine/sync_manager_factory.h" |
43 #include "components/sync/js/js_event_details.h" | 43 #include "components/sync/js/js_event_details.h" |
44 #include "components/sync/js/js_event_handler.h" | 44 #include "components/sync/js/js_event_handler.h" |
45 #include "components/sync/syncable/base_node.h" | 45 #include "components/sync/syncable/base_node.h" |
46 #include "components/sync/syncable/read_node.h" | 46 #include "components/sync/syncable/read_node.h" |
47 #include "components/sync/tools/null_invalidation_state_tracker.h" | 47 #include "components/sync/tools/null_invalidation_state_tracker.h" |
48 #include "jingle/notifier/base/notification_method.h" | 48 #include "jingle/notifier/base/notification_method.h" |
49 #include "jingle/notifier/base/notifier_options.h" | 49 #include "jingle/notifier/base/notifier_options.h" |
50 #include "net/base/host_port_pair.h" | 50 #include "net/base/host_port_pair.h" |
51 #include "net/base/network_change_notifier.h" | 51 #include "net/base/network_change_notifier.h" |
52 #include "net/dns/host_resolver.h" | 52 #include "net/dns/host_resolver.h" |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 context_getter.get(), base::Bind(&StubNetworkTimeUpdateCallback), | 402 context_getter.get(), base::Bind(&StubNetworkTimeUpdateCallback), |
403 &factory_cancelation_signal)); | 403 &factory_cancelation_signal)); |
404 post_factory->Init(kUserAgent, BindToTrackerCallback()); | 404 post_factory->Init(kUserAgent, BindToTrackerCallback()); |
405 // Used only when committing bookmarks, so it's okay to leave this | 405 // Used only when committing bookmarks, so it's okay to leave this |
406 // as NULL. | 406 // as NULL. |
407 ExtensionsActivity* extensions_activity = NULL; | 407 ExtensionsActivity* extensions_activity = NULL; |
408 LoggingChangeDelegate change_delegate; | 408 LoggingChangeDelegate change_delegate; |
409 const char kRestoredKeyForBootstrapping[] = ""; | 409 const char kRestoredKeyForBootstrapping[] = ""; |
410 const char kRestoredKeystoreKeyForBootstrapping[] = ""; | 410 const char kRestoredKeystoreKeyForBootstrapping[] = ""; |
411 NullEncryptor null_encryptor; | 411 NullEncryptor null_encryptor; |
412 InternalComponentsFactoryImpl::Switches factory_switches = { | 412 EngineComponentsFactoryImpl::Switches factory_switches = { |
413 InternalComponentsFactory::ENCRYPTION_KEYSTORE, | 413 EngineComponentsFactory::ENCRYPTION_KEYSTORE, |
414 InternalComponentsFactory::BACKOFF_NORMAL}; | 414 EngineComponentsFactory::BACKOFF_NORMAL}; |
415 CancelationSignal scm_cancelation_signal; | 415 CancelationSignal scm_cancelation_signal; |
416 | 416 |
417 SyncManager::InitArgs args; | 417 SyncManager::InitArgs args; |
418 args.database_location = database_dir.GetPath(); | 418 args.database_location = database_dir.GetPath(); |
419 args.event_handler = WeakHandle<JsEventHandler>(js_event_handler.AsWeakPtr()); | 419 args.event_handler = WeakHandle<JsEventHandler>(js_event_handler.AsWeakPtr()); |
420 args.service_url = GURL(kSyncServiceURL); | 420 args.service_url = GURL(kSyncServiceURL); |
421 args.post_factory = std::move(post_factory); | 421 args.post_factory = std::move(post_factory); |
422 args.workers = workers; | 422 args.workers = workers; |
423 args.extensions_activity = extensions_activity; | 423 args.extensions_activity = extensions_activity; |
424 args.change_delegate = &change_delegate; | 424 args.change_delegate = &change_delegate; |
425 args.credentials = credentials; | 425 args.credentials = credentials; |
426 args.invalidator_client_id = invalidator_id; | 426 args.invalidator_client_id = invalidator_id; |
427 args.restored_key_for_bootstrapping = kRestoredKeyForBootstrapping; | 427 args.restored_key_for_bootstrapping = kRestoredKeyForBootstrapping; |
428 args.restored_keystore_key_for_bootstrapping = | 428 args.restored_keystore_key_for_bootstrapping = |
429 kRestoredKeystoreKeyForBootstrapping; | 429 kRestoredKeystoreKeyForBootstrapping; |
430 args.internal_components_factory.reset( | 430 args.engine_components_factory.reset( |
431 new InternalComponentsFactoryImpl(factory_switches)); | 431 new EngineComponentsFactoryImpl(factory_switches)); |
432 args.encryptor = &null_encryptor; | 432 args.encryptor = &null_encryptor; |
433 args.unrecoverable_error_handler = WeakHandle<UnrecoverableErrorHandler>(); | 433 args.unrecoverable_error_handler = WeakHandle<UnrecoverableErrorHandler>(); |
434 args.report_unrecoverable_error_function = | 434 args.report_unrecoverable_error_function = |
435 base::Bind(LogUnrecoverableErrorContext); | 435 base::Bind(LogUnrecoverableErrorContext); |
436 args.cancelation_signal = &scm_cancelation_signal; | 436 args.cancelation_signal = &scm_cancelation_signal; |
437 sync_manager->Init(&args); | 437 sync_manager->Init(&args); |
438 // TODO(akalin): Avoid passing in model parameters multiple times by | 438 // TODO(akalin): Avoid passing in model parameters multiple times by |
439 // organizing handling of model types. | 439 // organizing handling of model types. |
440 invalidator->UpdateCredentials(credentials.email, credentials.sync_token); | 440 invalidator->UpdateCredentials(credentials.email, credentials.sync_token); |
441 std::unique_ptr<InvalidatorShim> shim( | 441 std::unique_ptr<InvalidatorShim> shim( |
442 new InvalidatorShim(sync_manager.get())); | 442 new InvalidatorShim(sync_manager.get())); |
443 invalidator->RegisterHandler(shim.get()); | 443 invalidator->RegisterHandler(shim.get()); |
444 CHECK(invalidator->UpdateRegisteredIds( | 444 CHECK(invalidator->UpdateRegisteredIds( |
445 shim.get(), ModelTypeSetToObjectIdSet(model_types))); | 445 shim.get(), ModelTypeSetToObjectIdSet(model_types))); |
446 sync_manager->StartSyncingNormally(routing_info, base::Time()); | 446 sync_manager->StartSyncingNormally(routing_info, base::Time()); |
447 | 447 |
448 base::RunLoop().Run(); | 448 base::RunLoop().Run(); |
449 | 449 |
450 io_thread.Stop(); | 450 io_thread.Stop(); |
451 return 0; | 451 return 0; |
452 } | 452 } |
453 | 453 |
454 } // namespace | 454 } // namespace |
455 } // namespace syncer | 455 } // namespace syncer |
456 | 456 |
457 int main(int argc, char* argv[]) { | 457 int main(int argc, char* argv[]) { |
458 return syncer::SyncClientMain(argc, argv); | 458 return syncer::SyncClientMain(argc, argv); |
459 } | 459 } |
OLD | NEW |