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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 #include "remoting/host/log_to_server.h" | 42 #include "remoting/host/log_to_server.h" |
43 #include "remoting/host/network_settings.h" | 43 #include "remoting/host/network_settings.h" |
44 #include "remoting/host/policy_hack/policy_watcher.h" | 44 #include "remoting/host/policy_hack/policy_watcher.h" |
45 #include "remoting/host/session_manager_factory.h" | 45 #include "remoting/host/session_manager_factory.h" |
46 #include "remoting/host/signaling_connector.h" | 46 #include "remoting/host/signaling_connector.h" |
47 #include "remoting/host/usage_stats_consent.h" | 47 #include "remoting/host/usage_stats_consent.h" |
48 #include "remoting/host/video_frame_capturer.h" | 48 #include "remoting/host/video_frame_capturer.h" |
49 #include "remoting/jingle_glue/xmpp_signal_strategy.h" | 49 #include "remoting/jingle_glue/xmpp_signal_strategy.h" |
50 #include "remoting/protocol/me2me_host_authenticator_factory.h" | 50 #include "remoting/protocol/me2me_host_authenticator_factory.h" |
51 | 51 |
| 52 #if defined(OS_POSIX) |
| 53 #include "remoting/host/posix/sighup_listener.h" |
| 54 #endif // defined(OS_POSIX) |
| 55 |
52 #if defined(OS_MACOSX) | 56 #if defined(OS_MACOSX) |
53 #include "base/mac/scoped_cftyperef.h" | 57 #include "base/mac/scoped_cftyperef.h" |
54 #include "base/mac/scoped_nsautorelease_pool.h" | 58 #include "base/mac/scoped_nsautorelease_pool.h" |
55 #include "remoting/host/curtain_mode_mac.h" | 59 #include "remoting/host/curtain_mode_mac.h" |
56 #include "remoting/host/sighup_listener_mac.h" | 60 #endif // defined(OS_MACOSX) |
57 #endif | 61 |
58 // N.B. OS_WIN is defined by including src/base headers. | 62 // N.B. OS_WIN is defined by including src/base headers. |
59 #if defined(OS_WIN) | 63 #if defined(OS_WIN) |
60 #include <commctrl.h> | 64 #include <commctrl.h> |
61 #endif | 65 #endif // defined(OS_WIN) |
| 66 |
62 #if defined(TOOLKIT_GTK) | 67 #if defined(TOOLKIT_GTK) |
63 #include "ui/gfx/gtk_util.h" | 68 #include "ui/gfx/gtk_util.h" |
64 #endif | 69 #endif // defined(TOOLKIT_GTK) |
65 | 70 |
66 namespace { | 71 namespace { |
67 | 72 |
68 // This is used for tagging system event logs. | 73 // This is used for tagging system event logs. |
69 const char kApplicationName[] = "chromoting"; | 74 const char kApplicationName[] = "chromoting"; |
70 | 75 |
71 // These are used for parsing the config-file locations from the command line, | 76 // These are used for parsing the config-file locations from the command line, |
72 // and for defining the default locations if the switches are not present. | 77 // and for defining the default locations if the switches are not present. |
73 const char kAuthConfigSwitchName[] = "auth-config"; | 78 const char kAuthConfigSwitchName[] = "auth-config"; |
74 const char kHostConfigSwitchName[] = "host-config"; | 79 const char kHostConfigSwitchName[] = "host-config"; |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 | 186 |
182 private: | 187 private: |
183 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 188 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
184 base::Closure callback_; | 189 base::Closure callback_; |
185 | 190 |
186 DISALLOW_COPY_AND_ASSIGN(ConfigChangedDelegate); | 191 DISALLOW_COPY_AND_ASSIGN(ConfigChangedDelegate); |
187 }; | 192 }; |
188 #endif // defined(OS_WIN) | 193 #endif // defined(OS_WIN) |
189 | 194 |
190 void ListenForConfigChanges() { | 195 void ListenForConfigChanges() { |
191 #if defined(OS_MACOSX) | 196 #if defined(OS_POSIX) |
192 remoting::RegisterHupSignalHandler( | 197 remoting::RegisterHupSignalHandler( |
193 base::Bind(&HostProcess::ConfigUpdatedDelayed, base::Unretained(this))); | 198 base::Bind(&HostProcess::ConfigUpdatedDelayed, base::Unretained(this))); |
194 #elif defined(OS_WIN) | 199 #elif defined(OS_WIN) |
195 scoped_refptr<base::files::FilePathWatcher::Delegate> delegate( | 200 scoped_refptr<base::files::FilePathWatcher::Delegate> delegate( |
196 new ConfigChangedDelegate( | 201 new ConfigChangedDelegate( |
197 message_loop_.message_loop_proxy(), | 202 message_loop_.message_loop_proxy(), |
198 base::Bind(&HostProcess::ConfigUpdated, base::Unretained(this)))); | 203 base::Bind(&HostProcess::ConfigUpdated, base::Unretained(this)))); |
199 config_watcher_.reset(new base::files::FilePathWatcher()); | 204 config_watcher_.reset(new base::files::FilePathWatcher()); |
200 if (!config_watcher_->Watch(host_config_path_, delegate)) { | 205 if (!config_watcher_->Watch(host_config_path_, delegate)) { |
201 LOG(ERROR) << "Couldn't watch file " << host_config_path_.value(); | 206 LOG(ERROR) << "Couldn't watch file " << host_config_path_.value(); |
202 } | 207 } |
203 #endif | 208 #endif // defined (OS_WIN) |
204 } | 209 } |
205 | 210 |
206 void CreateAuthenticatorFactory() { | 211 void CreateAuthenticatorFactory() { |
207 DCHECK(context_->network_task_runner()->BelongsToCurrentThread()); | 212 DCHECK(context_->network_task_runner()->BelongsToCurrentThread()); |
208 scoped_ptr<protocol::AuthenticatorFactory> factory( | 213 scoped_ptr<protocol::AuthenticatorFactory> factory( |
209 new protocol::Me2MeHostAuthenticatorFactory( | 214 new protocol::Me2MeHostAuthenticatorFactory( |
210 key_pair_.GenerateCertificate(), | 215 key_pair_.GenerateCertificate(), |
211 *key_pair_.private_key(), host_secret_hash_)); | 216 *key_pair_.private_key(), host_secret_hash_)); |
212 host_->SetAuthenticatorFactory(factory.Pass()); | 217 host_->SetAuthenticatorFactory(factory.Pass()); |
213 } | 218 } |
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
698 user32.GetFunctionPointer("SetProcessDPIAware")); | 703 user32.GetFunctionPointer("SetProcessDPIAware")); |
699 set_process_dpi_aware(); | 704 set_process_dpi_aware(); |
700 } | 705 } |
701 | 706 |
702 // CommandLine::Init() ignores the passed |argc| and |argv| on Windows getting | 707 // CommandLine::Init() ignores the passed |argc| and |argv| on Windows getting |
703 // the command line from GetCommandLineW(), so we can safely pass NULL here. | 708 // the command line from GetCommandLineW(), so we can safely pass NULL here. |
704 return main(0, NULL); | 709 return main(0, NULL); |
705 } | 710 } |
706 | 711 |
707 #endif // defined(OS_WIN) | 712 #endif // defined(OS_WIN) |
OLD | NEW |