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 929 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
940 if (!config.GetString(kHostSecretHashConfigPath, | 940 if (!config.GetString(kHostSecretHashConfigPath, |
941 &host_secret_hash_string)) { | 941 &host_secret_hash_string)) { |
942 host_secret_hash_string = "plain:"; | 942 host_secret_hash_string = "plain:"; |
943 } | 943 } |
944 | 944 |
945 if (!host_secret_hash_.Parse(host_secret_hash_string)) { | 945 if (!host_secret_hash_.Parse(host_secret_hash_string)) { |
946 LOG(ERROR) << "Invalid host_secret_hash."; | 946 LOG(ERROR) << "Invalid host_secret_hash."; |
947 return false; | 947 return false; |
948 } | 948 } |
949 | 949 |
950 // Use an XMPP connection to the Talk network for session signalling. | 950 // Use an XMPP connection to the Talk network for session signaling. |
951 if (!config.GetString(kXmppLoginConfigPath, &xmpp_server_config_.username) || | 951 if (!config.GetString(kXmppLoginConfigPath, &xmpp_server_config_.username) || |
952 !(config.GetString(kXmppAuthTokenConfigPath, | 952 !config.GetString(kOAuthRefreshTokenConfigPath, &oauth_refresh_token_)) { |
953 &xmpp_server_config_.auth_token) || | |
954 config.GetString(kOAuthRefreshTokenConfigPath, | |
955 &oauth_refresh_token_))) { | |
956 LOG(ERROR) << "XMPP credentials are not defined in the config."; | 953 LOG(ERROR) << "XMPP credentials are not defined in the config."; |
957 return false; | 954 return false; |
958 } | 955 } |
959 | 956 |
960 if (!oauth_refresh_token_.empty()) { | |
961 // SignalingConnector (inside HostSignalingManager) is responsible for | |
962 // getting OAuth token. | |
963 xmpp_server_config_.auth_token = ""; | |
964 xmpp_server_config_.auth_service = "oauth2"; | |
965 } else if (!config.GetString(kXmppAuthServiceConfigPath, | |
966 &xmpp_server_config_.auth_service)) { | |
967 // For the me2me host, we default to ClientLogin token for chromiumsync | |
968 // because earlier versions of the host had no HTTP stack with which to | |
969 // request an OAuth2 access token. | |
970 xmpp_server_config_.auth_service = kChromotingTokenDefaultServiceName; | |
971 } | |
972 | |
973 if (config.GetString(kHostOwnerConfigPath, &host_owner_)) { | 957 if (config.GetString(kHostOwnerConfigPath, &host_owner_)) { |
974 // Service account configs have a host_owner, different from the xmpp_login. | 958 // Service account configs have a host_owner, different from the xmpp_login. |
975 use_service_account_ = true; | 959 use_service_account_ = true; |
976 } else { | 960 } else { |
977 // User credential configs only have an xmpp_login, which is also the owner. | 961 // User credential configs only have an xmpp_login, which is also the owner. |
978 host_owner_ = xmpp_server_config_.username; | 962 host_owner_ = xmpp_server_config_.username; |
979 use_service_account_ = false; | 963 use_service_account_ = false; |
980 } | 964 } |
981 | 965 |
982 // For non-Gmail Google accounts, the owner base JID differs from the email. | 966 // For non-Gmail Google accounts, the owner base JID differs from the email. |
(...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1626 base::TimeDelta::FromSeconds(kShutdownTimeoutSeconds)); | 1610 base::TimeDelta::FromSeconds(kShutdownTimeoutSeconds)); |
1627 new HostProcess(context.Pass(), &exit_code, &shutdown_watchdog); | 1611 new HostProcess(context.Pass(), &exit_code, &shutdown_watchdog); |
1628 | 1612 |
1629 // Run the main (also UI) message loop until the host no longer needs it. | 1613 // Run the main (also UI) message loop until the host no longer needs it. |
1630 message_loop.Run(); | 1614 message_loop.Run(); |
1631 | 1615 |
1632 return exit_code; | 1616 return exit_code; |
1633 } | 1617 } |
1634 | 1618 |
1635 } // namespace remoting | 1619 } // namespace remoting |
OLD | NEW |