| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 | 46 |
| 47 #if defined(OS_MACOSX) | 47 #if defined(OS_MACOSX) |
| 48 #include "base/mac/scoped_nsautorelease_pool.h" | 48 #include "base/mac/scoped_nsautorelease_pool.h" |
| 49 #endif | 49 #endif |
| 50 | 50 |
| 51 // This is a simple utility that initializes a sync client and | 51 // This is a simple utility that initializes a sync client and |
| 52 // prints out any events. | 52 // prints out any events. |
| 53 | 53 |
| 54 // TODO(akalin): Refactor to combine shared code with | 54 // TODO(akalin): Refactor to combine shared code with |
| 55 // sync_listen_notifications. | 55 // sync_listen_notifications. |
| 56 namespace syncer { |
| 56 namespace { | 57 namespace { |
| 57 | 58 |
| 58 const char kEmailSwitch[] = "email"; | 59 const char kEmailSwitch[] = "email"; |
| 59 const char kTokenSwitch[] = "token"; | 60 const char kTokenSwitch[] = "token"; |
| 60 const char kXmppHostPortSwitch[] = "xmpp-host-port"; | 61 const char kXmppHostPortSwitch[] = "xmpp-host-port"; |
| 61 const char kXmppTrySslTcpFirstSwitch[] = "xmpp-try-ssltcp-first"; | 62 const char kXmppTrySslTcpFirstSwitch[] = "xmpp-try-ssltcp-first"; |
| 62 const char kXmppAllowInsecureConnectionSwitch[] = | 63 const char kXmppAllowInsecureConnectionSwitch[] = |
| 63 "xmpp-allow-insecure-connection"; | 64 "xmpp-allow-insecure-connection"; |
| 64 const char kNotificationMethodSwitch[] = "notification-method"; | 65 const char kNotificationMethodSwitch[] = "notification-method"; |
| 65 | 66 |
| 66 class NullInvalidationStateTracker | 67 class NullInvalidationStateTracker |
| 67 : public base::SupportsWeakPtr<NullInvalidationStateTracker>, | 68 : public base::SupportsWeakPtr<NullInvalidationStateTracker>, |
| 68 public syncer::InvalidationStateTracker { | 69 public InvalidationStateTracker { |
| 69 public: | 70 public: |
| 70 NullInvalidationStateTracker() {} | 71 NullInvalidationStateTracker() {} |
| 71 virtual ~NullInvalidationStateTracker() {} | 72 virtual ~NullInvalidationStateTracker() {} |
| 72 | 73 |
| 73 virtual syncer::InvalidationVersionMap | 74 virtual InvalidationVersionMap GetAllMaxVersions() const OVERRIDE { |
| 74 GetAllMaxVersions() const OVERRIDE { | 75 return InvalidationVersionMap(); |
| 75 return syncer::InvalidationVersionMap(); | |
| 76 } | 76 } |
| 77 | 77 |
| 78 virtual void SetMaxVersion( | 78 virtual void SetMaxVersion( |
| 79 const invalidation::ObjectId& id, | 79 const invalidation::ObjectId& id, |
| 80 int64 max_invalidation_version) OVERRIDE { | 80 int64 max_invalidation_version) OVERRIDE { |
| 81 VLOG(1) << "Setting max invalidation version for " | 81 VLOG(1) << "Setting max invalidation version for " |
| 82 << syncer::ObjectIdToString(id) << " to " | 82 << ObjectIdToString(id) << " to " << max_invalidation_version; |
| 83 << max_invalidation_version; | |
| 84 } | 83 } |
| 85 | 84 |
| 86 virtual std::string GetInvalidationState() const OVERRIDE { | 85 virtual std::string GetInvalidationState() const OVERRIDE { |
| 87 return std::string(); | 86 return std::string(); |
| 88 } | 87 } |
| 89 | 88 |
| 90 virtual void SetInvalidationState(const std::string& state) OVERRIDE { | 89 virtual void SetInvalidationState(const std::string& state) OVERRIDE { |
| 91 std::string base64_state; | 90 std::string base64_state; |
| 92 CHECK(base::Base64Encode(state, &base64_state)); | 91 CHECK(base::Base64Encode(state, &base64_state)); |
| 93 VLOG(1) << "Setting invalidation state to: " << base64_state; | 92 VLOG(1) << "Setting invalidation state to: " << base64_state; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 123 return context_.get(); | 122 return context_.get(); |
| 124 } | 123 } |
| 125 | 124 |
| 126 private: | 125 private: |
| 127 virtual ~MyTestURLRequestContextGetter() {} | 126 virtual ~MyTestURLRequestContextGetter() {} |
| 128 | 127 |
| 129 scoped_ptr<MyTestURLRequestContext> context_; | 128 scoped_ptr<MyTestURLRequestContext> context_; |
| 130 }; | 129 }; |
| 131 | 130 |
| 132 // TODO(akalin): Use system encryptor once it's moved to sync/. | 131 // TODO(akalin): Use system encryptor once it's moved to sync/. |
| 133 class NullEncryptor : public syncer::Encryptor { | 132 class NullEncryptor : public Encryptor { |
| 134 public: | 133 public: |
| 135 virtual ~NullEncryptor() {} | 134 virtual ~NullEncryptor() {} |
| 136 | 135 |
| 137 virtual bool EncryptString(const std::string& plaintext, | 136 virtual bool EncryptString(const std::string& plaintext, |
| 138 std::string* ciphertext) OVERRIDE { | 137 std::string* ciphertext) OVERRIDE { |
| 139 *ciphertext = plaintext; | 138 *ciphertext = plaintext; |
| 140 return true; | 139 return true; |
| 141 } | 140 } |
| 142 | 141 |
| 143 virtual bool DecryptString(const std::string& ciphertext, | 142 virtual bool DecryptString(const std::string& ciphertext, |
| 144 std::string* plaintext) OVERRIDE { | 143 std::string* plaintext) OVERRIDE { |
| 145 *plaintext = ciphertext; | 144 *plaintext = ciphertext; |
| 146 return true; | 145 return true; |
| 147 } | 146 } |
| 148 }; | 147 }; |
| 149 | 148 |
| 150 std::string ValueToString(const Value& value) { | 149 std::string ValueToString(const Value& value) { |
| 151 std::string str; | 150 std::string str; |
| 152 base::JSONWriter::Write(&value, &str); | 151 base::JSONWriter::Write(&value, &str); |
| 153 return str; | 152 return str; |
| 154 } | 153 } |
| 155 | 154 |
| 156 class LoggingChangeDelegate : public syncer::SyncManager::ChangeDelegate { | 155 class LoggingChangeDelegate : public SyncManager::ChangeDelegate { |
| 157 public: | 156 public: |
| 158 virtual ~LoggingChangeDelegate() {} | 157 virtual ~LoggingChangeDelegate() {} |
| 159 | 158 |
| 160 virtual void OnChangesApplied( | 159 virtual void OnChangesApplied( |
| 161 syncer::ModelType model_type, | 160 ModelType model_type, |
| 162 const syncer::BaseTransaction* trans, | 161 const BaseTransaction* trans, |
| 163 const syncer::ImmutableChangeRecordList& changes) OVERRIDE { | 162 const ImmutableChangeRecordList& changes) OVERRIDE { |
| 164 LOG(INFO) << "Changes applied for " | 163 LOG(INFO) << "Changes applied for " |
| 165 << syncer::ModelTypeToString(model_type); | 164 << ModelTypeToString(model_type); |
| 166 size_t i = 1; | 165 size_t i = 1; |
| 167 size_t change_count = changes.Get().size(); | 166 size_t change_count = changes.Get().size(); |
| 168 for (syncer::ChangeRecordList::const_iterator it = | 167 for (ChangeRecordList::const_iterator it = |
| 169 changes.Get().begin(); it != changes.Get().end(); ++it) { | 168 changes.Get().begin(); it != changes.Get().end(); ++it) { |
| 170 scoped_ptr<base::DictionaryValue> change_value(it->ToValue()); | 169 scoped_ptr<base::DictionaryValue> change_value(it->ToValue()); |
| 171 LOG(INFO) << "Change (" << i << "/" << change_count << "): " | 170 LOG(INFO) << "Change (" << i << "/" << change_count << "): " |
| 172 << ValueToString(*change_value); | 171 << ValueToString(*change_value); |
| 173 if (it->action != syncer::ChangeRecord::ACTION_DELETE) { | 172 if (it->action != ChangeRecord::ACTION_DELETE) { |
| 174 syncer::ReadNode node(trans); | 173 ReadNode node(trans); |
| 175 CHECK_EQ(node.InitByIdLookup(it->id), syncer::BaseNode::INIT_OK); | 174 CHECK_EQ(node.InitByIdLookup(it->id), BaseNode::INIT_OK); |
| 176 scoped_ptr<base::DictionaryValue> details(node.GetDetailsAsValue()); | 175 scoped_ptr<base::DictionaryValue> details(node.GetDetailsAsValue()); |
| 177 VLOG(1) << "Details: " << ValueToString(*details); | 176 VLOG(1) << "Details: " << ValueToString(*details); |
| 178 } | 177 } |
| 179 ++i; | 178 ++i; |
| 180 } | 179 } |
| 181 } | 180 } |
| 182 | 181 |
| 183 virtual void OnChangesComplete(syncer::ModelType model_type) OVERRIDE { | 182 virtual void OnChangesComplete(ModelType model_type) OVERRIDE { |
| 184 LOG(INFO) << "Changes complete for " | 183 LOG(INFO) << "Changes complete for " |
| 185 << syncer::ModelTypeToString(model_type); | 184 << ModelTypeToString(model_type); |
| 186 } | 185 } |
| 187 }; | 186 }; |
| 188 | 187 |
| 189 class LoggingUnrecoverableErrorHandler | 188 class LoggingUnrecoverableErrorHandler |
| 190 : public syncer::UnrecoverableErrorHandler { | 189 : public UnrecoverableErrorHandler { |
| 191 public: | 190 public: |
| 192 virtual ~LoggingUnrecoverableErrorHandler() {} | 191 virtual ~LoggingUnrecoverableErrorHandler() {} |
| 193 | 192 |
| 194 virtual void OnUnrecoverableError(const tracked_objects::Location& from_here, | 193 virtual void OnUnrecoverableError(const tracked_objects::Location& from_here, |
| 195 const std::string& message) OVERRIDE { | 194 const std::string& message) OVERRIDE { |
| 196 if (LOG_IS_ON(ERROR)) { | 195 if (LOG_IS_ON(ERROR)) { |
| 197 logging::LogMessage(from_here.file_name(), from_here.line_number(), | 196 logging::LogMessage(from_here.file_name(), from_here.line_number(), |
| 198 logging::LOG_ERROR).stream() | 197 logging::LOG_ERROR).stream() |
| 199 << message; | 198 << message; |
| 200 } | 199 } |
| 201 } | 200 } |
| 202 }; | 201 }; |
| 203 | 202 |
| 204 class LoggingJsEventHandler | 203 class LoggingJsEventHandler |
| 205 : public syncer::JsEventHandler, | 204 : public JsEventHandler, |
| 206 public base::SupportsWeakPtr<LoggingJsEventHandler> { | 205 public base::SupportsWeakPtr<LoggingJsEventHandler> { |
| 207 public: | 206 public: |
| 208 virtual ~LoggingJsEventHandler() {} | 207 virtual ~LoggingJsEventHandler() {} |
| 209 | 208 |
| 210 virtual void HandleJsEvent( | 209 virtual void HandleJsEvent( |
| 211 const std::string& name, | 210 const std::string& name, |
| 212 const syncer::JsEventDetails& details) OVERRIDE { | 211 const JsEventDetails& details) OVERRIDE { |
| 213 VLOG(1) << name << ": " << details.ToString(); | 212 VLOG(1) << name << ": " << details.ToString(); |
| 214 } | 213 } |
| 215 }; | 214 }; |
| 216 | 215 |
| 217 void LogUnrecoverableErrorContext() { | 216 void LogUnrecoverableErrorContext() { |
| 218 base::debug::StackTrace stack_trace; | 217 base::debug::StackTrace stack_trace; |
| 219 stack_trace.PrintBacktrace(); | 218 stack_trace.PrintBacktrace(); |
| 220 } | 219 } |
| 221 | 220 |
| 222 notifier::NotifierOptions ParseNotifierOptions( | 221 notifier::NotifierOptions ParseNotifierOptions( |
| (...skipping 23 matching lines...) Expand all Loading... |
| 246 | 245 |
| 247 if (command_line.HasSwitch(kNotificationMethodSwitch)) { | 246 if (command_line.HasSwitch(kNotificationMethodSwitch)) { |
| 248 notifier_options.notification_method = | 247 notifier_options.notification_method = |
| 249 notifier::StringToNotificationMethod( | 248 notifier::StringToNotificationMethod( |
| 250 command_line.GetSwitchValueASCII(kNotificationMethodSwitch)); | 249 command_line.GetSwitchValueASCII(kNotificationMethodSwitch)); |
| 251 } | 250 } |
| 252 | 251 |
| 253 return notifier_options; | 252 return notifier_options; |
| 254 } | 253 } |
| 255 | 254 |
| 256 } // namespace | 255 int SyncClientMain(int argc, char* argv[]) { |
| 257 | |
| 258 int main(int argc, char* argv[]) { | |
| 259 #if defined(OS_MACOSX) | 256 #if defined(OS_MACOSX) |
| 260 base::mac::ScopedNSAutoreleasePool pool; | 257 base::mac::ScopedNSAutoreleasePool pool; |
| 261 #endif | 258 #endif |
| 262 base::AtExitManager exit_manager; | 259 base::AtExitManager exit_manager; |
| 263 CommandLine::Init(argc, argv); | 260 CommandLine::Init(argc, argv); |
| 264 logging::InitLogging( | 261 logging::InitLogging( |
| 265 NULL, | 262 NULL, |
| 266 logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG, | 263 logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG, |
| 267 logging::LOCK_LOG_FILE, | 264 logging::LOCK_LOG_FILE, |
| 268 logging::DELETE_OLD_LOG_FILE, | 265 logging::DELETE_OLD_LOG_FILE, |
| 269 logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS); | 266 logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS); |
| 270 | 267 |
| 271 MessageLoop sync_loop; | 268 MessageLoop sync_loop; |
| 272 base::Thread io_thread("IO thread"); | 269 base::Thread io_thread("IO thread"); |
| 273 base::Thread::Options options; | 270 base::Thread::Options options; |
| 274 options.message_loop_type = MessageLoop::TYPE_IO; | 271 options.message_loop_type = MessageLoop::TYPE_IO; |
| 275 io_thread.StartWithOptions(options); | 272 io_thread.StartWithOptions(options); |
| 276 | 273 |
| 277 // Parse command line. | 274 // Parse command line. |
| 278 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 275 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 279 syncer::SyncCredentials credentials; | 276 SyncCredentials credentials; |
| 280 credentials.email = command_line.GetSwitchValueASCII(kEmailSwitch); | 277 credentials.email = command_line.GetSwitchValueASCII(kEmailSwitch); |
| 281 credentials.sync_token = command_line.GetSwitchValueASCII(kTokenSwitch); | 278 credentials.sync_token = command_line.GetSwitchValueASCII(kTokenSwitch); |
| 282 // TODO(akalin): Write a wrapper script that gets a token for an | 279 // TODO(akalin): Write a wrapper script that gets a token for an |
| 283 // email and password and passes that in to this utility. | 280 // email and password and passes that in to this utility. |
| 284 if (credentials.email.empty() || credentials.sync_token.empty()) { | 281 if (credentials.email.empty() || credentials.sync_token.empty()) { |
| 285 std::printf("Usage: %s --%s=foo@bar.com --%s=token\n" | 282 std::printf("Usage: %s --%s=foo@bar.com --%s=token\n" |
| 286 "[--%s=host:port] [--%s] [--%s]\n" | 283 "[--%s=host:port] [--%s] [--%s]\n" |
| 287 "[--%s=(server|p2p)]\n\n" | 284 "[--%s=(server|p2p)]\n\n" |
| 288 "Run chrome and set a breakpoint on\n" | 285 "Run chrome and set a breakpoint on\n" |
| 289 "syncer::SyncManagerImpl::UpdateCredentials() " | 286 "syncer::SyncManagerImpl::UpdateCredentials() " |
| (...skipping 11 matching lines...) Expand all Loading... |
| 301 scoped_ptr<net::NetworkChangeNotifier> network_change_notifier( | 298 scoped_ptr<net::NetworkChangeNotifier> network_change_notifier( |
| 302 net::NetworkChangeNotifier::Create()); | 299 net::NetworkChangeNotifier::Create()); |
| 303 | 300 |
| 304 // Set up sync notifier factory. | 301 // Set up sync notifier factory. |
| 305 const scoped_refptr<MyTestURLRequestContextGetter> context_getter = | 302 const scoped_refptr<MyTestURLRequestContextGetter> context_getter = |
| 306 new MyTestURLRequestContextGetter(io_thread.message_loop_proxy()); | 303 new MyTestURLRequestContextGetter(io_thread.message_loop_proxy()); |
| 307 const notifier::NotifierOptions& notifier_options = | 304 const notifier::NotifierOptions& notifier_options = |
| 308 ParseNotifierOptions(command_line, context_getter); | 305 ParseNotifierOptions(command_line, context_getter); |
| 309 const char kClientInfo[] = "sync_listen_notifications"; | 306 const char kClientInfo[] = "sync_listen_notifications"; |
| 310 NullInvalidationStateTracker null_invalidation_state_tracker; | 307 NullInvalidationStateTracker null_invalidation_state_tracker; |
| 311 syncer::SyncNotifierFactory sync_notifier_factory( | 308 SyncNotifierFactory sync_notifier_factory( |
| 312 notifier_options, kClientInfo, | 309 notifier_options, kClientInfo, |
| 313 null_invalidation_state_tracker.AsWeakPtr()); | 310 null_invalidation_state_tracker.AsWeakPtr()); |
| 314 | 311 |
| 315 // Set up database directory for the syncer. | 312 // Set up database directory for the syncer. |
| 316 ScopedTempDir database_dir; | 313 ScopedTempDir database_dir; |
| 317 CHECK(database_dir.CreateUniqueTempDir()); | 314 CHECK(database_dir.CreateUniqueTempDir()); |
| 318 | 315 |
| 319 // Set up model type parameters. | 316 // Set up model type parameters. |
| 320 const syncer::ModelTypeSet model_types = syncer::ModelTypeSet::All(); | 317 const ModelTypeSet model_types = ModelTypeSet::All(); |
| 321 syncer::ModelSafeRoutingInfo routing_info; | 318 ModelSafeRoutingInfo routing_info; |
| 322 for (syncer::ModelTypeSet::Iterator it = model_types.First(); | 319 for (ModelTypeSet::Iterator it = model_types.First(); |
| 323 it.Good(); it.Inc()) { | 320 it.Good(); it.Inc()) { |
| 324 routing_info[it.Get()] = syncer::GROUP_PASSIVE; | 321 routing_info[it.Get()] = GROUP_PASSIVE; |
| 325 } | 322 } |
| 326 scoped_refptr<syncer::PassiveModelWorker> passive_model_safe_worker = | 323 scoped_refptr<PassiveModelWorker> passive_model_safe_worker = |
| 327 new syncer::PassiveModelWorker(&sync_loop); | 324 new PassiveModelWorker(&sync_loop); |
| 328 std::vector<syncer::ModelSafeWorker*> workers; | 325 std::vector<ModelSafeWorker*> workers; |
| 329 workers.push_back(passive_model_safe_worker.get()); | 326 workers.push_back(passive_model_safe_worker.get()); |
| 330 | 327 |
| 331 // Set up sync manager. | 328 // Set up sync manager. |
| 332 syncer::SyncManagerFactory sync_manager_factory; | 329 SyncManagerFactory sync_manager_factory; |
| 333 scoped_ptr<syncer::SyncManager> sync_manager = | 330 scoped_ptr<SyncManager> sync_manager = |
| 334 sync_manager_factory.CreateSyncManager("sync_client manager"); | 331 sync_manager_factory.CreateSyncManager("sync_client manager"); |
| 335 LoggingJsEventHandler js_event_handler; | 332 LoggingJsEventHandler js_event_handler; |
| 336 const char kSyncServerAndPath[] = "clients4.google.com/chrome-sync/dev"; | 333 const char kSyncServerAndPath[] = "clients4.google.com/chrome-sync/dev"; |
| 337 int kSyncServerPort = 443; | 334 int kSyncServerPort = 443; |
| 338 bool kUseSsl = true; | 335 bool kUseSsl = true; |
| 339 // Used only by RefreshNigori(), so it's okay to leave this as NULL. | 336 // Used only by RefreshNigori(), so it's okay to leave this as NULL. |
| 340 const scoped_refptr<base::TaskRunner> blocking_task_runner = NULL; | 337 const scoped_refptr<base::TaskRunner> blocking_task_runner = NULL; |
| 341 const char kUserAgent[] = "sync_client"; | 338 const char kUserAgent[] = "sync_client"; |
| 342 // TODO(akalin): Replace this with just the context getter once | 339 // TODO(akalin): Replace this with just the context getter once |
| 343 // HttpPostProviderFactory is removed. | 340 // HttpPostProviderFactory is removed. |
| 344 scoped_ptr<syncer::HttpPostProviderFactory> post_factory( | 341 scoped_ptr<HttpPostProviderFactory> post_factory( |
| 345 new syncer::HttpBridgeFactory(context_getter, kUserAgent)); | 342 new HttpBridgeFactory(context_getter, kUserAgent)); |
| 346 // Used only when committing bookmarks, so it's okay to leave this | 343 // Used only when committing bookmarks, so it's okay to leave this |
| 347 // as NULL. | 344 // as NULL. |
| 348 syncer::ExtensionsActivityMonitor* extensions_activity_monitor = NULL; | 345 ExtensionsActivityMonitor* extensions_activity_monitor = NULL; |
| 349 LoggingChangeDelegate change_delegate; | 346 LoggingChangeDelegate change_delegate; |
| 350 const char kRestoredKeyForBootstrapping[] = ""; | 347 const char kRestoredKeyForBootstrapping[] = ""; |
| 351 NullEncryptor null_encryptor; | 348 NullEncryptor null_encryptor; |
| 352 LoggingUnrecoverableErrorHandler unrecoverable_error_handler; | 349 LoggingUnrecoverableErrorHandler unrecoverable_error_handler; |
| 353 sync_manager->Init(database_dir.path(), | 350 sync_manager->Init(database_dir.path(), |
| 354 syncer::WeakHandle<syncer::JsEventHandler>( | 351 WeakHandle<JsEventHandler>( |
| 355 js_event_handler.AsWeakPtr()), | 352 js_event_handler.AsWeakPtr()), |
| 356 kSyncServerAndPath, | 353 kSyncServerAndPath, |
| 357 kSyncServerPort, | 354 kSyncServerPort, |
| 358 kUseSsl, | 355 kUseSsl, |
| 359 blocking_task_runner, | 356 blocking_task_runner, |
| 360 post_factory.Pass(), | 357 post_factory.Pass(), |
| 361 routing_info, | 358 routing_info, |
| 362 workers, | 359 workers, |
| 363 extensions_activity_monitor, | 360 extensions_activity_monitor, |
| 364 &change_delegate, | 361 &change_delegate, |
| 365 credentials, | 362 credentials, |
| 366 scoped_ptr<syncer::SyncNotifier>( | 363 scoped_ptr<SyncNotifier>( |
| 367 sync_notifier_factory.CreateSyncNotifier()), | 364 sync_notifier_factory.CreateSyncNotifier()), |
| 368 kRestoredKeyForBootstrapping, | 365 kRestoredKeyForBootstrapping, |
| 369 scoped_ptr<syncer::InternalComponentsFactory>( | 366 scoped_ptr<InternalComponentsFactory>( |
| 370 new syncer::InternalComponentsFactoryImpl()), | 367 new InternalComponentsFactoryImpl()), |
| 371 &null_encryptor, | 368 &null_encryptor, |
| 372 &unrecoverable_error_handler, | 369 &unrecoverable_error_handler, |
| 373 &LogUnrecoverableErrorContext); | 370 &LogUnrecoverableErrorContext); |
| 374 // TODO(akalin): We have pass in model parameters multiple times. | 371 // TODO(akalin): Avoid passing in model parameters multiple times by |
| 375 // Organize handling of model types. | 372 // organizing handling of model types. |
| 376 sync_manager->UpdateEnabledTypes(model_types); | 373 sync_manager->UpdateEnabledTypes(model_types); |
| 377 sync_manager->StartSyncingNormally(routing_info); | 374 sync_manager->StartSyncingNormally(routing_info); |
| 378 | 375 |
| 379 sync_loop.Run(); | 376 sync_loop.Run(); |
| 380 | 377 |
| 381 io_thread.Stop(); | 378 io_thread.Stop(); |
| 382 return 0; | 379 return 0; |
| 383 } | 380 } |
| 381 |
| 382 } // namespace |
| 383 } // namespace syncer |
| 384 |
| 385 int main(int argc, char* argv[]) { |
| 386 return syncer::SyncClientMain(argc, argv); |
| 387 } |
| OLD | NEW |