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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 #include "remoting/host/network_settings.h" | 60 #include "remoting/host/network_settings.h" |
61 #include "remoting/host/policy_hack/policy_watcher.h" | 61 #include "remoting/host/policy_hack/policy_watcher.h" |
62 #include "remoting/host/service_urls.h" | 62 #include "remoting/host/service_urls.h" |
63 #include "remoting/host/session_manager_factory.h" | 63 #include "remoting/host/session_manager_factory.h" |
64 #include "remoting/host/signaling_connector.h" | 64 #include "remoting/host/signaling_connector.h" |
65 #include "remoting/host/token_validator_factory_impl.h" | 65 #include "remoting/host/token_validator_factory_impl.h" |
66 #include "remoting/host/ui_strings.h" | 66 #include "remoting/host/ui_strings.h" |
67 #include "remoting/host/usage_stats_consent.h" | 67 #include "remoting/host/usage_stats_consent.h" |
68 #include "remoting/jingle_glue/xmpp_signal_strategy.h" | 68 #include "remoting/jingle_glue/xmpp_signal_strategy.h" |
69 #include "remoting/protocol/me2me_host_authenticator_factory.h" | 69 #include "remoting/protocol/me2me_host_authenticator_factory.h" |
| 70 #include "remoting/protocol/pairing_registry.h" |
70 | 71 |
71 #if defined(OS_POSIX) | 72 #if defined(OS_POSIX) |
72 #include <signal.h> | 73 #include <signal.h> |
73 #include "base/file_descriptor_posix.h" | 74 #include "base/file_descriptor_posix.h" |
74 #include "remoting/host/pam_authorization_factory_posix.h" | 75 #include "remoting/host/pam_authorization_factory_posix.h" |
75 #include "remoting/host/posix/signal_handler.h" | 76 #include "remoting/host/posix/signal_handler.h" |
76 #endif // defined(OS_POSIX) | 77 #endif // defined(OS_POSIX) |
77 | 78 |
78 #if defined(OS_MACOSX) | 79 #if defined(OS_MACOSX) |
79 #include "base/mac/scoped_cftyperef.h" | 80 #include "base/mac/scoped_cftyperef.h" |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 return; | 459 return; |
459 | 460 |
460 std::string local_certificate = key_pair_->GenerateCertificate(); | 461 std::string local_certificate = key_pair_->GenerateCertificate(); |
461 if (local_certificate.empty()) { | 462 if (local_certificate.empty()) { |
462 LOG(ERROR) << "Failed to generate host certificate."; | 463 LOG(ERROR) << "Failed to generate host certificate."; |
463 ShutdownHost(kInitializationFailed); | 464 ShutdownHost(kInitializationFailed); |
464 return; | 465 return; |
465 } | 466 } |
466 scoped_ptr<protocol::AuthenticatorFactory> factory; | 467 scoped_ptr<protocol::AuthenticatorFactory> factory; |
467 | 468 |
| 469 // TODO(jamiewalch): Add a proper pairing registry here once all the code |
| 470 // is committed. |
| 471 scoped_refptr<remoting::protocol::PairingRegistry> pairing_registry; |
| 472 |
468 if (token_url_.is_empty() && token_validation_url_.is_empty()) { | 473 if (token_url_.is_empty() && token_validation_url_.is_empty()) { |
469 factory = protocol::Me2MeHostAuthenticatorFactory::CreateWithSharedSecret( | 474 factory = protocol::Me2MeHostAuthenticatorFactory::CreateWithSharedSecret( |
470 local_certificate, key_pair_, host_secret_hash_); | 475 local_certificate, key_pair_, host_secret_hash_, pairing_registry); |
471 } else if (token_url_.is_valid() && token_validation_url_.is_valid()) { | 476 } else if (token_url_.is_valid() && token_validation_url_.is_valid()) { |
472 scoped_ptr<protocol::ThirdPartyHostAuthenticator::TokenValidatorFactory> | 477 scoped_ptr<protocol::ThirdPartyHostAuthenticator::TokenValidatorFactory> |
473 token_validator_factory(new TokenValidatorFactoryImpl( | 478 token_validator_factory(new TokenValidatorFactoryImpl( |
474 token_url_, token_validation_url_, key_pair_, | 479 token_url_, token_validation_url_, key_pair_, |
475 context_->url_request_context_getter())); | 480 context_->url_request_context_getter())); |
476 factory = protocol::Me2MeHostAuthenticatorFactory::CreateWithThirdPartyAuth( | 481 factory = protocol::Me2MeHostAuthenticatorFactory::CreateWithThirdPartyAuth( |
477 local_certificate, key_pair_, token_validator_factory.Pass()); | 482 local_certificate, key_pair_, token_validator_factory.Pass()); |
478 } else { | 483 } else { |
479 // TODO(rmsousa): If the policy is bad the host should not go online. It | 484 // TODO(rmsousa): If the policy is bad the host should not go online. It |
480 // should keep running, but not connected, until the policies are fixed. | 485 // should keep running, but not connected, until the policies are fixed. |
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1081 return exit_code; | 1086 return exit_code; |
1082 } | 1087 } |
1083 | 1088 |
1084 } // namespace remoting | 1089 } // namespace remoting |
1085 | 1090 |
1086 #if !defined(OS_WIN) | 1091 #if !defined(OS_WIN) |
1087 int main(int argc, char** argv) { | 1092 int main(int argc, char** argv) { |
1088 return remoting::HostMain(argc, argv); | 1093 return remoting::HostMain(argc, argv); |
1089 } | 1094 } |
1090 #endif // !defined(OS_WIN) | 1095 #endif // !defined(OS_WIN) |
OLD | NEW |