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 // This file implements a standalone host process for Me2Me. | 5 // This file implements a standalone host process for Me2Me. |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/at_exit.h" | 9 #include "base/at_exit.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 if (state_ != HOST_STARTED) | 474 if (state_ != HOST_STARTED) |
475 return; | 475 return; |
476 | 476 |
477 std::string local_certificate = key_pair_->GenerateCertificate(); | 477 std::string local_certificate = key_pair_->GenerateCertificate(); |
478 if (local_certificate.empty()) { | 478 if (local_certificate.empty()) { |
479 LOG(ERROR) << "Failed to generate host certificate."; | 479 LOG(ERROR) << "Failed to generate host certificate."; |
480 ShutdownHost(kInitializationFailed); | 480 ShutdownHost(kInitializationFailed); |
481 return; | 481 return; |
482 } | 482 } |
483 | 483 |
484 scoped_refptr<protocol::PairingRegistry> pairing_registry = NULL; | 484 scoped_refptr<protocol::PairingRegistry> pairing_registry = |
485 scoped_ptr<protocol::PairingRegistry::Delegate> delegate( | 485 CreatePairingRegistry(context_->file_task_runner()); |
486 CreatePairingRegistryDelegate(context_->file_task_runner())); | |
487 if (delegate) { | |
488 pairing_registry = new protocol::PairingRegistry(delegate.Pass()); | |
489 } | |
490 | 486 |
491 scoped_ptr<protocol::AuthenticatorFactory> factory; | 487 scoped_ptr<protocol::AuthenticatorFactory> factory; |
492 | 488 |
493 if (token_url_.is_empty() && token_validation_url_.is_empty()) { | 489 if (token_url_.is_empty() && token_validation_url_.is_empty()) { |
494 factory = protocol::Me2MeHostAuthenticatorFactory::CreateWithSharedSecret( | 490 factory = protocol::Me2MeHostAuthenticatorFactory::CreateWithSharedSecret( |
495 local_certificate, key_pair_, host_secret_hash_, pairing_registry); | 491 local_certificate, key_pair_, host_secret_hash_, pairing_registry); |
496 | 492 |
497 } else if (token_url_.is_valid() && token_validation_url_.is_valid()) { | 493 } else if (token_url_.is_valid() && token_validation_url_.is_valid()) { |
498 scoped_ptr<protocol::ThirdPartyHostAuthenticator::TokenValidatorFactory> | 494 scoped_ptr<protocol::ThirdPartyHostAuthenticator::TokenValidatorFactory> |
499 token_validator_factory(new TokenValidatorFactoryImpl( | 495 token_validator_factory(new TokenValidatorFactoryImpl( |
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1119 return exit_code; | 1115 return exit_code; |
1120 } | 1116 } |
1121 | 1117 |
1122 } // namespace remoting | 1118 } // namespace remoting |
1123 | 1119 |
1124 #if !defined(OS_WIN) | 1120 #if !defined(OS_WIN) |
1125 int main(int argc, char** argv) { | 1121 int main(int argc, char** argv) { |
1126 return remoting::HostMain(argc, argv); | 1122 return remoting::HostMain(argc, argv); |
1127 } | 1123 } |
1128 #endif // !defined(OS_WIN) | 1124 #endif // !defined(OS_WIN) |
OLD | NEW |