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