Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(97)

Side by Side Diff: remoting/host/remoting_me2me_host.cc

Issue 10855249: [Chromoting] The daemon process now starts the networking process and passes the host configuration… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Restore sighup_listener.h/.cc since they are going to be reused by Jamie's CL and ignore SIGHUP for… Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/files/file_path_watcher.h"
16 #include "base/logging.h" 15 #include "base/logging.h"
17 #include "base/memory/scoped_ptr.h" 16 #include "base/memory/scoped_ptr.h"
18 #include "base/message_loop.h" 17 #include "base/message_loop.h"
19 #include "base/scoped_native_library.h" 18 #include "base/scoped_native_library.h"
20 #include "base/string_util.h" 19 #include "base/string_util.h"
21 #include "base/synchronization/waitable_event.h" 20 #include "base/synchronization/waitable_event.h"
22 #include "base/threading/thread.h" 21 #include "base/threading/thread.h"
23 #include "base/utf_string_conversions.h" 22 #include "base/utf_string_conversions.h"
24 #include "base/win/windows_version.h" 23 #include "base/win/windows_version.h"
25 #include "build/build_config.h" 24 #include "build/build_config.h"
26 #include "crypto/nss_util.h" 25 #include "crypto/nss_util.h"
27 #include "ipc/ipc_channel.h" 26 #include "ipc/ipc_channel.h"
28 #include "ipc/ipc_channel_proxy.h" 27 #include "ipc/ipc_channel_proxy.h"
29 #include "net/base/network_change_notifier.h" 28 #include "net/base/network_change_notifier.h"
30 #include "net/socket/ssl_server_socket.h" 29 #include "net/socket/ssl_server_socket.h"
31 #include "remoting/base/auto_message_loop.h" 30 #include "remoting/base/auto_message_loop.h"
32 #include "remoting/base/breakpad.h" 31 #include "remoting/base/breakpad.h"
33 #include "remoting/base/constants.h" 32 #include "remoting/base/constants.h"
34 #include "remoting/host/branding.h" 33 #include "remoting/host/branding.h"
35 #include "remoting/host/chromoting_host.h" 34 #include "remoting/host/chromoting_host.h"
36 #include "remoting/host/chromoting_host_context.h" 35 #include "remoting/host/chromoting_host_context.h"
37 #include "remoting/host/composite_host_config.h" 36 #include "remoting/host/chromoting_messages.h"
38 #include "remoting/host/constants.h" 37 #include "remoting/host/constants.h"
38 #include "remoting/host/config_file_watcher.h"
39 #include "remoting/host/desktop_environment.h" 39 #include "remoting/host/desktop_environment.h"
40 #include "remoting/host/event_executor.h" 40 #include "remoting/host/event_executor.h"
41 #include "remoting/host/heartbeat_sender.h" 41 #include "remoting/host/heartbeat_sender.h"
42 #include "remoting/host/host_config.h" 42 #include "remoting/host/host_config.h"
43 #include "remoting/host/host_event_logger.h" 43 #include "remoting/host/host_event_logger.h"
44 #include "remoting/host/host_user_interface.h" 44 #include "remoting/host/host_user_interface.h"
45 #include "remoting/host/json_host_config.h"
45 #include "remoting/host/log_to_server.h" 46 #include "remoting/host/log_to_server.h"
46 #include "remoting/host/network_settings.h" 47 #include "remoting/host/network_settings.h"
47 #include "remoting/host/policy_hack/policy_watcher.h" 48 #include "remoting/host/policy_hack/policy_watcher.h"
48 #include "remoting/host/session_manager_factory.h" 49 #include "remoting/host/session_manager_factory.h"
49 #include "remoting/host/signaling_connector.h" 50 #include "remoting/host/signaling_connector.h"
50 #include "remoting/host/usage_stats_consent.h" 51 #include "remoting/host/usage_stats_consent.h"
51 #include "remoting/host/video_frame_capturer.h" 52 #include "remoting/host/video_frame_capturer.h"
52 #include "remoting/jingle_glue/xmpp_signal_strategy.h" 53 #include "remoting/jingle_glue/xmpp_signal_strategy.h"
53 #include "remoting/protocol/me2me_host_authenticator_factory.h" 54 #include "remoting/protocol/me2me_host_authenticator_factory.h"
54 55
55 #if defined(OS_POSIX)
56 #include "remoting/host/posix/sighup_listener.h"
57 #endif // defined(OS_POSIX)
58
59 #if defined(OS_MACOSX) 56 #if defined(OS_MACOSX)
60 #include "base/mac/scoped_cftyperef.h" 57 #include "base/mac/scoped_cftyperef.h"
61 #include "base/mac/scoped_nsautorelease_pool.h" 58 #include "base/mac/scoped_nsautorelease_pool.h"
62 #include "remoting/host/curtain_mode_mac.h" 59 #include "remoting/host/curtain_mode_mac.h"
63 #endif // defined(OS_MACOSX) 60 #endif // defined(OS_MACOSX)
64 61
65 // N.B. OS_WIN is defined by including src/base headers. 62 // N.B. OS_WIN is defined by including src/base headers.
66 #if defined(OS_WIN) 63 #if defined(OS_WIN)
67 #include <commctrl.h> 64 #include <commctrl.h>
68 #endif // defined(OS_WIN) 65 #endif // defined(OS_WIN)
69 66
70 #if defined(TOOLKIT_GTK) 67 #if defined(TOOLKIT_GTK)
71 #include "ui/gfx/gtk_util.h" 68 #include "ui/gfx/gtk_util.h"
72 #endif // defined(TOOLKIT_GTK) 69 #endif // defined(TOOLKIT_GTK)
73 70
74 namespace { 71 namespace {
75 72
76 // This is used for tagging system event logs. 73 // This is used for tagging system event logs.
77 const char kApplicationName[] = "chromoting"; 74 const char kApplicationName[] = "chromoting";
78 75
79 // The command line switch specifying the name of the Chromoting IPC channel. 76 // The command line switch specifying the name of the daemon IPC endpoint.
80 const char kDaemonIpcSwitchName[] = "chromoting-ipc"; 77 const char kDaemonIpcSwitchName[] = "daemon-pipe";
81
82 // These are used for parsing the config-file locations from the command line,
83 // and for defining the default locations if the switches are not present.
84 const char kAuthConfigSwitchName[] = "auth-config";
85 const char kHostConfigSwitchName[] = "host-config";
86
87 const FilePath::CharType kDefaultHostConfigFile[] =
88 FILE_PATH_LITERAL("host.json");
89 78
90 const int kMinPortNumber = 12400; 79 const int kMinPortNumber = 12400;
91 const int kMaxPortNumber = 12409; 80 const int kMaxPortNumber = 12409;
92 81
93 const char kUnofficialOAuth2ClientId[] = 82 const char kUnofficialOAuth2ClientId[] =
94 "440925447803-2pi3v45bff6tp1rde2f7q6lgbor3o5uj.apps.googleusercontent.com"; 83 "440925447803-2pi3v45bff6tp1rde2f7q6lgbor3o5uj.apps.googleusercontent.com";
95 const char kUnofficialOAuth2ClientSecret[] = "W2ieEsG-R1gIA4MMurGrgMc_"; 84 const char kUnofficialOAuth2ClientSecret[] = "W2ieEsG-R1gIA4MMurGrgMc_";
96 85
97 const char kOfficialOAuth2ClientId[] = 86 const char kOfficialOAuth2ClientId[] =
98 "440925447803-avn2sj1kc099s0r7v62je5s339mu0am1.apps.googleusercontent.com"; 87 "440925447803-avn2sj1kc099s0r7v62je5s339mu0am1.apps.googleusercontent.com";
99 const char kOfficialOAuth2ClientSecret[] = "Bgur6DFiOMM1h8x-AQpuTQlK"; 88 const char kOfficialOAuth2ClientSecret[] = "Bgur6DFiOMM1h8x-AQpuTQlK";
100 89
101 void QuitMessageLoop(MessageLoop* message_loop) { 90 void QuitMessageLoop(MessageLoop* message_loop) {
102 message_loop->PostTask(FROM_HERE, MessageLoop::QuitClosure()); 91 message_loop->PostTask(FROM_HERE, MessageLoop::QuitClosure());
103 } 92 }
104 93
105 } // namespace 94 } // namespace
106 95
107 namespace remoting { 96 namespace remoting {
108 97
109 class HostProcess 98 class HostProcess
110 : public HeartbeatSender::Listener, 99 : public HeartbeatSender::Listener,
111 public IPC::Listener { 100 public IPC::Listener,
101 public ConfigFileWatcher::Delegate {
112 public: 102 public:
113 HostProcess(scoped_ptr<ChromotingHostContext> context) 103 HostProcess(scoped_ptr<ChromotingHostContext> context)
114 : context_(context.Pass()), 104 : context_(context.Pass()),
105 config_(FilePath()),
115 #ifdef OFFICIAL_BUILD 106 #ifdef OFFICIAL_BUILD
116 oauth_use_official_client_id_(true), 107 oauth_use_official_client_id_(true),
117 #else 108 #else
118 oauth_use_official_client_id_(false), 109 oauth_use_official_client_id_(false),
119 #endif 110 #endif
120 allow_nat_traversal_(true), 111 allow_nat_traversal_(true),
121 restarting_(false), 112 restarting_(false),
122 shutting_down_(false), 113 shutting_down_(false),
123 exit_code_(kSuccessExitCode) 114 exit_code_(kSuccessExitCode)
124 #if defined(OS_MACOSX) 115 #if defined(OS_MACOSX)
125 , curtain_(base::Bind(&HostProcess::OnDisconnectRequested, 116 , curtain_(base::Bind(&HostProcess::OnDisconnectRequested,
126 base::Unretained(this)), 117 base::Unretained(this)),
127 base::Bind(&HostProcess::OnDisconnectRequested, 118 base::Bind(&HostProcess::OnDisconnectRequested,
128 base::Unretained(this))) 119 base::Unretained(this)))
129 #endif 120 #endif
130 { 121 {
131 network_change_notifier_.reset(net::NetworkChangeNotifier::Create()); 122 network_change_notifier_.reset(net::NetworkChangeNotifier::Create());
132 config_updated_timer_.reset(new base::DelayTimer<HostProcess>(
133 FROM_HERE, base::TimeDelta::FromSeconds(2), this,
134 &HostProcess::ConfigUpdatedDelayed));
135 } 123 }
136 124
137 bool InitWithCommandLine(const CommandLine* cmd_line) { 125 bool InitWithCommandLine(const CommandLine* cmd_line) {
138 // Connect to the daemon process. 126 // Connect to the daemon process.
139 std::string channel_name = 127 std::string channel_name =
140 cmd_line->GetSwitchValueASCII(kDaemonIpcSwitchName); 128 cmd_line->GetSwitchValueASCII(kDaemonIpcSwitchName);
141 129
142 #if defined(REMOTING_MULTI_PROCESS) 130 #if defined(REMOTING_MULTI_PROCESS)
143 if (channel_name.empty()) 131 if (channel_name.empty())
144 return false; 132 return false;
145 #endif // defined(REMOTING_MULTI_PROCESS) 133 #endif // defined(REMOTING_MULTI_PROCESS)
146 134
147 if (!channel_name.empty()) { 135 if (!channel_name.empty()) {
148 daemon_channel_.reset(new IPC::ChannelProxy( 136 daemon_channel_.reset(new IPC::ChannelProxy(
149 channel_name, IPC::Channel::MODE_CLIENT, this, 137 channel_name, IPC::Channel::MODE_CLIENT, this,
150 context_->network_task_runner())); 138 context_->network_task_runner()));
151 } 139 }
152 140
141 #if !defined(REMOTING_MULTI_PROCESS)
153 FilePath default_config_dir = remoting::GetConfigDir(); 142 FilePath default_config_dir = remoting::GetConfigDir();
154 if (cmd_line->HasSwitch(kAuthConfigSwitchName)) {
155 FilePath path = cmd_line->GetSwitchValuePath(kAuthConfigSwitchName);
156 config_.AddConfigPath(path);
157 }
158
159 host_config_path_ = default_config_dir.Append(kDefaultHostConfigFile); 143 host_config_path_ = default_config_dir.Append(kDefaultHostConfigFile);
160 if (cmd_line->HasSwitch(kHostConfigSwitchName)) { 144 if (cmd_line->HasSwitch(kHostConfigSwitchName)) {
161 host_config_path_ = cmd_line->GetSwitchValuePath(kHostConfigSwitchName); 145 host_config_path_ = cmd_line->GetSwitchValuePath(kHostConfigSwitchName);
162 } 146 }
163 config_.AddConfigPath(host_config_path_); 147 #endif // !defined(REMOTING_MULTI_PROCESS)
164 148
165 return true; 149 return true;
166 } 150 }
167 151
168 void ConfigUpdated() { 152 virtual void OnConfigUpdated(const std::string& config) OVERRIDE {
169 DCHECK(context_->ui_task_runner()->BelongsToCurrentThread()); 153 DCHECK(context_->ui_task_runner()->BelongsToCurrentThread());
170 154
171 // Call ConfigUpdatedDelayed after a short delay, so that this object won't 155 LOG(INFO) << "Processing new host configuration.";
172 // try to read the updated configuration file before it has been
173 // completely written.
174 // If the writer moves the new configuration file into place atomically,
175 // this delay may not be necessary.
176 config_updated_timer_->Reset();
177 }
178 156
179 void ConfigUpdatedDelayed() { 157 if (!config_.SetSerializedData(config)) {
180 DCHECK(context_->ui_task_runner()->BelongsToCurrentThread()); 158 LOG(ERROR) << "Invalid configuration.";
159 OnConfigWatcherError();
160 return;
161 }
181 162
182 if (LoadConfig()) { 163 if (!ApplyConfig()) {
164 LOG(ERROR) << "Failed to apply the configuration.";
165 OnConfigWatcherError();
166 return;
167 }
168
169 // Start watching the policy (and eventually start the host) if this is
170 // the first configuration update. Otherwise, post a task to create new
171 // authenticator factory in case PIN has changed.
172 if (policy_watcher_.get() == NULL) {
173 #if defined(OS_MACOSX) || defined(OS_WIN)
174 host_user_interface_.reset(new HostUserInterface(context_.get()));
175 #endif
176
177 StartWatchingPolicy();
178 } else {
183 // PostTask to create new authenticator factory in case PIN has changed. 179 // PostTask to create new authenticator factory in case PIN has changed.
184 context_->network_task_runner()->PostTask( 180 context_->network_task_runner()->PostTask(
185 FROM_HERE, 181 FROM_HERE,
186 base::Bind(&HostProcess::CreateAuthenticatorFactory, 182 base::Bind(&HostProcess::CreateAuthenticatorFactory,
187 base::Unretained(this))); 183 base::Unretained(this)));
188 } else {
189 LOG(ERROR) << "Invalid configuration.";
190 } 184 }
191 } 185 }
192 186
193 #if defined(OS_WIN) 187 virtual void OnConfigWatcherError() OVERRIDE {
194 class ConfigChangedDelegate : public base::files::FilePathWatcher::Delegate { 188 DCHECK(context_->ui_task_runner()->BelongsToCurrentThread());
195 public:
196 ConfigChangedDelegate(
197 scoped_refptr<base::SingleThreadTaskRunner> task_runner,
198 const base::Closure& callback)
199 : task_runner_(task_runner),
200 callback_(callback) {
201 }
202 189
203 void OnFilePathChanged(const FilePath& path) OVERRIDE { 190 context_->network_task_runner()->PostTask(
204 task_runner_->PostTask(FROM_HERE, callback_); 191 FROM_HERE,
205 } 192 base::Bind(&HostProcess::Shutdown, base::Unretained(this),
193 kInvalidHostConfigurationExitCode));
194 }
206 195
207 void OnFilePathError(const FilePath& path) OVERRIDE { 196 void StartWatchingConfigChanges() {
208 } 197 #if !defined(REMOTING_MULTI_PROCESS)
209 198
210 private: 199 #if defined(OS_POSIX)
211 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 200 // Ignore SIGHUP sent by the daemon controller since we use
212 base::Closure callback_; 201 // |ConfigFileWatcher| instead.
202 signal(SIGHUP, SIG_IGN);
203 #endif // defined(OS_POSIX)
213 204
214 DISALLOW_COPY_AND_ASSIGN(ConfigChangedDelegate); 205 // Start watching the host configuration file.
215 }; 206 config_watcher_.reset(new ConfigFileWatcher(context_->ui_task_runner(),
216 #endif // defined(OS_WIN) 207 context_->file_task_runner(),
217 208 this));
218 void ListenForConfigChanges() { 209 config_watcher_->Watch(host_config_path_);
219 #if defined(OS_POSIX) 210 #endif // !defined(REMOTING_MULTI_PROCESS)
220 remoting::RegisterHupSignalHandler(
221 base::Bind(&HostProcess::ConfigUpdatedDelayed, base::Unretained(this)));
222 #elif defined(OS_WIN)
223 scoped_refptr<base::files::FilePathWatcher::Delegate> delegate(
224 new ConfigChangedDelegate(
225 context_->ui_task_runner(),
226 base::Bind(&HostProcess::ConfigUpdated, base::Unretained(this))));
227 config_watcher_.reset(new base::files::FilePathWatcher());
228 if (!config_watcher_->Watch(host_config_path_, delegate)) {
229 LOG(ERROR) << "Couldn't watch file " << host_config_path_.value();
230 }
231 #endif // defined (OS_WIN)
232 } 211 }
233 212
234 void CreateAuthenticatorFactory() { 213 void CreateAuthenticatorFactory() {
235 DCHECK(context_->network_task_runner()->BelongsToCurrentThread()); 214 DCHECK(context_->network_task_runner()->BelongsToCurrentThread());
236 scoped_ptr<protocol::AuthenticatorFactory> factory( 215 scoped_ptr<protocol::AuthenticatorFactory> factory(
237 new protocol::Me2MeHostAuthenticatorFactory( 216 new protocol::Me2MeHostAuthenticatorFactory(
238 key_pair_.GenerateCertificate(), 217 key_pair_.GenerateCertificate(),
239 *key_pair_.private_key(), host_secret_hash_)); 218 *key_pair_.private_key(), host_secret_hash_));
240 host_->SetAuthenticatorFactory(factory.Pass()); 219 host_->SetAuthenticatorFactory(factory.Pass());
241 } 220 }
242 221
243 // IPC::Listener implementation. 222 // IPC::Listener implementation.
244 virtual bool OnMessageReceived(const IPC::Message& message) { 223 virtual bool OnMessageReceived(const IPC::Message& message) {
224 DCHECK(context_->ui_task_runner()->BelongsToCurrentThread());
225
226 #if defined(REMOTING_MULTI_PROCESS)
227 bool handled = true;
228 IPC_BEGIN_MESSAGE_MAP(HostProcess, message)
229 IPC_MESSAGE_HANDLER(ChromotingDaemonNetworkMsg_Configuration,
230 OnConfigUpdated)
231 IPC_MESSAGE_UNHANDLED(handled = false)
232 IPC_END_MESSAGE_MAP()
233 return handled;
234 #else // !defined(REMOTING_MULTI_PROCESS)
245 return false; 235 return false;
236 #endif // !defined(REMOTING_MULTI_PROCESS)
246 } 237 }
247 238
248 void StartHostProcess() { 239 void StartHostProcess() {
249 DCHECK(context_->ui_task_runner()->BelongsToCurrentThread()); 240 DCHECK(context_->ui_task_runner()->BelongsToCurrentThread());
250 241
251 if (!InitWithCommandLine(CommandLine::ForCurrentProcess()) || 242 if (!InitWithCommandLine(CommandLine::ForCurrentProcess())) {
252 !LoadConfig()) { 243 OnConfigWatcherError();
253 context_->network_task_runner()->PostTask(
254 FROM_HERE,
255 base::Bind(&HostProcess::Shutdown, base::Unretained(this),
256 kInvalidHostConfigurationExitCode));
257 return; 244 return;
258 } 245 }
259 246
260 #if defined(OS_MACOSX) || defined(OS_WIN) 247 StartWatchingConfigChanges();
261 host_user_interface_.reset(new HostUserInterface(context_.get()));
262 #endif
263
264 StartWatchingPolicy();
265
266 #if defined(OS_MACOSX) || defined(OS_WIN)
267 context_->file_task_runner()->PostTask(
268 FROM_HERE,
269 base::Bind(&HostProcess::ListenForConfigChanges,
270 base::Unretained(this)));
271 #endif
272 } 248 }
273 249
274 void ShutdownHostProcess() { 250 void ShutdownHostProcess() {
275 DCHECK(context_->ui_task_runner()->BelongsToCurrentThread()); 251 DCHECK(context_->ui_task_runner()->BelongsToCurrentThread());
276 252
253 #if !defined(REMOTING_MULTI_PROCESS)
254 config_watcher_.reset();
255 #endif // !defined(REMOTING_MULTI_PROCESS)
256
277 daemon_channel_.reset(); 257 daemon_channel_.reset();
278 258
279 #if defined(OS_MACOSX) || defined(OS_WIN) 259 #if defined(OS_MACOSX) || defined(OS_WIN)
280 host_user_interface_.reset(); 260 host_user_interface_.reset();
281 #endif 261 #endif
282 262
283 if (policy_watcher_.get()) { 263 if (policy_watcher_.get()) {
284 base::WaitableEvent done_event(true, false); 264 base::WaitableEvent done_event(true, false);
285 policy_watcher_->StopWatching(&done_event); 265 policy_watcher_->StopWatching(&done_event);
286 done_event.Wait(); 266 done_event.Wait();
(...skipping 15 matching lines...) Expand all
302 } 282 }
303 283
304 private: 284 private:
305 void StartWatchingPolicy() { 285 void StartWatchingPolicy() {
306 policy_watcher_.reset( 286 policy_watcher_.reset(
307 policy_hack::PolicyWatcher::Create(context_->file_task_runner())); 287 policy_hack::PolicyWatcher::Create(context_->file_task_runner()));
308 policy_watcher_->StartWatching( 288 policy_watcher_->StartWatching(
309 base::Bind(&HostProcess::OnPolicyUpdate, base::Unretained(this))); 289 base::Bind(&HostProcess::OnPolicyUpdate, base::Unretained(this)));
310 } 290 }
311 291
312 // Read host config, returning true if successful. 292 // Applies the host config, returning true if successful.
313 bool LoadConfig() { 293 bool ApplyConfig() {
314 DCHECK(context_->ui_task_runner()->BelongsToCurrentThread()); 294 DCHECK(context_->ui_task_runner()->BelongsToCurrentThread());
315 295
316 // TODO(sergeyu): There is a potential race condition: this function is
317 // called on the main thread while the class members it mutates are used on
318 // the network thread. Fix it. http://crbug.com/140986 .
319
320 if (!config_.Read()) {
321 LOG(ERROR) << "Failed to read config file.";
322 return false;
323 }
324
325 if (!config_.GetString(kHostIdConfigPath, &host_id_)) { 296 if (!config_.GetString(kHostIdConfigPath, &host_id_)) {
326 LOG(ERROR) << "host_id is not defined in the config."; 297 LOG(ERROR) << "host_id is not defined in the config.";
327 return false; 298 return false;
328 } 299 }
329 300
330 if (!key_pair_.Load(config_)) { 301 if (!key_pair_.Load(config_)) {
331 return false; 302 return false;
332 } 303 }
333 304
334 std::string host_secret_hash_string; 305 std::string host_secret_hash_string;
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
620 context_->ui_task_runner()->PostTask( 591 context_->ui_task_runner()->PostTask(
621 FROM_HERE, 592 FROM_HERE,
622 base::Bind(&HostProcess::ShutdownHostProcess, 593 base::Bind(&HostProcess::ShutdownHostProcess,
623 base::Unretained(this))); 594 base::Unretained(this)));
624 } 595 }
625 596
626 scoped_ptr<ChromotingHostContext> context_; 597 scoped_ptr<ChromotingHostContext> context_;
627 scoped_ptr<IPC::ChannelProxy> daemon_channel_; 598 scoped_ptr<IPC::ChannelProxy> daemon_channel_;
628 scoped_ptr<net::NetworkChangeNotifier> network_change_notifier_; 599 scoped_ptr<net::NetworkChangeNotifier> network_change_notifier_;
629 600
601 JsonHostConfig config_;
602 #if !defined(REMOTING_MULTI_PROCESS)
630 FilePath host_config_path_; 603 FilePath host_config_path_;
631 CompositeHostConfig config_; 604 scoped_ptr<ConfigFileWatcher> config_watcher_;
605 #endif // !defined(REMOTING_MULTI_PROCESS)
632 606
633 std::string host_id_; 607 std::string host_id_;
634 HostKeyPair key_pair_; 608 HostKeyPair key_pair_;
635 protocol::SharedSecretHash host_secret_hash_; 609 protocol::SharedSecretHash host_secret_hash_;
636 std::string xmpp_login_; 610 std::string xmpp_login_;
637 std::string xmpp_auth_token_; 611 std::string xmpp_auth_token_;
638 std::string xmpp_auth_service_; 612 std::string xmpp_auth_service_;
639 613
640 std::string oauth_refresh_token_; 614 std::string oauth_refresh_token_;
641 bool oauth_use_official_client_id_; 615 bool oauth_use_official_client_id_;
642 616
643 scoped_ptr<policy_hack::PolicyWatcher> policy_watcher_; 617 scoped_ptr<policy_hack::PolicyWatcher> policy_watcher_;
644 bool allow_nat_traversal_; 618 bool allow_nat_traversal_;
645 scoped_ptr<base::files::FilePathWatcher> config_watcher_;
646 scoped_ptr<base::DelayTimer<HostProcess> > config_updated_timer_;
647 619
648 bool restarting_; 620 bool restarting_;
649 bool shutting_down_; 621 bool shutting_down_;
650 622
651 scoped_ptr<XmppSignalStrategy> signal_strategy_; 623 scoped_ptr<XmppSignalStrategy> signal_strategy_;
652 scoped_ptr<SignalingConnector> signaling_connector_; 624 scoped_ptr<SignalingConnector> signaling_connector_;
653 scoped_ptr<DesktopEnvironment> desktop_environment_; 625 scoped_ptr<DesktopEnvironment> desktop_environment_;
654 scoped_ptr<HeartbeatSender> heartbeat_sender_; 626 scoped_ptr<HeartbeatSender> heartbeat_sender_;
655 scoped_ptr<LogToServer> log_to_server_; 627 scoped_ptr<LogToServer> log_to_server_;
656 scoped_ptr<HostEventLogger> host_event_logger_; 628 scoped_ptr<HostEventLogger> host_event_logger_;
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
716 MessageLoop message_loop(MessageLoop::TYPE_UI); 688 MessageLoop message_loop(MessageLoop::TYPE_UI);
717 base::Closure quit_message_loop = base::Bind(&QuitMessageLoop, 689 base::Closure quit_message_loop = base::Bind(&QuitMessageLoop,
718 base::Unretained(&message_loop)); 690 base::Unretained(&message_loop));
719 scoped_ptr<remoting::ChromotingHostContext> context( 691 scoped_ptr<remoting::ChromotingHostContext> context(
720 new remoting::ChromotingHostContext( 692 new remoting::ChromotingHostContext(
721 new remoting::AutoMessageLoop(NULL, message_loop.message_loop_proxy(), 693 new remoting::AutoMessageLoop(NULL, message_loop.message_loop_proxy(),
722 quit_message_loop))); 694 quit_message_loop)));
723 if (!context->Start()) 695 if (!context->Start())
724 return remoting::kHostInitializationFailed; 696 return remoting::kHostInitializationFailed;
725 697
726 // Create the host process instance and run the rest of the initialization on 698 // Create the host process instance and enter the main message loop.
727 // the main message loop.
728 remoting::HostProcess me2me_host(context.Pass()); 699 remoting::HostProcess me2me_host(context.Pass());
729 message_loop.PostTask( 700 me2me_host.StartHostProcess();
730 FROM_HERE,
731 base::Bind(&remoting::HostProcess::StartHostProcess,
732 base::Unretained(&me2me_host)));
733 return me2me_host.Run(&message_loop); 701 return me2me_host.Run(&message_loop);
734 } 702 }
735 703
736 #if defined(OS_WIN) 704 #if defined(OS_WIN)
737 HMODULE g_hModule = NULL; 705 HMODULE g_hModule = NULL;
738 706
739 int CALLBACK WinMain(HINSTANCE instance, 707 int CALLBACK WinMain(HINSTANCE instance,
740 HINSTANCE previous_instance, 708 HINSTANCE previous_instance,
741 LPSTR command_line, 709 LPSTR command_line,
742 int show_command) { 710 int show_command) {
(...skipping 24 matching lines...) Expand all
767 user32.GetFunctionPointer("SetProcessDPIAware")); 735 user32.GetFunctionPointer("SetProcessDPIAware"));
768 set_process_dpi_aware(); 736 set_process_dpi_aware();
769 } 737 }
770 738
771 // CommandLine::Init() ignores the passed |argc| and |argv| on Windows getting 739 // CommandLine::Init() ignores the passed |argc| and |argv| on Windows getting
772 // the command line from GetCommandLineW(), so we can safely pass NULL here. 740 // the command line from GetCommandLineW(), so we can safely pass NULL here.
773 return main(0, NULL); 741 return main(0, NULL);
774 } 742 }
775 743
776 #endif // defined(OS_WIN) 744 #endif // defined(OS_WIN)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698