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. |
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/environment.h" | 23 #include "base/environment.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/mac/scoped_nsautorelease_pool.h" | 26 #include "base/mac/scoped_nsautorelease_pool.h" |
27 #include "base/nss_util.h" | |
28 #include "base/path_service.h" | 27 #include "base/path_service.h" |
29 #include "base/test/mock_chrome_application_mac.h" | 28 #include "base/test/mock_chrome_application_mac.h" |
30 #include "base/threading/thread.h" | 29 #include "base/threading/thread.h" |
| 30 #include "crypto/nss_util.h" |
31 #include "media/base/media.h" | 31 #include "media/base/media.h" |
32 #include "remoting/base/tracer.h" | 32 #include "remoting/base/tracer.h" |
33 #include "remoting/host/capturer_fake.h" | 33 #include "remoting/host/capturer_fake.h" |
34 #include "remoting/host/chromoting_host.h" | 34 #include "remoting/host/chromoting_host.h" |
35 #include "remoting/host/chromoting_host_context.h" | 35 #include "remoting/host/chromoting_host_context.h" |
36 #include "remoting/host/curtain.h" | 36 #include "remoting/host/curtain.h" |
37 #include "remoting/host/desktop_environment.h" | 37 #include "remoting/host/desktop_environment.h" |
38 #include "remoting/host/event_executor.h" | 38 #include "remoting/host/event_executor.h" |
39 #include "remoting/host/json_host_config.h" | 39 #include "remoting/host/json_host_config.h" |
40 #include "remoting/proto/video.pb.h" | 40 #include "remoting/proto/video.pb.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 | 76 |
77 | 77 |
78 int main(int argc, char** argv) { | 78 int main(int argc, char** argv) { |
79 // Needed for the Mac, so we don't leak objects when threads are created. | 79 // Needed for the Mac, so we don't leak objects when threads are created. |
80 base::mac::ScopedNSAutoreleasePool pool; | 80 base::mac::ScopedNSAutoreleasePool pool; |
81 | 81 |
82 CommandLine::Init(argc, argv); | 82 CommandLine::Init(argc, argv); |
83 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); | 83 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); |
84 | 84 |
85 base::AtExitManager exit_manager; | 85 base::AtExitManager exit_manager; |
86 base::EnsureNSPRInit(); | 86 crypto::EnsureNSPRInit(); |
87 | 87 |
88 // Allocate a chromoting context and starts it. | 88 // Allocate a chromoting context and starts it. |
89 #if defined(TOOLKIT_USES_GTK) | 89 #if defined(TOOLKIT_USES_GTK) |
90 gfx::GtkInitFromCommandLine(*cmd_line); | 90 gfx::GtkInitFromCommandLine(*cmd_line); |
91 #endif | 91 #endif |
92 MessageLoopForUI message_loop; | 92 MessageLoopForUI message_loop; |
93 remoting::ChromotingHostContext context(&message_loop); | 93 remoting::ChromotingHostContext context(&message_loop); |
94 context.Start(); | 94 context.Start(); |
95 | 95 |
96 | 96 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 | 174 |
175 // Let the chromoting host run until the shutdown task is executed. | 175 // Let the chromoting host run until the shutdown task is executed. |
176 host->Start(NewRunnableFunction(&ShutdownTask, &message_loop)); | 176 host->Start(NewRunnableFunction(&ShutdownTask, &message_loop)); |
177 message_loop.MessageLoop::Run(); | 177 message_loop.MessageLoop::Run(); |
178 | 178 |
179 // And then stop the chromoting context. | 179 // And then stop the chromoting context. |
180 context.Stop(); | 180 context.Stop(); |
181 file_io_thread.Stop(); | 181 file_io_thread.Stop(); |
182 return 0; | 182 return 0; |
183 } | 183 } |
OLD | NEW |