| 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/base64.h" | 10 #include "base/base64.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #include "jingle/notifier/base/notification_method.h" | 23 #include "jingle/notifier/base/notification_method.h" |
| 24 #include "jingle/notifier/base/notifier_options.h" | 24 #include "jingle/notifier/base/notifier_options.h" |
| 25 #include "net/base/host_port_pair.h" | 25 #include "net/base/host_port_pair.h" |
| 26 #include "net/base/host_resolver.h" | 26 #include "net/base/host_resolver.h" |
| 27 #include "net/base/network_change_notifier.h" | 27 #include "net/base/network_change_notifier.h" |
| 28 #include "net/url_request/url_request_test_util.h" | 28 #include "net/url_request/url_request_test_util.h" |
| 29 #include "sync/internal_api/public/base/model_type.h" | 29 #include "sync/internal_api/public/base/model_type.h" |
| 30 #include "sync/internal_api/public/base_node.h" | 30 #include "sync/internal_api/public/base_node.h" |
| 31 #include "sync/internal_api/public/engine/passive_model_worker.h" | 31 #include "sync/internal_api/public/engine/passive_model_worker.h" |
| 32 #include "sync/internal_api/public/http_bridge.h" | 32 #include "sync/internal_api/public/http_bridge.h" |
| 33 #include "sync/internal_api/public/internal_components_factory_impl.h" |
| 33 #include "sync/internal_api/public/read_node.h" | 34 #include "sync/internal_api/public/read_node.h" |
| 34 #include "sync/internal_api/public/sync_manager.h" | 35 #include "sync/internal_api/public/sync_manager.h" |
| 35 #include "sync/internal_api/public/sync_manager_factory.h" | 36 #include "sync/internal_api/public/sync_manager_factory.h" |
| 36 #include "sync/internal_api/public/util/report_unrecoverable_error_function.h" | 37 #include "sync/internal_api/public/util/report_unrecoverable_error_function.h" |
| 37 #include "sync/internal_api/public/util/unrecoverable_error_handler.h" | 38 #include "sync/internal_api/public/util/unrecoverable_error_handler.h" |
| 38 #include "sync/internal_api/public/util/weak_handle.h" | 39 #include "sync/internal_api/public/util/weak_handle.h" |
| 39 #include "sync/js/js_event_details.h" | 40 #include "sync/js/js_event_details.h" |
| 40 #include "sync/js/js_event_handler.h" | 41 #include "sync/js/js_event_handler.h" |
| 41 #include "sync/notifier/invalidation_state_tracker.h" | 42 #include "sync/notifier/invalidation_state_tracker.h" |
| 42 #include "sync/notifier/sync_notifier.h" | 43 #include "sync/notifier/sync_notifier.h" |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 const char kUserAgent[] = "sync_client"; | 341 const char kUserAgent[] = "sync_client"; |
| 341 // TODO(akalin): Replace this with just the context getter once | 342 // TODO(akalin): Replace this with just the context getter once |
| 342 // HttpPostProviderFactory is removed. | 343 // HttpPostProviderFactory is removed. |
| 343 scoped_ptr<syncer::HttpPostProviderFactory> post_factory( | 344 scoped_ptr<syncer::HttpPostProviderFactory> post_factory( |
| 344 new syncer::HttpBridgeFactory(context_getter, kUserAgent)); | 345 new syncer::HttpBridgeFactory(context_getter, kUserAgent)); |
| 345 // Used only when committing bookmarks, so it's okay to leave this | 346 // Used only when committing bookmarks, so it's okay to leave this |
| 346 // as NULL. | 347 // as NULL. |
| 347 syncer::ExtensionsActivityMonitor* extensions_activity_monitor = NULL; | 348 syncer::ExtensionsActivityMonitor* extensions_activity_monitor = NULL; |
| 348 LoggingChangeDelegate change_delegate; | 349 LoggingChangeDelegate change_delegate; |
| 349 const char kRestoredKeyForBootstrapping[] = ""; | 350 const char kRestoredKeyForBootstrapping[] = ""; |
| 350 const syncer::SyncManager::TestingMode kTestingMode = | |
| 351 syncer::SyncManager::NON_TEST; | |
| 352 NullEncryptor null_encryptor; | 351 NullEncryptor null_encryptor; |
| 353 LoggingUnrecoverableErrorHandler unrecoverable_error_handler; | 352 LoggingUnrecoverableErrorHandler unrecoverable_error_handler; |
| 354 sync_manager->Init(database_dir.path(), | 353 sync_manager->Init(database_dir.path(), |
| 355 syncer::WeakHandle<syncer::JsEventHandler>( | 354 syncer::WeakHandle<syncer::JsEventHandler>( |
| 356 js_event_handler.AsWeakPtr()), | 355 js_event_handler.AsWeakPtr()), |
| 357 kSyncServerAndPath, | 356 kSyncServerAndPath, |
| 358 kSyncServerPort, | 357 kSyncServerPort, |
| 359 kUseSsl, | 358 kUseSsl, |
| 360 blocking_task_runner, | 359 blocking_task_runner, |
| 361 post_factory.Pass(), | 360 post_factory.Pass(), |
| 362 routing_info, | 361 routing_info, |
| 363 workers, | 362 workers, |
| 364 extensions_activity_monitor, | 363 extensions_activity_monitor, |
| 365 &change_delegate, | 364 &change_delegate, |
| 366 credentials, | 365 credentials, |
| 367 scoped_ptr<syncer::SyncNotifier>( | 366 scoped_ptr<syncer::SyncNotifier>( |
| 368 sync_notifier_factory.CreateSyncNotifier()), | 367 sync_notifier_factory.CreateSyncNotifier()), |
| 369 kRestoredKeyForBootstrapping, | 368 kRestoredKeyForBootstrapping, |
| 370 kTestingMode, | 369 scoped_ptr<syncer::InternalComponentsFactory>( |
| 370 new syncer::InternalComponentsFactoryImpl()), |
| 371 &null_encryptor, | 371 &null_encryptor, |
| 372 &unrecoverable_error_handler, | 372 &unrecoverable_error_handler, |
| 373 &LogUnrecoverableErrorContext); | 373 &LogUnrecoverableErrorContext); |
| 374 // TODO(akalin): We have pass in model parameters multiple times. | 374 // TODO(akalin): We have pass in model parameters multiple times. |
| 375 // Organize handling of model types. | 375 // Organize handling of model types. |
| 376 sync_manager->UpdateEnabledTypes(model_types); | 376 sync_manager->UpdateEnabledTypes(model_types); |
| 377 sync_manager->StartSyncingNormally(routing_info); | 377 sync_manager->StartSyncingNormally(routing_info); |
| 378 | 378 |
| 379 sync_loop.Run(); | 379 sync_loop.Run(); |
| 380 | 380 |
| 381 io_thread.Stop(); | 381 io_thread.Stop(); |
| 382 return 0; | 382 return 0; |
| 383 } | 383 } |
| OLD | NEW |