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 "chrome/browser/chrome_notification_types.h" | 8 #include "chrome/browser/chrome_notification_types.h" |
9 #include "chrome/browser/invalidation/invalidation_service.h" | 9 #include "chrome/browser/invalidation/invalidation_service.h" |
10 #include "chrome/browser/invalidation/invalidation_service_factory.h" | 10 #include "chrome/browser/invalidation/invalidation_service_factory.h" |
11 #include "chrome/browser/network_time/network_time_tracker.h" | 11 #include "chrome/browser/network_time/network_time_tracker.h" |
12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
13 #include "chrome/browser/sync/glue/sync_backend_host_core.h" | 13 #include "chrome/browser/sync/glue/sync_backend_host_core.h" |
14 #include "chrome/browser/sync/glue/sync_backend_registrar.h" | 14 #include "chrome/browser/sync/glue/sync_backend_registrar.h" |
15 #include "chrome/browser/sync/glue/sync_frontend.h" | 15 #include "chrome/browser/sync/glue/sync_frontend.h" |
16 #include "chrome/browser/sync/sync_prefs.h" | 16 #include "chrome/browser/sync/sync_prefs.h" |
17 #include "chrome/common/chrome_switches.h" | 17 #include "chrome/common/chrome_switches.h" |
18 #include "content/public/browser/browser_thread.h" | 18 #include "content/public/browser/browser_thread.h" |
19 #include "content/public/browser/notification_details.h" | 19 #include "content/public/browser/notification_details.h" |
20 #include "content/public/browser/notification_source.h" | 20 #include "content/public/browser/notification_source.h" |
21 #include "sync/internal_api/public/base_transaction.h" | 21 #include "sync/internal_api/public/base_transaction.h" |
22 #include "sync/internal_api/public/http_bridge.h" | 22 #include "sync/internal_api/public/http_bridge.h" |
| 23 #include "sync/internal_api/public/http_post_provider_factory_factory.h" |
23 #include "sync/internal_api/public/internal_components_factory.h" | 24 #include "sync/internal_api/public/internal_components_factory.h" |
24 #include "sync/internal_api/public/internal_components_factory_impl.h" | 25 #include "sync/internal_api/public/internal_components_factory_impl.h" |
25 #include "sync/internal_api/public/sync_manager.h" | 26 #include "sync/internal_api/public/sync_manager.h" |
26 #include "sync/internal_api/public/sync_manager_factory.h" | 27 #include "sync/internal_api/public/sync_manager_factory.h" |
27 #include "sync/internal_api/public/util/experiments.h" | 28 #include "sync/internal_api/public/util/experiments.h" |
28 #include "sync/internal_api/public/util/sync_string_conversions.h" | 29 #include "sync/internal_api/public/util/sync_string_conversions.h" |
29 | 30 |
30 // Helper macros to log with the syncer thread name; useful when there | 31 // Helper macros to log with the syncer thread name; useful when there |
31 // are multiple syncers involved. | 32 // are multiple syncers involved. |
32 | 33 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 void SyncBackendHostImpl::Initialize( | 72 void SyncBackendHostImpl::Initialize( |
72 SyncFrontend* frontend, | 73 SyncFrontend* frontend, |
73 scoped_ptr<base::Thread> sync_thread, | 74 scoped_ptr<base::Thread> sync_thread, |
74 const syncer::WeakHandle<syncer::JsEventHandler>& event_handler, | 75 const syncer::WeakHandle<syncer::JsEventHandler>& event_handler, |
75 const GURL& sync_service_url, | 76 const GURL& sync_service_url, |
76 const syncer::SyncCredentials& credentials, | 77 const syncer::SyncCredentials& credentials, |
77 bool delete_sync_data_folder, | 78 bool delete_sync_data_folder, |
78 scoped_ptr<syncer::SyncManagerFactory> sync_manager_factory, | 79 scoped_ptr<syncer::SyncManagerFactory> sync_manager_factory, |
79 scoped_ptr<syncer::UnrecoverableErrorHandler> unrecoverable_error_handler, | 80 scoped_ptr<syncer::UnrecoverableErrorHandler> unrecoverable_error_handler, |
80 syncer::ReportUnrecoverableErrorFunction | 81 syncer::ReportUnrecoverableErrorFunction |
81 report_unrecoverable_error_function) { | 82 report_unrecoverable_error_function, |
| 83 syncer::HttpPostProviderFactoryFactory* |
| 84 http_post_provider_factory_factory) { |
82 registrar_.reset(new browser_sync::SyncBackendRegistrar(name_, | 85 registrar_.reset(new browser_sync::SyncBackendRegistrar(name_, |
83 profile_, | 86 profile_, |
84 sync_thread.Pass())); | 87 sync_thread.Pass())); |
85 CHECK(registrar_->sync_thread()); | 88 CHECK(registrar_->sync_thread()); |
86 | 89 |
87 frontend_ = frontend; | 90 frontend_ = frontend; |
88 DCHECK(frontend); | 91 DCHECK(frontend); |
89 | 92 |
90 syncer::ModelSafeRoutingInfo routing_info; | 93 syncer::ModelSafeRoutingInfo routing_info; |
91 std::vector<syncer::ModelSafeWorker*> workers; | 94 std::vector<syncer::ModelSafeWorker*> workers; |
(...skipping 16 matching lines...) Expand all Loading... |
108 } | 111 } |
109 | 112 |
110 scoped_ptr<DoInitializeOptions> init_opts(new DoInitializeOptions( | 113 scoped_ptr<DoInitializeOptions> init_opts(new DoInitializeOptions( |
111 registrar_->sync_thread()->message_loop(), | 114 registrar_->sync_thread()->message_loop(), |
112 registrar_.get(), | 115 registrar_.get(), |
113 routing_info, | 116 routing_info, |
114 workers, | 117 workers, |
115 extensions_activity_monitor_.GetExtensionsActivity(), | 118 extensions_activity_monitor_.GetExtensionsActivity(), |
116 event_handler, | 119 event_handler, |
117 sync_service_url, | 120 sync_service_url, |
118 scoped_ptr<syncer::HttpPostProviderFactory>( | 121 http_post_provider_factory_factory->Create( |
119 new syncer::HttpBridgeFactory( | 122 make_scoped_refptr(profile_->GetRequestContext()), |
120 make_scoped_refptr(profile_->GetRequestContext()), | 123 NetworkTimeTracker::BuildNotifierUpdateCallback(), |
121 NetworkTimeTracker::BuildNotifierUpdateCallback(), | 124 core_->GetRequestContextCancelationSignal()), |
122 core_->GetRequestContextCancelationSignal())), | |
123 credentials, | 125 credentials, |
124 invalidator_->GetInvalidatorClientId(), | 126 invalidator_->GetInvalidatorClientId(), |
125 sync_manager_factory.Pass(), | 127 sync_manager_factory.Pass(), |
126 delete_sync_data_folder, | 128 delete_sync_data_folder, |
127 sync_prefs_->GetEncryptionBootstrapToken(), | 129 sync_prefs_->GetEncryptionBootstrapToken(), |
128 sync_prefs_->GetKeystoreEncryptionBootstrapToken(), | 130 sync_prefs_->GetKeystoreEncryptionBootstrapToken(), |
129 scoped_ptr<InternalComponentsFactory>( | 131 scoped_ptr<InternalComponentsFactory>( |
130 new syncer::InternalComponentsFactoryImpl(factory_switches)).Pass(), | 132 new syncer::InternalComponentsFactoryImpl(factory_switches)).Pass(), |
131 unrecoverable_error_handler.Pass(), | 133 unrecoverable_error_handler.Pass(), |
132 report_unrecoverable_error_function)); | 134 report_unrecoverable_error_function)); |
(...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
754 base::MessageLoop* SyncBackendHostImpl::GetSyncLoopForTesting() { | 756 base::MessageLoop* SyncBackendHostImpl::GetSyncLoopForTesting() { |
755 return registrar_->sync_thread()->message_loop(); | 757 return registrar_->sync_thread()->message_loop(); |
756 } | 758 } |
757 | 759 |
758 } // namespace browser_sync | 760 } // namespace browser_sync |
759 | 761 |
760 #undef SDVLOG | 762 #undef SDVLOG |
761 | 763 |
762 #undef SLOG | 764 #undef SLOG |
763 | 765 |
OLD | NEW |