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" |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
13 #include "base/file_path.h" | 13 #include "base/file_path.h" |
14 #include "base/file_util.h" | 14 #include "base/file_util.h" |
15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
16 #include "base/message_loop.h" | 16 #include "base/message_loop.h" |
17 #include "base/scoped_native_library.h" | 17 #include "base/scoped_native_library.h" |
18 #include "base/string_number_conversions.h" | 18 #include "base/string_number_conversions.h" |
19 #include "base/string_util.h" | 19 #include "base/string_util.h" |
20 #include "base/stringize_macros.h" | 20 #include "base/stringize_macros.h" |
21 #include "base/synchronization/waitable_event.h" | 21 #include "base/synchronization/waitable_event.h" |
22 #include "base/threading/thread.h" | 22 #include "base/threading/thread.h" |
23 #include "base/utf_string_conversions.h" | 23 #include "base/utf_string_conversions.h" |
24 #include "base/win/windows_version.h" | 24 #include "base/win/windows_version.h" |
25 #include "build/build_config.h" | 25 #include "build/build_config.h" |
26 #include "crypto/nss_util.h" | 26 #include "crypto/nss_util.h" |
27 #include "google_apis/google_api_keys.h" | |
28 #include "ipc/ipc_channel.h" | 27 #include "ipc/ipc_channel.h" |
29 #include "ipc/ipc_channel_proxy.h" | 28 #include "ipc/ipc_channel_proxy.h" |
30 #include "net/base/network_change_notifier.h" | 29 #include "net/base/network_change_notifier.h" |
31 #include "net/socket/ssl_server_socket.h" | 30 #include "net/socket/ssl_server_socket.h" |
32 #include "remoting/base/auto_thread_task_runner.h" | 31 #include "remoting/base/auto_thread_task_runner.h" |
33 #include "remoting/base/breakpad.h" | 32 #include "remoting/base/breakpad.h" |
34 #include "remoting/base/constants.h" | 33 #include "remoting/base/constants.h" |
35 #include "remoting/host/branding.h" | 34 #include "remoting/host/branding.h" |
36 #include "remoting/host/chromoting_host.h" | 35 #include "remoting/host/chromoting_host.h" |
37 #include "remoting/host/chromoting_host_context.h" | 36 #include "remoting/host/chromoting_host_context.h" |
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
667 new DnsBlackholeChecker(context_->url_request_context_getter(), | 666 new DnsBlackholeChecker(context_->url_request_context_getter(), |
668 talkgadget_prefix_)); | 667 talkgadget_prefix_)); |
669 | 668 |
670 signaling_connector_.reset(new SignalingConnector( | 669 signaling_connector_.reset(new SignalingConnector( |
671 signal_strategy_.get(), | 670 signal_strategy_.get(), |
672 context_->url_request_context_getter(), | 671 context_->url_request_context_getter(), |
673 dns_blackhole_checker.Pass(), | 672 dns_blackhole_checker.Pass(), |
674 base::Bind(&HostProcess::OnAuthFailed, base::Unretained(this)))); | 673 base::Bind(&HostProcess::OnAuthFailed, base::Unretained(this)))); |
675 | 674 |
676 if (!oauth_refresh_token_.empty()) { | 675 if (!oauth_refresh_token_.empty()) { |
677 OAuthClientInfo client_info = { | |
678 google_apis::GetOAuth2ClientID(google_apis::CLIENT_REMOTING), | |
679 google_apis::GetOAuth2ClientSecret(google_apis::CLIENT_REMOTING) | |
680 }; | |
681 | |
682 scoped_ptr<SignalingConnector::OAuthCredentials> oauth_credentials( | 676 scoped_ptr<SignalingConnector::OAuthCredentials> oauth_credentials( |
683 new SignalingConnector::OAuthCredentials( | 677 new SignalingConnector::OAuthCredentials( |
684 xmpp_login_, oauth_refresh_token_, client_info)); | 678 xmpp_login_, oauth_refresh_token_)); |
685 signaling_connector_->EnableOAuth(oauth_credentials.Pass()); | 679 signaling_connector_->EnableOAuth(oauth_credentials.Pass()); |
686 } | 680 } |
687 | 681 |
688 NetworkSettings network_settings( | 682 NetworkSettings network_settings( |
689 allow_nat_traversal_ ? | 683 allow_nat_traversal_ ? |
690 NetworkSettings::NAT_TRAVERSAL_ENABLED : | 684 NetworkSettings::NAT_TRAVERSAL_ENABLED : |
691 NetworkSettings::NAT_TRAVERSAL_DISABLED); | 685 NetworkSettings::NAT_TRAVERSAL_DISABLED); |
692 if (!allow_nat_traversal_) { | 686 if (!allow_nat_traversal_) { |
693 network_settings.min_port = NetworkSettings::kDefaultMinPort; | 687 network_settings.min_port = NetworkSettings::kDefaultMinPort; |
694 network_settings.max_port = NetworkSettings::kDefaultMaxPort; | 688 network_settings.max_port = NetworkSettings::kDefaultMaxPort; |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
923 user32.GetFunctionPointer("SetProcessDPIAware")); | 917 user32.GetFunctionPointer("SetProcessDPIAware")); |
924 set_process_dpi_aware(); | 918 set_process_dpi_aware(); |
925 } | 919 } |
926 | 920 |
927 // CommandLine::Init() ignores the passed |argc| and |argv| on Windows getting | 921 // CommandLine::Init() ignores the passed |argc| and |argv| on Windows getting |
928 // the command line from GetCommandLineW(), so we can safely pass NULL here. | 922 // the command line from GetCommandLineW(), so we can safely pass NULL here. |
929 return main(0, NULL); | 923 return main(0, NULL); |
930 } | 924 } |
931 | 925 |
932 #endif // defined(OS_WIN) | 926 #endif // defined(OS_WIN) |
OLD | NEW |