| 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. |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 base::mac::ScopedNSAutoreleasePool pool; | 68 base::mac::ScopedNSAutoreleasePool pool; |
| 69 | 69 |
| 70 CommandLine::Init(argc, argv); | 70 CommandLine::Init(argc, argv); |
| 71 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); | 71 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); |
| 72 | 72 |
| 73 base::AtExitManager exit_manager; | 73 base::AtExitManager exit_manager; |
| 74 | 74 |
| 75 base::EnsureNSPRInit(); | 75 base::EnsureNSPRInit(); |
| 76 | 76 |
| 77 scoped_ptr<remoting::Capturer> capturer; | 77 scoped_ptr<remoting::Capturer> capturer; |
| 78 scoped_ptr<remoting::EventExecutor> event_handler; | 78 scoped_ptr<remoting::protocol::InputStub> input_stub; |
| 79 #if defined(OS_WIN) | 79 #if defined(OS_WIN) |
| 80 capturer.reset(new remoting::CapturerGdi()); | 80 capturer.reset(new remoting::CapturerGdi()); |
| 81 event_handler.reset(new remoting::EventExecutorWin(capturer.get())); | 81 input_stub.reset(new remoting::EventExecutorWin(capturer.get())); |
| 82 #elif defined(OS_LINUX) | 82 #elif defined(OS_LINUX) |
| 83 capturer.reset(new remoting::CapturerLinux()); | 83 capturer.reset(new remoting::CapturerLinux()); |
| 84 event_handler.reset(new remoting::EventExecutorLinux(capturer.get())); | 84 input_stub.reset(new remoting::EventExecutorLinux(capturer.get())); |
| 85 #elif defined(OS_MACOSX) | 85 #elif defined(OS_MACOSX) |
| 86 capturer.reset(new remoting::CapturerMac()); | 86 capturer.reset(new remoting::CapturerMac()); |
| 87 event_handler.reset(new remoting::EventExecutorMac(capturer.get())); | 87 input_stub.reset(new remoting::EventExecutorMac(capturer.get())); |
| 88 #endif | 88 #endif |
| 89 | 89 |
| 90 // Check the argument to see if we should use a fake capturer. | 90 // Check the argument to see if we should use a fake capturer. |
| 91 bool fake = cmd_line->HasSwitch(kFakeSwitchName); | 91 bool fake = cmd_line->HasSwitch(kFakeSwitchName); |
| 92 | 92 |
| 93 #if defined(OS_WIN) | 93 #if defined(OS_WIN) |
| 94 std::wstring home_path = GetEnvironmentVar(kHomeDrive); | 94 std::wstring home_path = GetEnvironmentVar(kHomeDrive); |
| 95 home_path += GetEnvironmentVar(kHomePath); | 95 home_path += GetEnvironmentVar(kHomePath); |
| 96 #else | 96 #else |
| 97 std::string home_path = GetEnvironmentVar(base::env_vars::kHome); | 97 std::string home_path = GetEnvironmentVar(base::env_vars::kHome); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 127 FilePath module_path; | 127 FilePath module_path; |
| 128 PathService::Get(base::DIR_MODULE, &module_path); | 128 PathService::Get(base::DIR_MODULE, &module_path); |
| 129 CHECK(media::InitializeMediaLibrary(module_path)) | 129 CHECK(media::InitializeMediaLibrary(module_path)) |
| 130 << "Cannot load media library"; | 130 << "Cannot load media library"; |
| 131 | 131 |
| 132 // Construct a chromoting host. | 132 // Construct a chromoting host. |
| 133 scoped_refptr<remoting::ChromotingHost> host( | 133 scoped_refptr<remoting::ChromotingHost> host( |
| 134 new remoting::ChromotingHost(&context, | 134 new remoting::ChromotingHost(&context, |
| 135 config, | 135 config, |
| 136 capturer.release(), | 136 capturer.release(), |
| 137 event_handler.release())); | 137 input_stub.release())); |
| 138 | 138 |
| 139 // Let the chromoting host run until the shutdown task is executed. | 139 // Let the chromoting host run until the shutdown task is executed. |
| 140 MessageLoop message_loop(MessageLoop::TYPE_UI); | 140 MessageLoop message_loop(MessageLoop::TYPE_UI); |
| 141 host->Start(NewRunnableFunction(&ShutdownTask, &message_loop)); | 141 host->Start(NewRunnableFunction(&ShutdownTask, &message_loop)); |
| 142 message_loop.Run(); | 142 message_loop.Run(); |
| 143 | 143 |
| 144 // And then stop the chromoting context. | 144 // And then stop the chromoting context. |
| 145 context.Stop(); | 145 context.Stop(); |
| 146 file_io_thread.Stop(); | 146 file_io_thread.Stop(); |
| 147 return 0; | 147 return 0; |
| 148 } | 148 } |
| OLD | NEW |