| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 #include "remoting/host/host_exit_codes.h" | 62 #include "remoting/host/host_exit_codes.h" |
| 63 #include "remoting/host/host_main.h" | 63 #include "remoting/host/host_main.h" |
| 64 #include "remoting/host/host_status_logger.h" | 64 #include "remoting/host/host_status_logger.h" |
| 65 #include "remoting/host/input_injector.h" | 65 #include "remoting/host/input_injector.h" |
| 66 #include "remoting/host/ipc_desktop_environment.h" | 66 #include "remoting/host/ipc_desktop_environment.h" |
| 67 #include "remoting/host/ipc_host_event_logger.h" | 67 #include "remoting/host/ipc_host_event_logger.h" |
| 68 #include "remoting/host/logging.h" | 68 #include "remoting/host/logging.h" |
| 69 #include "remoting/host/me2me_desktop_environment.h" | 69 #include "remoting/host/me2me_desktop_environment.h" |
| 70 #include "remoting/host/oauth_token_getter_impl.h" | 70 #include "remoting/host/oauth_token_getter_impl.h" |
| 71 #include "remoting/host/pairing_registry_delegate.h" | 71 #include "remoting/host/pairing_registry_delegate.h" |
| 72 #include "remoting/host/pin_hash.h" |
| 72 #include "remoting/host/policy_watcher.h" | 73 #include "remoting/host/policy_watcher.h" |
| 73 #include "remoting/host/security_key/gnubby_auth_handler.h" | 74 #include "remoting/host/security_key/gnubby_auth_handler.h" |
| 74 #include "remoting/host/security_key/gnubby_extension.h" | 75 #include "remoting/host/security_key/gnubby_extension.h" |
| 75 #include "remoting/host/shutdown_watchdog.h" | 76 #include "remoting/host/shutdown_watchdog.h" |
| 76 #include "remoting/host/signaling_connector.h" | 77 #include "remoting/host/signaling_connector.h" |
| 77 #include "remoting/host/single_window_desktop_environment.h" | 78 #include "remoting/host/single_window_desktop_environment.h" |
| 78 #include "remoting/host/switches.h" | 79 #include "remoting/host/switches.h" |
| 79 #include "remoting/host/third_party_auth_config.h" | 80 #include "remoting/host/third_party_auth_config.h" |
| 80 #include "remoting/host/token_validator_factory_impl.h" | 81 #include "remoting/host/token_validator_factory_impl.h" |
| 81 #include "remoting/host/usage_stats_consent.h" | 82 #include "remoting/host/usage_stats_consent.h" |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 base::FilePath host_config_path_; | 398 base::FilePath host_config_path_; |
| 398 std::string host_config_; | 399 std::string host_config_; |
| 399 scoped_ptr<DesktopEnvironmentFactory> desktop_environment_factory_; | 400 scoped_ptr<DesktopEnvironmentFactory> desktop_environment_factory_; |
| 400 | 401 |
| 401 // Accessed on the network thread. | 402 // Accessed on the network thread. |
| 402 HostState state_; | 403 HostState state_; |
| 403 | 404 |
| 404 scoped_ptr<ConfigWatcher> config_watcher_; | 405 scoped_ptr<ConfigWatcher> config_watcher_; |
| 405 | 406 |
| 406 std::string host_id_; | 407 std::string host_id_; |
| 407 protocol::SharedSecretHash host_secret_hash_; | 408 std::string pin_hash_; |
| 408 scoped_refptr<RsaKeyPair> key_pair_; | 409 scoped_refptr<RsaKeyPair> key_pair_; |
| 409 std::string oauth_refresh_token_; | 410 std::string oauth_refresh_token_; |
| 410 std::string serialized_config_; | 411 std::string serialized_config_; |
| 411 std::string host_owner_; | 412 std::string host_owner_; |
| 412 std::string host_owner_email_; | 413 std::string host_owner_email_; |
| 413 bool use_service_account_; | 414 bool use_service_account_; |
| 414 bool enable_vp9_; | 415 bool enable_vp9_; |
| 415 int64_t frame_recorder_buffer_size_; | 416 int64_t frame_recorder_buffer_size_; |
| 416 | 417 |
| 417 scoped_ptr<PolicyWatcher> policy_watcher_; | 418 scoped_ptr<PolicyWatcher> policy_watcher_; |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 788 | 789 |
| 789 if (delegate) | 790 if (delegate) |
| 790 pairing_registry_ = new PairingRegistry(context_->file_task_runner(), | 791 pairing_registry_ = new PairingRegistry(context_->file_task_runner(), |
| 791 std::move(delegate)); | 792 std::move(delegate)); |
| 792 } | 793 } |
| 793 #endif // defined(OS_WIN) | 794 #endif // defined(OS_WIN) |
| 794 | 795 |
| 795 pairing_registry = pairing_registry_; | 796 pairing_registry = pairing_registry_; |
| 796 } | 797 } |
| 797 | 798 |
| 798 factory = protocol::Me2MeHostAuthenticatorFactory::CreateWithSharedSecret( | 799 factory = protocol::Me2MeHostAuthenticatorFactory::CreateWithPin( |
| 799 use_service_account_, host_owner_, local_certificate, key_pair_, | 800 use_service_account_, host_owner_, local_certificate, key_pair_, |
| 800 client_domain_, host_secret_hash_, pairing_registry); | 801 client_domain_, pin_hash_, pairing_registry); |
| 801 | 802 |
| 802 host_->set_pairing_registry(pairing_registry); | 803 host_->set_pairing_registry(pairing_registry); |
| 803 } else { | 804 } else { |
| 804 DCHECK(third_party_auth_config_.token_url.is_valid()); | 805 DCHECK(third_party_auth_config_.token_url.is_valid()); |
| 805 DCHECK(third_party_auth_config_.token_validation_url.is_valid()); | 806 DCHECK(third_party_auth_config_.token_validation_url.is_valid()); |
| 806 | 807 |
| 807 scoped_ptr<protocol::TokenValidatorFactory> token_validator_factory( | 808 scoped_ptr<protocol::TokenValidatorFactory> token_validator_factory( |
| 808 new TokenValidatorFactoryImpl( | 809 new TokenValidatorFactoryImpl( |
| 809 third_party_auth_config_, | 810 third_party_auth_config_, |
| 810 key_pair_, context_->url_request_context_getter())); | 811 key_pair_, context_->url_request_context_getter())); |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1025 return false; | 1026 return false; |
| 1026 } | 1027 } |
| 1027 | 1028 |
| 1028 key_pair_ = RsaKeyPair::FromString(key_base64); | 1029 key_pair_ = RsaKeyPair::FromString(key_base64); |
| 1029 if (!key_pair_.get()) { | 1030 if (!key_pair_.get()) { |
| 1030 LOG(ERROR) << "Invalid private key in the config file."; | 1031 LOG(ERROR) << "Invalid private key in the config file."; |
| 1031 return false; | 1032 return false; |
| 1032 } | 1033 } |
| 1033 | 1034 |
| 1034 std::string host_secret_hash_string; | 1035 std::string host_secret_hash_string; |
| 1035 if (!config.GetString(kHostSecretHashConfigPath, | 1036 if (!config.GetString(kHostSecretHashConfigPath, &host_secret_hash_string) || |
| 1036 &host_secret_hash_string)) { | 1037 !ParsePinHashFromConfig(host_secret_hash_string, host_id_, &pin_hash_)) { |
| 1037 host_secret_hash_string = "plain:"; | 1038 LOG(ERROR) << "Cannot parse host_secret_hash configuration value."; |
| 1038 } | |
| 1039 | |
| 1040 if (!host_secret_hash_.Parse(host_secret_hash_string)) { | |
| 1041 LOG(ERROR) << "Invalid host_secret_hash."; | |
| 1042 return false; | 1039 return false; |
| 1043 } | 1040 } |
| 1044 | 1041 |
| 1045 // Use an XMPP connection to the Talk network for session signaling. | 1042 // Use an XMPP connection to the Talk network for session signaling. |
| 1046 if (!config.GetString(kXmppLoginConfigPath, &xmpp_server_config_.username) || | 1043 if (!config.GetString(kXmppLoginConfigPath, &xmpp_server_config_.username) || |
| 1047 !config.GetString(kOAuthRefreshTokenConfigPath, &oauth_refresh_token_)) { | 1044 !config.GetString(kOAuthRefreshTokenConfigPath, &oauth_refresh_token_)) { |
| 1048 LOG(ERROR) << "XMPP credentials are not defined in the config."; | 1045 LOG(ERROR) << "XMPP credentials are not defined in the config."; |
| 1049 return false; | 1046 return false; |
| 1050 } | 1047 } |
| 1051 | 1048 |
| (...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1743 base::TimeDelta::FromSeconds(kShutdownTimeoutSeconds)); | 1740 base::TimeDelta::FromSeconds(kShutdownTimeoutSeconds)); |
| 1744 new HostProcess(std::move(context), &exit_code, &shutdown_watchdog); | 1741 new HostProcess(std::move(context), &exit_code, &shutdown_watchdog); |
| 1745 | 1742 |
| 1746 // Run the main (also UI) message loop until the host no longer needs it. | 1743 // Run the main (also UI) message loop until the host no longer needs it. |
| 1747 message_loop.Run(); | 1744 message_loop.Run(); |
| 1748 | 1745 |
| 1749 return exit_code; | 1746 return exit_code; |
| 1750 } | 1747 } |
| 1751 | 1748 |
| 1752 } // namespace remoting | 1749 } // namespace remoting |
| OLD | NEW |