OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 is an application of a minimal host process in a Chromoting | 5 // This is an application of a minimal host process in a Chromoting |
6 // system. It serves the purpose of gluing different pieces together | 6 // system. It serves the purpose of gluing different pieces together |
7 // to make a functional host process for testing. | 7 // to make a functional host process for testing. |
8 // | 8 // |
9 // It peforms the following functionality: | 9 // It peforms the following functionality: |
10 // 1. Connect to the GTalk network and register the machine as a host. | 10 // 1. Connect to the GTalk network and register the machine as a host. |
(...skipping 24 matching lines...) Expand all Loading... |
35 #include "remoting/host/capturer_fake.h" | 35 #include "remoting/host/capturer_fake.h" |
36 #include "remoting/host/chromoting_host.h" | 36 #include "remoting/host/chromoting_host.h" |
37 #include "remoting/host/chromoting_host_context.h" | 37 #include "remoting/host/chromoting_host_context.h" |
38 #include "remoting/host/continue_window.h" | 38 #include "remoting/host/continue_window.h" |
39 #include "remoting/host/curtain.h" | 39 #include "remoting/host/curtain.h" |
40 #include "remoting/host/desktop_environment.h" | 40 #include "remoting/host/desktop_environment.h" |
41 #include "remoting/host/disconnect_window.h" | 41 #include "remoting/host/disconnect_window.h" |
42 #include "remoting/host/event_executor.h" | 42 #include "remoting/host/event_executor.h" |
43 #include "remoting/host/heartbeat_sender.h" | 43 #include "remoting/host/heartbeat_sender.h" |
44 #include "remoting/host/local_input_monitor.h" | 44 #include "remoting/host/local_input_monitor.h" |
| 45 #include "remoting/host/log_to_server.h" |
45 #include "remoting/host/json_host_config.h" | 46 #include "remoting/host/json_host_config.h" |
46 #include "remoting/host/register_support_host_request.h" | 47 #include "remoting/host/register_support_host_request.h" |
47 #include "remoting/host/self_access_verifier.h" | 48 #include "remoting/host/self_access_verifier.h" |
48 #include "remoting/host/support_access_verifier.h" | 49 #include "remoting/host/support_access_verifier.h" |
49 #include "remoting/proto/video.pb.h" | 50 #include "remoting/proto/video.pb.h" |
50 | 51 |
51 #if defined(TOOLKIT_USES_GTK) | 52 #if defined(TOOLKIT_USES_GTK) |
52 #include "ui/gfx/gtk_util.h" | 53 #include "ui/gfx/gtk_util.h" |
53 #elif defined(OS_MACOSX) | 54 #elif defined(OS_MACOSX) |
54 #include "base/mac/scoped_nsautorelease_pool.h" | 55 #include "base/mac/scoped_nsautorelease_pool.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 | 129 |
129 // Initialize AccessVerifier. | 130 // Initialize AccessVerifier. |
130 // TODO(jamiewalch): For the IT2Me case, the access verifier is passed to | 131 // TODO(jamiewalch): For the IT2Me case, the access verifier is passed to |
131 // RegisterSupportHostRequest::Init, so transferring ownership of it to the | 132 // RegisterSupportHostRequest::Init, so transferring ownership of it to the |
132 // ChromotingHost could cause a crash condition if SetIT2MeAccessCode is | 133 // ChromotingHost could cause a crash condition if SetIT2MeAccessCode is |
133 // called after the ChromotingHost is destroyed (for example, at shutdown). | 134 // called after the ChromotingHost is destroyed (for example, at shutdown). |
134 // Fix this. | 135 // Fix this. |
135 scoped_ptr<remoting::AccessVerifier> access_verifier; | 136 scoped_ptr<remoting::AccessVerifier> access_verifier; |
136 scoped_ptr<remoting::RegisterSupportHostRequest> register_request; | 137 scoped_ptr<remoting::RegisterSupportHostRequest> register_request; |
137 scoped_ptr<remoting::HeartbeatSender> heartbeat_sender; | 138 scoped_ptr<remoting::HeartbeatSender> heartbeat_sender; |
| 139 scoped_ptr<remoting::LogToServer> log_to_server; |
138 if (is_it2me_) { | 140 if (is_it2me_) { |
139 scoped_ptr<remoting::SupportAccessVerifier> support_access_verifier( | 141 scoped_ptr<remoting::SupportAccessVerifier> support_access_verifier( |
140 new remoting::SupportAccessVerifier()); | 142 new remoting::SupportAccessVerifier()); |
141 register_request.reset(new remoting::RegisterSupportHostRequest()); | 143 register_request.reset(new remoting::RegisterSupportHostRequest()); |
142 if (!register_request->Init( | 144 if (!register_request->Init( |
143 config, base::Bind(&SimpleHost::SetIT2MeAccessCode, | 145 config, base::Bind(&SimpleHost::SetIT2MeAccessCode, |
144 base::Unretained(this), | 146 base::Unretained(this), |
145 support_access_verifier.get()))) { | 147 support_access_verifier.get()))) { |
146 return 1; | 148 return 1; |
147 } | 149 } |
148 access_verifier.reset(support_access_verifier.release()); | 150 access_verifier.reset(support_access_verifier.release()); |
149 } else { | 151 } else { |
150 scoped_ptr<remoting::SelfAccessVerifier> self_access_verifier( | 152 scoped_ptr<remoting::SelfAccessVerifier> self_access_verifier( |
151 new remoting::SelfAccessVerifier()); | 153 new remoting::SelfAccessVerifier()); |
152 if (!self_access_verifier->Init(config)) | 154 if (!self_access_verifier->Init(config)) |
153 return 1; | 155 return 1; |
154 access_verifier.reset(self_access_verifier.release()); | 156 access_verifier.reset(self_access_verifier.release()); |
155 } | 157 } |
| 158 log_to_server.reset(new remoting::LogToServer( |
| 159 context.network_message_loop())); |
156 | 160 |
157 // Construct a chromoting host. | 161 // Construct a chromoting host. |
158 scoped_ptr<DesktopEnvironment> desktop_environment; | 162 scoped_ptr<DesktopEnvironment> desktop_environment; |
159 if (fake_) { | 163 if (fake_) { |
160 remoting::Capturer* capturer = | 164 remoting::Capturer* capturer = |
161 new remoting::CapturerFake(); | 165 new remoting::CapturerFake(); |
162 remoting::EventExecutor* event_executor = | 166 remoting::EventExecutor* event_executor = |
163 remoting::EventExecutor::Create(context.desktop_message_loop(), | 167 remoting::EventExecutor::Create(context.desktop_message_loop(), |
164 capturer); | 168 capturer); |
165 remoting::Curtain* curtain = remoting::Curtain::Create(); | 169 remoting::Curtain* curtain = remoting::Curtain::Create(); |
(...skipping 23 matching lines...) Expand all Loading... |
189 host_->AddStatusObserver(register_request.get()); | 193 host_->AddStatusObserver(register_request.get()); |
190 } else { | 194 } else { |
191 // Initialize HeartbeatSender. | 195 // Initialize HeartbeatSender. |
192 heartbeat_sender.reset( | 196 heartbeat_sender.reset( |
193 new remoting::HeartbeatSender(context.network_message_loop(), | 197 new remoting::HeartbeatSender(context.network_message_loop(), |
194 config)); | 198 config)); |
195 if (!heartbeat_sender->Init()) | 199 if (!heartbeat_sender->Init()) |
196 return 1; | 200 return 1; |
197 host_->AddStatusObserver(heartbeat_sender.get()); | 201 host_->AddStatusObserver(heartbeat_sender.get()); |
198 } | 202 } |
| 203 host_->AddStatusObserver(log_to_server.get()); |
199 | 204 |
200 // Let the chromoting host run until the shutdown task is executed. | 205 // Let the chromoting host run until the shutdown task is executed. |
201 host_->Start(); | 206 host_->Start(); |
202 message_loop.MessageLoop::Run(); | 207 message_loop.MessageLoop::Run(); |
203 | 208 |
204 // And then stop the chromoting context. | 209 // And then stop the chromoting context. |
205 context.Stop(); | 210 context.Stop(); |
206 file_io_thread.Stop(); | 211 file_io_thread.Stop(); |
207 | 212 |
208 host_ = NULL; | 213 host_ = NULL; |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 LOG(ERROR) << "Unknown video codec: " << video_codec; | 311 LOG(ERROR) << "Unknown video codec: " << video_codec; |
307 return 1; | 312 return 1; |
308 } | 313 } |
309 config->mutable_video_configs()->push_back(ChannelConfig( | 314 config->mutable_video_configs()->push_back(ChannelConfig( |
310 transport, remoting::protocol::kDefaultStreamVersion, codec)); | 315 transport, remoting::protocol::kDefaultStreamVersion, codec)); |
311 simple_host.set_protocol_config(config.release()); | 316 simple_host.set_protocol_config(config.release()); |
312 } | 317 } |
313 | 318 |
314 return simple_host.Run(); | 319 return simple_host.Run(); |
315 } | 320 } |
OLD | NEW |