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 "ipc/ipc_listener.h" | 29 #include "ipc/ipc_listener.h" |
31 #include "net/base/network_change_notifier.h" | 30 #include "net/base/network_change_notifier.h" |
32 #include "net/socket/ssl_server_socket.h" | 31 #include "net/socket/ssl_server_socket.h" |
33 #include "remoting/base/auto_thread_task_runner.h" | 32 #include "remoting/base/auto_thread_task_runner.h" |
34 #include "remoting/base/breakpad.h" | 33 #include "remoting/base/breakpad.h" |
35 #include "remoting/base/constants.h" | 34 #include "remoting/base/constants.h" |
36 #include "remoting/host/branding.h" | 35 #include "remoting/host/branding.h" |
37 #include "remoting/host/chromoting_host.h" | 36 #include "remoting/host/chromoting_host.h" |
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
683 new DnsBlackholeChecker(context_->url_request_context_getter(), | 682 new DnsBlackholeChecker(context_->url_request_context_getter(), |
684 talkgadget_prefix_)); | 683 talkgadget_prefix_)); |
685 | 684 |
686 signaling_connector_.reset(new SignalingConnector( | 685 signaling_connector_.reset(new SignalingConnector( |
687 signal_strategy_.get(), | 686 signal_strategy_.get(), |
688 context_->url_request_context_getter(), | 687 context_->url_request_context_getter(), |
689 dns_blackhole_checker.Pass(), | 688 dns_blackhole_checker.Pass(), |
690 base::Bind(&HostProcess::OnAuthFailed, base::Unretained(this)))); | 689 base::Bind(&HostProcess::OnAuthFailed, base::Unretained(this)))); |
691 | 690 |
692 if (!oauth_refresh_token_.empty()) { | 691 if (!oauth_refresh_token_.empty()) { |
693 OAuthClientInfo client_info = { | |
694 google_apis::GetOAuth2ClientID(google_apis::CLIENT_REMOTING), | |
695 google_apis::GetOAuth2ClientSecret(google_apis::CLIENT_REMOTING) | |
696 }; | |
697 | |
698 scoped_ptr<SignalingConnector::OAuthCredentials> oauth_credentials( | 692 scoped_ptr<SignalingConnector::OAuthCredentials> oauth_credentials( |
699 new SignalingConnector::OAuthCredentials( | 693 new SignalingConnector::OAuthCredentials( |
700 xmpp_login_, oauth_refresh_token_, client_info)); | 694 xmpp_login_, oauth_refresh_token_)); |
701 signaling_connector_->EnableOAuth(oauth_credentials.Pass()); | 695 signaling_connector_->EnableOAuth(oauth_credentials.Pass()); |
702 } | 696 } |
703 | 697 |
704 NetworkSettings network_settings( | 698 NetworkSettings network_settings( |
705 allow_nat_traversal_ ? | 699 allow_nat_traversal_ ? |
706 NetworkSettings::NAT_TRAVERSAL_ENABLED : | 700 NetworkSettings::NAT_TRAVERSAL_ENABLED : |
707 NetworkSettings::NAT_TRAVERSAL_DISABLED); | 701 NetworkSettings::NAT_TRAVERSAL_DISABLED); |
708 if (!allow_nat_traversal_) { | 702 if (!allow_nat_traversal_) { |
709 network_settings.min_port = NetworkSettings::kDefaultMinPort; | 703 network_settings.min_port = NetworkSettings::kDefaultMinPort; |
710 network_settings.max_port = NetworkSettings::kDefaultMaxPort; | 704 network_settings.max_port = NetworkSettings::kDefaultMaxPort; |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
945 user32.GetFunctionPointer("SetProcessDPIAware")); | 939 user32.GetFunctionPointer("SetProcessDPIAware")); |
946 set_process_dpi_aware(); | 940 set_process_dpi_aware(); |
947 } | 941 } |
948 | 942 |
949 // CommandLine::Init() ignores the passed |argc| and |argv| on Windows getting | 943 // CommandLine::Init() ignores the passed |argc| and |argv| on Windows getting |
950 // the command line from GetCommandLineW(), so we can safely pass NULL here. | 944 // the command line from GetCommandLineW(), so we can safely pass NULL here. |
951 return main(0, NULL); | 945 return main(0, NULL); |
952 } | 946 } |
953 | 947 |
954 #endif // defined(OS_WIN) | 948 #endif // defined(OS_WIN) |
OLD | NEW |