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 10 matching lines...) Expand all Loading... |
21 #include "base/memory/ref_counted.h" | 21 #include "base/memory/ref_counted.h" |
22 #include "base/memory/weak_ptr.h" | 22 #include "base/memory/weak_ptr.h" |
23 #include "base/message_loop/message_loop.h" | 23 #include "base/message_loop/message_loop.h" |
24 #include "base/rand_util.h" | 24 #include "base/rand_util.h" |
25 #include "base/run_loop.h" | 25 #include "base/run_loop.h" |
26 #include "base/task_runner.h" | 26 #include "base/task_runner.h" |
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" |
| 32 #include "components/sync/base/model_type.h" |
| 33 #include "components/sync/base/unrecoverable_error_handler.h" |
| 34 #include "components/sync/base/weak_handle.h" |
| 35 #include "components/sync/core/base_node.h" |
| 36 #include "components/sync/core/http_bridge.h" |
| 37 #include "components/sync/core/http_post_provider_factory.h" |
| 38 #include "components/sync/core/internal_components_factory_impl.h" |
| 39 #include "components/sync/core/read_node.h" |
| 40 #include "components/sync/core/sync_manager.h" |
| 41 #include "components/sync/core/sync_manager_factory.h" |
| 42 #include "components/sync/engine/passive_model_worker.h" |
| 43 #include "components/sync/js/js_event_details.h" |
| 44 #include "components/sync/js/js_event_handler.h" |
| 45 #include "components/sync/test/fake_encryptor.h" |
| 46 #include "components/sync/tools/null_invalidation_state_tracker.h" |
31 #include "components/sync_driver/invalidation_helper.h" | 47 #include "components/sync_driver/invalidation_helper.h" |
32 #include "jingle/notifier/base/notification_method.h" | 48 #include "jingle/notifier/base/notification_method.h" |
33 #include "jingle/notifier/base/notifier_options.h" | 49 #include "jingle/notifier/base/notifier_options.h" |
34 #include "net/base/host_port_pair.h" | 50 #include "net/base/host_port_pair.h" |
35 #include "net/base/network_change_notifier.h" | 51 #include "net/base/network_change_notifier.h" |
36 #include "net/dns/host_resolver.h" | 52 #include "net/dns/host_resolver.h" |
37 #include "net/http/transport_security_state.h" | 53 #include "net/http/transport_security_state.h" |
38 #include "net/url_request/url_request_test_util.h" | 54 #include "net/url_request/url_request_test_util.h" |
39 #include "sync/internal_api/public/base/cancelation_signal.h" | |
40 #include "sync/internal_api/public/base/model_type.h" | |
41 #include "sync/internal_api/public/base_node.h" | |
42 #include "sync/internal_api/public/engine/passive_model_worker.h" | |
43 #include "sync/internal_api/public/http_bridge.h" | |
44 #include "sync/internal_api/public/http_post_provider_factory.h" | |
45 #include "sync/internal_api/public/internal_components_factory_impl.h" | |
46 #include "sync/internal_api/public/read_node.h" | |
47 #include "sync/internal_api/public/sync_manager.h" | |
48 #include "sync/internal_api/public/sync_manager_factory.h" | |
49 #include "sync/internal_api/public/util/unrecoverable_error_handler.h" | |
50 #include "sync/internal_api/public/util/weak_handle.h" | |
51 #include "sync/js/js_event_details.h" | |
52 #include "sync/js/js_event_handler.h" | |
53 #include "sync/test/fake_encryptor.h" | |
54 #include "sync/tools/null_invalidation_state_tracker.h" | |
55 #include "url/gurl.h" | 55 #include "url/gurl.h" |
56 | 56 |
57 #if defined(OS_MACOSX) | 57 #if defined(OS_MACOSX) |
58 #include "base/mac/scoped_nsautorelease_pool.h" | 58 #include "base/mac/scoped_nsautorelease_pool.h" |
59 #endif | 59 #endif |
60 | 60 |
61 // This is a simple utility that initializes a sync client and | 61 // This is a simple utility that initializes a sync client and |
62 // prints out any events. | 62 // prints out any events. |
63 | 63 |
64 // TODO(akalin): Refactor to combine shared code with | 64 // TODO(akalin): Refactor to combine shared code with |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 } | 133 } |
134 | 134 |
135 class LoggingChangeDelegate : public SyncManager::ChangeDelegate { | 135 class LoggingChangeDelegate : public SyncManager::ChangeDelegate { |
136 public: | 136 public: |
137 ~LoggingChangeDelegate() override {} | 137 ~LoggingChangeDelegate() override {} |
138 | 138 |
139 void OnChangesApplied(ModelType model_type, | 139 void OnChangesApplied(ModelType model_type, |
140 int64_t model_version, | 140 int64_t model_version, |
141 const BaseTransaction* trans, | 141 const BaseTransaction* trans, |
142 const ImmutableChangeRecordList& changes) override { | 142 const ImmutableChangeRecordList& changes) override { |
143 LOG(INFO) << "Changes applied for " | 143 LOG(INFO) << "Changes applied for " << ModelTypeToString(model_type); |
144 << ModelTypeToString(model_type); | |
145 size_t i = 1; | 144 size_t i = 1; |
146 size_t change_count = changes.Get().size(); | 145 size_t change_count = changes.Get().size(); |
147 for (ChangeRecordList::const_iterator it = | 146 for (ChangeRecordList::const_iterator it = changes.Get().begin(); |
148 changes.Get().begin(); it != changes.Get().end(); ++it) { | 147 it != changes.Get().end(); ++it) { |
149 std::unique_ptr<base::DictionaryValue> change_value(it->ToValue()); | 148 std::unique_ptr<base::DictionaryValue> change_value(it->ToValue()); |
150 LOG(INFO) << "Change (" << i << "/" << change_count << "): " | 149 LOG(INFO) << "Change (" << i << "/" << change_count |
151 << ValueToString(*change_value); | 150 << "): " << ValueToString(*change_value); |
152 if (it->action != ChangeRecord::ACTION_DELETE) { | 151 if (it->action != ChangeRecord::ACTION_DELETE) { |
153 ReadNode node(trans); | 152 ReadNode node(trans); |
154 CHECK_EQ(node.InitByIdLookup(it->id), BaseNode::INIT_OK); | 153 CHECK_EQ(node.InitByIdLookup(it->id), BaseNode::INIT_OK); |
155 std::unique_ptr<base::DictionaryValue> details(node.ToValue()); | 154 std::unique_ptr<base::DictionaryValue> details(node.ToValue()); |
156 VLOG(1) << "Details: " << ValueToString(*details); | 155 VLOG(1) << "Details: " << ValueToString(*details); |
157 } | 156 } |
158 ++i; | 157 ++i; |
159 } | 158 } |
160 } | 159 } |
161 | 160 |
162 void OnChangesComplete(ModelType model_type) override { | 161 void OnChangesComplete(ModelType model_type) override { |
163 LOG(INFO) << "Changes complete for " | 162 LOG(INFO) << "Changes complete for " << ModelTypeToString(model_type); |
164 << ModelTypeToString(model_type); | |
165 } | 163 } |
166 }; | 164 }; |
167 | 165 |
168 class LoggingUnrecoverableErrorHandler | 166 class LoggingUnrecoverableErrorHandler : public UnrecoverableErrorHandler { |
169 : public UnrecoverableErrorHandler { | |
170 public: | 167 public: |
171 ~LoggingUnrecoverableErrorHandler() override {} | 168 ~LoggingUnrecoverableErrorHandler() override {} |
172 | 169 |
173 void OnUnrecoverableError(const tracked_objects::Location& from_here, | 170 void OnUnrecoverableError(const tracked_objects::Location& from_here, |
174 const std::string& message) override { | 171 const std::string& message) override { |
175 if (LOG_IS_ON(ERROR)) { | 172 if (LOG_IS_ON(ERROR)) { |
176 logging::LogMessage(from_here.file_name(), from_here.line_number(), | 173 logging::LogMessage(from_here.file_name(), from_here.line_number(), |
177 logging::LOG_ERROR).stream() | 174 logging::LOG_ERROR) |
| 175 .stream() |
178 << message; | 176 << message; |
179 } | 177 } |
180 } | 178 } |
181 }; | 179 }; |
182 | 180 |
183 class LoggingJsEventHandler | 181 class LoggingJsEventHandler |
184 : public JsEventHandler, | 182 : public JsEventHandler, |
185 public base::SupportsWeakPtr<LoggingJsEventHandler> { | 183 public base::SupportsWeakPtr<LoggingJsEventHandler> { |
186 public: | 184 public: |
187 ~LoggingJsEventHandler() override {} | 185 ~LoggingJsEventHandler() override {} |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 : sync_manager_(sync_manager) {} | 220 : sync_manager_(sync_manager) {} |
223 | 221 |
224 void OnInvalidatorStateChange(InvalidatorState state) override { | 222 void OnInvalidatorStateChange(InvalidatorState state) override { |
225 sync_manager_->SetInvalidatorEnabled(state == INVALIDATIONS_ENABLED); | 223 sync_manager_->SetInvalidatorEnabled(state == INVALIDATIONS_ENABLED); |
226 } | 224 } |
227 | 225 |
228 void OnIncomingInvalidation( | 226 void OnIncomingInvalidation( |
229 const ObjectIdInvalidationMap& invalidation_map) override { | 227 const ObjectIdInvalidationMap& invalidation_map) override { |
230 syncer::ObjectIdSet ids = invalidation_map.GetObjectIds(); | 228 syncer::ObjectIdSet ids = invalidation_map.GetObjectIds(); |
231 for (syncer::ObjectIdSet::const_iterator ids_it = ids.begin(); | 229 for (syncer::ObjectIdSet::const_iterator ids_it = ids.begin(); |
232 ids_it != ids.end(); | 230 ids_it != ids.end(); ++ids_it) { |
233 ++ids_it) { | |
234 syncer::ModelType type; | 231 syncer::ModelType type; |
235 if (!NotificationTypeToRealModelType(ids_it->name(), &type)) { | 232 if (!NotificationTypeToRealModelType(ids_it->name(), &type)) { |
236 DLOG(WARNING) << "Notification has invalid id: " | 233 DLOG(WARNING) << "Notification has invalid id: " |
237 << syncer::ObjectIdToString(*ids_it); | 234 << syncer::ObjectIdToString(*ids_it); |
238 } else { | 235 } else { |
239 syncer::SingleObjectInvalidationSet invalidation_set = | 236 syncer::SingleObjectInvalidationSet invalidation_set = |
240 invalidation_map.ForObject(*ids_it); | 237 invalidation_map.ForObject(*ids_it); |
241 for (syncer::SingleObjectInvalidationSet::const_iterator inv_it = | 238 for (syncer::SingleObjectInvalidationSet::const_iterator inv_it = |
242 invalidation_set.begin(); | 239 invalidation_set.begin(); |
243 inv_it != invalidation_set.end(); | 240 inv_it != invalidation_set.end(); ++inv_it) { |
244 ++inv_it) { | |
245 std::unique_ptr<syncer::InvalidationInterface> inv_adapter( | 241 std::unique_ptr<syncer::InvalidationInterface> inv_adapter( |
246 new InvalidationAdapter(*inv_it)); | 242 new InvalidationAdapter(*inv_it)); |
247 sync_manager_->OnIncomingInvalidation(type, std::move(inv_adapter)); | 243 sync_manager_->OnIncomingInvalidation(type, std::move(inv_adapter)); |
248 } | 244 } |
249 } | 245 } |
250 } | 246 } |
251 } | 247 } |
252 | 248 |
253 std::string GetOwnerName() const override { return "InvalidatorShim"; } | 249 std::string GetOwnerName() const override { return "InvalidatorShim"; } |
254 | 250 |
255 private: | 251 private: |
256 SyncManager* sync_manager_; | 252 SyncManager* sync_manager_; |
257 }; | 253 }; |
258 | 254 |
259 void LogUnrecoverableErrorContext() { | 255 void LogUnrecoverableErrorContext() { |
260 base::debug::StackTrace().Print(); | 256 base::debug::StackTrace().Print(); |
261 } | 257 } |
262 | 258 |
263 notifier::NotifierOptions ParseNotifierOptions( | 259 notifier::NotifierOptions ParseNotifierOptions( |
264 const base::CommandLine& command_line, | 260 const base::CommandLine& command_line, |
265 const scoped_refptr<net::URLRequestContextGetter>& request_context_getter) { | 261 const scoped_refptr<net::URLRequestContextGetter>& request_context_getter) { |
266 notifier::NotifierOptions notifier_options; | 262 notifier::NotifierOptions notifier_options; |
267 notifier_options.request_context_getter = request_context_getter; | 263 notifier_options.request_context_getter = request_context_getter; |
268 notifier_options.auth_mechanism = "X-OAUTH2"; | 264 notifier_options.auth_mechanism = "X-OAUTH2"; |
269 | 265 |
270 if (command_line.HasSwitch(kXmppHostPortSwitch)) { | 266 if (command_line.HasSwitch(kXmppHostPortSwitch)) { |
271 notifier_options.xmpp_host_port = | 267 notifier_options.xmpp_host_port = net::HostPortPair::FromString( |
272 net::HostPortPair::FromString( | 268 command_line.GetSwitchValueASCII(kXmppHostPortSwitch)); |
273 command_line.GetSwitchValueASCII(kXmppHostPortSwitch)); | |
274 LOG(INFO) << "Using " << notifier_options.xmpp_host_port.ToString() | 269 LOG(INFO) << "Using " << notifier_options.xmpp_host_port.ToString() |
275 << " for test sync notification server."; | 270 << " for test sync notification server."; |
276 } | 271 } |
277 | 272 |
278 notifier_options.try_ssltcp_first = | 273 notifier_options.try_ssltcp_first = |
279 command_line.HasSwitch(kXmppTrySslTcpFirstSwitch); | 274 command_line.HasSwitch(kXmppTrySslTcpFirstSwitch); |
280 LOG_IF(INFO, notifier_options.try_ssltcp_first) | 275 LOG_IF(INFO, notifier_options.try_ssltcp_first) |
281 << "Trying SSL/TCP port before XMPP port for notifications."; | 276 << "Trying SSL/TCP port before XMPP port for notifications."; |
282 | 277 |
283 notifier_options.allow_insecure_connection = | 278 notifier_options.allow_insecure_connection = |
284 command_line.HasSwitch(kXmppAllowInsecureConnectionSwitch); | 279 command_line.HasSwitch(kXmppAllowInsecureConnectionSwitch); |
285 LOG_IF(INFO, notifier_options.allow_insecure_connection) | 280 LOG_IF(INFO, notifier_options.allow_insecure_connection) |
286 << "Allowing insecure XMPP connections."; | 281 << "Allowing insecure XMPP connections."; |
287 | 282 |
288 return notifier_options; | 283 return notifier_options; |
289 } | 284 } |
290 | 285 |
291 void StubNetworkTimeUpdateCallback(const base::Time&, | 286 void StubNetworkTimeUpdateCallback(const base::Time&, |
292 const base::TimeDelta&, | 287 const base::TimeDelta&, |
293 const base::TimeDelta&) { | 288 const base::TimeDelta&) {} |
294 } | |
295 | 289 |
296 int SyncClientMain(int argc, char* argv[]) { | 290 int SyncClientMain(int argc, char* argv[]) { |
297 #if defined(OS_MACOSX) | 291 #if defined(OS_MACOSX) |
298 base::mac::ScopedNSAutoreleasePool pool; | 292 base::mac::ScopedNSAutoreleasePool pool; |
299 #endif | 293 #endif |
300 base::AtExitManager exit_manager; | 294 base::AtExitManager exit_manager; |
301 base::CommandLine::Init(argc, argv); | 295 base::CommandLine::Init(argc, argv); |
302 logging::LoggingSettings settings; | 296 logging::LoggingSettings settings; |
303 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; | 297 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; |
304 logging::InitLogging(settings); | 298 logging::InitLogging(settings); |
305 | 299 |
306 base::MessageLoop sync_loop; | 300 base::MessageLoop sync_loop; |
307 base::Thread io_thread("IO thread"); | 301 base::Thread io_thread("IO thread"); |
308 base::Thread::Options options; | 302 base::Thread::Options options; |
309 options.message_loop_type = base::MessageLoop::TYPE_IO; | 303 options.message_loop_type = base::MessageLoop::TYPE_IO; |
310 io_thread.StartWithOptions(options); | 304 io_thread.StartWithOptions(options); |
311 | 305 |
312 // Parse command line. | 306 // Parse command line. |
313 const base::CommandLine& command_line = | 307 const base::CommandLine& command_line = |
314 *base::CommandLine::ForCurrentProcess(); | 308 *base::CommandLine::ForCurrentProcess(); |
315 SyncCredentials credentials; | 309 SyncCredentials credentials; |
316 credentials.account_id = command_line.GetSwitchValueASCII(kEmailSwitch); | 310 credentials.account_id = command_line.GetSwitchValueASCII(kEmailSwitch); |
317 credentials.email = command_line.GetSwitchValueASCII(kEmailSwitch); | 311 credentials.email = command_line.GetSwitchValueASCII(kEmailSwitch); |
318 credentials.sync_token = command_line.GetSwitchValueASCII(kTokenSwitch); | 312 credentials.sync_token = command_line.GetSwitchValueASCII(kTokenSwitch); |
319 // TODO(akalin): Write a wrapper script that gets a token for an | 313 // TODO(akalin): Write a wrapper script that gets a token for an |
320 // email and password and passes that in to this utility. | 314 // email and password and passes that in to this utility. |
321 if (credentials.email.empty() || credentials.sync_token.empty()) { | 315 if (credentials.email.empty() || credentials.sync_token.empty()) { |
322 std::printf("Usage: %s --%s=foo@bar.com --%s=token\n" | 316 std::printf( |
323 "[--%s=host:port] [--%s] [--%s]\n" | 317 "Usage: %s --%s=foo@bar.com --%s=token\n" |
324 "Run chrome and set a breakpoint on\n" | 318 "[--%s=host:port] [--%s] [--%s]\n" |
325 "syncer::SyncManagerImpl::UpdateCredentials() " | 319 "Run chrome and set a breakpoint on\n" |
326 "after logging into\n" | 320 "syncer::SyncManagerImpl::UpdateCredentials() " |
327 "sync to get the token to pass into this utility.\n", | 321 "after logging into\n" |
328 argv[0], | 322 "sync to get the token to pass into this utility.\n", |
329 kEmailSwitch, kTokenSwitch, kXmppHostPortSwitch, | 323 argv[0], kEmailSwitch, kTokenSwitch, kXmppHostPortSwitch, |
330 kXmppTrySslTcpFirstSwitch, | 324 kXmppTrySslTcpFirstSwitch, kXmppAllowInsecureConnectionSwitch); |
331 kXmppAllowInsecureConnectionSwitch); | |
332 return -1; | 325 return -1; |
333 } | 326 } |
334 | 327 |
335 // Set up objects that monitor the network. | 328 // Set up objects that monitor the network. |
336 std::unique_ptr<net::NetworkChangeNotifier> network_change_notifier( | 329 std::unique_ptr<net::NetworkChangeNotifier> network_change_notifier( |
337 net::NetworkChangeNotifier::Create()); | 330 net::NetworkChangeNotifier::Create()); |
338 | 331 |
339 // Set up sync notifier factory. | 332 // Set up sync notifier factory. |
340 const scoped_refptr<MyTestURLRequestContextGetter> context_getter = | 333 const scoped_refptr<MyTestURLRequestContextGetter> context_getter = |
341 new MyTestURLRequestContextGetter(io_thread.task_runner()); | 334 new MyTestURLRequestContextGetter(io_thread.task_runner()); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 model_types.Put(SYNCED_NOTIFICATIONS); | 373 model_types.Put(SYNCED_NOTIFICATIONS); |
381 model_types.Put(SYNCED_NOTIFICATION_APP_INFO); | 374 model_types.Put(SYNCED_NOTIFICATION_APP_INFO); |
382 model_types.Put(DEVICE_INFO); | 375 model_types.Put(DEVICE_INFO); |
383 model_types.Put(EXPERIMENTS); | 376 model_types.Put(EXPERIMENTS); |
384 model_types.Put(PRIORITY_PREFERENCES); | 377 model_types.Put(PRIORITY_PREFERENCES); |
385 model_types.Put(DICTIONARY); | 378 model_types.Put(DICTIONARY); |
386 model_types.Put(FAVICON_IMAGES); | 379 model_types.Put(FAVICON_IMAGES); |
387 model_types.Put(FAVICON_TRACKING); | 380 model_types.Put(FAVICON_TRACKING); |
388 | 381 |
389 ModelSafeRoutingInfo routing_info; | 382 ModelSafeRoutingInfo routing_info; |
390 for (ModelTypeSet::Iterator it = model_types.First(); | 383 for (ModelTypeSet::Iterator it = model_types.First(); it.Good(); it.Inc()) { |
391 it.Good(); it.Inc()) { | |
392 routing_info[it.Get()] = GROUP_PASSIVE; | 384 routing_info[it.Get()] = GROUP_PASSIVE; |
393 } | 385 } |
394 scoped_refptr<PassiveModelWorker> passive_model_safe_worker = | 386 scoped_refptr<PassiveModelWorker> passive_model_safe_worker = |
395 new PassiveModelWorker(nullptr); | 387 new PassiveModelWorker(nullptr); |
396 std::vector<scoped_refptr<ModelSafeWorker> > workers; | 388 std::vector<scoped_refptr<ModelSafeWorker>> workers; |
397 workers.push_back(passive_model_safe_worker); | 389 workers.push_back(passive_model_safe_worker); |
398 | 390 |
399 // Set up sync manager. | 391 // Set up sync manager. |
400 SyncManagerFactory sync_manager_factory; | 392 SyncManagerFactory sync_manager_factory; |
401 std::unique_ptr<SyncManager> sync_manager = | 393 std::unique_ptr<SyncManager> sync_manager = |
402 sync_manager_factory.CreateSyncManager("sync_client manager"); | 394 sync_manager_factory.CreateSyncManager("sync_client manager"); |
403 LoggingJsEventHandler js_event_handler; | 395 LoggingJsEventHandler js_event_handler; |
404 // Used only by InitialProcessMetadata(), so it's okay to leave this as NULL. | 396 // Used only by InitialProcessMetadata(), so it's okay to leave this as NULL. |
405 const scoped_refptr<base::TaskRunner> blocking_task_runner = NULL; | 397 const scoped_refptr<base::TaskRunner> blocking_task_runner = NULL; |
406 const char kUserAgent[] = "sync_client"; | 398 const char kUserAgent[] = "sync_client"; |
407 // TODO(akalin): Replace this with just the context getter once | 399 // TODO(akalin): Replace this with just the context getter once |
408 // HttpPostProviderFactory is removed. | 400 // HttpPostProviderFactory is removed. |
409 CancelationSignal factory_cancelation_signal; | 401 CancelationSignal factory_cancelation_signal; |
410 std::unique_ptr<HttpPostProviderFactory> post_factory(new HttpBridgeFactory( | 402 std::unique_ptr<HttpPostProviderFactory> post_factory(new HttpBridgeFactory( |
411 context_getter.get(), base::Bind(&StubNetworkTimeUpdateCallback), | 403 context_getter.get(), base::Bind(&StubNetworkTimeUpdateCallback), |
412 &factory_cancelation_signal)); | 404 &factory_cancelation_signal)); |
413 post_factory->Init(kUserAgent, BindToTrackerCallback()); | 405 post_factory->Init(kUserAgent, BindToTrackerCallback()); |
414 // Used only when committing bookmarks, so it's okay to leave this | 406 // Used only when committing bookmarks, so it's okay to leave this |
415 // as NULL. | 407 // as NULL. |
416 ExtensionsActivity* extensions_activity = NULL; | 408 ExtensionsActivity* extensions_activity = NULL; |
417 LoggingChangeDelegate change_delegate; | 409 LoggingChangeDelegate change_delegate; |
418 const char kRestoredKeyForBootstrapping[] = ""; | 410 const char kRestoredKeyForBootstrapping[] = ""; |
419 const char kRestoredKeystoreKeyForBootstrapping[] = ""; | 411 const char kRestoredKeystoreKeyForBootstrapping[] = ""; |
420 NullEncryptor null_encryptor; | 412 NullEncryptor null_encryptor; |
421 InternalComponentsFactoryImpl::Switches factory_switches = { | 413 InternalComponentsFactoryImpl::Switches factory_switches = { |
422 InternalComponentsFactory::ENCRYPTION_KEYSTORE, | 414 InternalComponentsFactory::ENCRYPTION_KEYSTORE, |
423 InternalComponentsFactory::BACKOFF_NORMAL | 415 InternalComponentsFactory::BACKOFF_NORMAL}; |
424 }; | |
425 CancelationSignal scm_cancelation_signal; | 416 CancelationSignal scm_cancelation_signal; |
426 | 417 |
427 SyncManager::InitArgs args; | 418 SyncManager::InitArgs args; |
428 args.database_location = database_dir.path(); | 419 args.database_location = database_dir.path(); |
429 args.event_handler = WeakHandle<JsEventHandler>(js_event_handler.AsWeakPtr()); | 420 args.event_handler = WeakHandle<JsEventHandler>(js_event_handler.AsWeakPtr()); |
430 args.service_url = GURL(kSyncServiceURL); | 421 args.service_url = GURL(kSyncServiceURL); |
431 args.post_factory = std::move(post_factory); | 422 args.post_factory = std::move(post_factory); |
432 args.workers = workers; | 423 args.workers = workers; |
433 args.extensions_activity = extensions_activity; | 424 args.extensions_activity = extensions_activity; |
434 args.change_delegate = &change_delegate; | 425 args.change_delegate = &change_delegate; |
(...skipping 25 matching lines...) Expand all Loading... |
460 io_thread.Stop(); | 451 io_thread.Stop(); |
461 return 0; | 452 return 0; |
462 } | 453 } |
463 | 454 |
464 } // namespace | 455 } // namespace |
465 } // namespace syncer | 456 } // namespace syncer |
466 | 457 |
467 int main(int argc, char* argv[]) { | 458 int main(int argc, char* argv[]) { |
468 return syncer::SyncClientMain(argc, argv); | 459 return syncer::SyncClientMain(argc, argv); |
469 } | 460 } |
OLD | NEW |