OLD | NEW |
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 // 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. |
11 // 2. Accepts connection through libjingle. | 11 // 2. Accepts connection through libjingle. |
12 // 3. Receive mouse / keyboard events through libjingle. | 12 // 3. Receive mouse / keyboard events through libjingle. |
13 // 4. Sends screen capture through libjingle. | 13 // 4. Sends screen capture through libjingle. |
14 | 14 |
15 #include <iostream> | 15 #include <iostream> |
16 #include <string> | 16 #include <string> |
17 #include <stdlib.h> | 17 #include <stdlib.h> |
18 | 18 |
19 #include "build/build_config.h" | 19 #include "build/build_config.h" |
20 | 20 |
21 #include "base/at_exit.h" | 21 #include "base/at_exit.h" |
22 #include "base/command_line.h" | 22 #include "base/command_line.h" |
23 #include "base/env_var.h" | 23 #include "base/env_var.h" |
24 #include "base/file_path.h" | 24 #include "base/file_path.h" |
25 #include "base/logging.h" | 25 #include "base/logging.h" |
26 #include "base/nss_util.h" | 26 #include "base/nss_util.h" |
27 #include "base/scoped_nsautorelease_pool.h" | 27 #include "base/scoped_nsautorelease_pool.h" |
28 #include "base/thread.h" | 28 #include "base/thread.h" |
29 #include "remoting/base/encoder_verbatim.h" | 29 #include "remoting/base/encoder_zlib.h" |
30 #include "remoting/host/capturer_fake.h" | 30 #include "remoting/host/capturer_fake.h" |
31 #include "remoting/host/chromoting_host.h" | 31 #include "remoting/host/chromoting_host.h" |
32 #include "remoting/host/chromoting_host_context.h" | 32 #include "remoting/host/chromoting_host_context.h" |
33 #include "remoting/host/json_host_config.h" | 33 #include "remoting/host/json_host_config.h" |
34 | 34 |
35 #if defined(OS_WIN) | 35 #if defined(OS_WIN) |
36 #include "remoting/host/capturer_gdi.h" | 36 #include "remoting/host/capturer_gdi.h" |
37 #include "remoting/host/event_executor_win.h" | 37 #include "remoting/host/event_executor_win.h" |
38 #elif defined(OS_LINUX) | 38 #elif defined(OS_LINUX) |
39 #include "remoting/host/capturer_linux.h" | 39 #include "remoting/host/capturer_linux.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 #if defined(OS_WIN) | 77 #if defined(OS_WIN) |
78 capturer.reset(new remoting::CapturerGdi()); | 78 capturer.reset(new remoting::CapturerGdi()); |
79 executor.reset(new remoting::EventExecutorWin()); | 79 executor.reset(new remoting::EventExecutorWin()); |
80 #elif defined(OS_LINUX) | 80 #elif defined(OS_LINUX) |
81 capturer.reset(new remoting::CapturerLinux()); | 81 capturer.reset(new remoting::CapturerLinux()); |
82 executor.reset(new remoting::EventExecutorLinux()); | 82 executor.reset(new remoting::EventExecutorLinux()); |
83 #elif defined(OS_MACOSX) | 83 #elif defined(OS_MACOSX) |
84 capturer.reset(new remoting::CapturerMac()); | 84 capturer.reset(new remoting::CapturerMac()); |
85 executor.reset(new remoting::EventExecutorMac()); | 85 executor.reset(new remoting::EventExecutorMac()); |
86 #endif | 86 #endif |
87 encoder.reset(new remoting::EncoderVerbatim()); | 87 encoder.reset(new remoting::EncoderZlib()); |
88 | 88 |
89 // Check the argument to see if we should use a fake capturer and encoder. | 89 // Check the argument to see if we should use a fake capturer and encoder. |
90 bool fake = cmd_line->HasSwitch(kFakeSwitchName); | 90 bool fake = cmd_line->HasSwitch(kFakeSwitchName); |
91 | 91 |
92 #if defined(OS_WIN) | 92 #if defined(OS_WIN) |
93 std::wstring path = GetEnvironmentVar(kHomeDrive); | 93 std::wstring path = GetEnvironmentVar(kHomeDrive); |
94 path += GetEnvironmentVar(kHomePath); | 94 path += GetEnvironmentVar(kHomePath); |
95 #else | 95 #else |
96 std::string path = GetEnvironmentVar(base::env_vars::kHome); | 96 std::string path = GetEnvironmentVar(base::env_vars::kHome); |
97 #endif | 97 #endif |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 // Let the chromoting host runs until the shutdown task is executed. | 134 // Let the chromoting host runs until the shutdown task is executed. |
135 MessageLoop message_loop(MessageLoop::TYPE_UI); | 135 MessageLoop message_loop(MessageLoop::TYPE_UI); |
136 host->Start(NewRunnableFunction(&ShutdownTask, &message_loop)); | 136 host->Start(NewRunnableFunction(&ShutdownTask, &message_loop)); |
137 message_loop.Run(); | 137 message_loop.Run(); |
138 | 138 |
139 // And then stop the chromoting context. | 139 // And then stop the chromoting context. |
140 context.Stop(); | 140 context.Stop(); |
141 file_io_thread.Stop(); | 141 file_io_thread.Stop(); |
142 return 0; | 142 return 0; |
143 } | 143 } |
OLD | NEW |