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

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

Issue 4975003: Introduce a fake HostStub since there's no need to handle it now (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: give HostStubFake Created 10 years, 1 month 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
« no previous file with comments | « remoting/host/chromoting_host.h ('k') | remoting/host/host_stub_fake.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #include "remoting/host/chromoting_host.h" 5 #include "remoting/host/chromoting_host.h"
6 6
7 #include "base/stl_util-inl.h" 7 #include "base/stl_util-inl.h"
8 #include "base/task.h" 8 #include "base/task.h"
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 #include "remoting/base/constants.h" 10 #include "remoting/base/constants.h"
11 #include "remoting/base/encoder.h" 11 #include "remoting/base/encoder.h"
12 #include "remoting/base/encoder_verbatim.h" 12 #include "remoting/base/encoder_verbatim.h"
13 #include "remoting/base/encoder_vp8.h" 13 #include "remoting/base/encoder_vp8.h"
14 #include "remoting/base/encoder_zlib.h" 14 #include "remoting/base/encoder_zlib.h"
15 #include "remoting/host/chromoting_host_context.h" 15 #include "remoting/host/chromoting_host_context.h"
16 #include "remoting/host/capturer.h" 16 #include "remoting/host/capturer.h"
17 #include "remoting/host/host_config.h" 17 #include "remoting/host/host_config.h"
18 #include "remoting/host/host_stub_fake.h"
18 #include "remoting/host/session_manager.h" 19 #include "remoting/host/session_manager.h"
20 #include "remoting/protocol/connection_to_client.h"
21 #include "remoting/protocol/host_stub.h"
22 #include "remoting/protocol/input_stub.h"
23 #include "remoting/protocol/jingle_session_manager.h"
19 #include "remoting/protocol/session_config.h" 24 #include "remoting/protocol/session_config.h"
20 #include "remoting/protocol/jingle_session_manager.h"
21 #include "remoting/protocol/connection_to_client.h"
22 25
23 using remoting::protocol::ConnectionToClient; 26 using remoting::protocol::ConnectionToClient;
24 27
25 namespace remoting { 28 namespace remoting {
26 29
27 ChromotingHost::ChromotingHost(ChromotingHostContext* context, 30 ChromotingHost::ChromotingHost(ChromotingHostContext* context,
28 MutableHostConfig* config, 31 MutableHostConfig* config,
29 Capturer* capturer, 32 Capturer* capturer,
30 protocol::InputStub* input_stub) 33 protocol::InputStub* input_stub)
31 : context_(context), 34 : context_(context),
32 config_(config), 35 config_(config),
33 capturer_(capturer), 36 capturer_(capturer),
34 input_stub_(input_stub), 37 input_stub_(input_stub),
38 host_stub_(new HostStubFake()),
35 state_(kInitial) { 39 state_(kInitial) {
36 } 40 }
37 41
38 ChromotingHost::~ChromotingHost() { 42 ChromotingHost::~ChromotingHost() {
39 } 43 }
40 44
41 void ChromotingHost::Start(Task* shutdown_task) { 45 void ChromotingHost::Start(Task* shutdown_task) {
42 if (MessageLoop::current() != context_->main_message_loop()) { 46 if (MessageLoop::current() != context_->main_message_loop()) {
43 context_->main_message_loop()->PostTask( 47 context_->main_message_loop()->PostTask(
44 FROM_HERE, 48 FROM_HERE,
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 270
267 session->set_config(config); 271 session->set_config(config);
268 272
269 *response = protocol::SessionManager::ACCEPT; 273 *response = protocol::SessionManager::ACCEPT;
270 274
271 VLOG(1) << "Client connected: " << session->jid(); 275 VLOG(1) << "Client connected: " << session->jid();
272 276
273 // If we accept the connected then create a client object and set the 277 // If we accept the connected then create a client object and set the
274 // callback. 278 // callback.
275 connection_ = new ConnectionToClient(context_->main_message_loop(), 279 connection_ = new ConnectionToClient(context_->main_message_loop(),
276 this, NULL, input_stub_.get()); 280 this, host_stub_.get(),
281 input_stub_.get());
277 connection_->Init(session); 282 connection_->Init(session);
278 } 283 }
279 284
280 void ChromotingHost::OnServerClosed() { 285 void ChromotingHost::OnServerClosed() {
281 // Don't need to do anything here. 286 // Don't need to do anything here.
282 } 287 }
283 288
284 // TODO(sergeyu): Move this to SessionManager? 289 // TODO(sergeyu): Move this to SessionManager?
285 Encoder* ChromotingHost::CreateEncoder(const protocol::SessionConfig* config) { 290 Encoder* ChromotingHost::CreateEncoder(const protocol::SessionConfig* config) {
286 const protocol::ChannelConfig& video_config = config->video_config(); 291 const protocol::ChannelConfig& video_config = config->video_config();
287 292
288 if (video_config.codec == protocol::ChannelConfig::CODEC_VERBATIM) { 293 if (video_config.codec == protocol::ChannelConfig::CODEC_VERBATIM) {
289 return new remoting::EncoderVerbatim(); 294 return new remoting::EncoderVerbatim();
290 } else if (video_config.codec == protocol::ChannelConfig::CODEC_ZIP) { 295 } else if (video_config.codec == protocol::ChannelConfig::CODEC_ZIP) {
291 return new remoting::EncoderZlib(); 296 return new remoting::EncoderZlib();
292 } 297 }
293 // TODO(sergeyu): Enable VP8 on ARM builds. 298 // TODO(sergeyu): Enable VP8 on ARM builds.
294 #if !defined(ARCH_CPU_ARM_FAMILY) 299 #if !defined(ARCH_CPU_ARM_FAMILY)
295 else if (video_config.codec == protocol::ChannelConfig::CODEC_VP8) { 300 else if (video_config.codec == protocol::ChannelConfig::CODEC_VP8) {
296 return new remoting::EncoderVp8(); 301 return new remoting::EncoderVp8();
297 } 302 }
298 #endif 303 #endif
299 304
300 return NULL; 305 return NULL;
301 } 306 }
302 307
303 } // namespace remoting 308 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/chromoting_host.h ('k') | remoting/host/host_stub_fake.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698