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 | 68 |
69 int main(int argc, char** argv) { | 69 int main(int argc, char** argv) { |
70 base::AtExitManager exit_manager; | 70 base::AtExitManager exit_manager; |
71 | 71 |
72 // Check the argument to see if we should use a fake capturer and encoder. | 72 // Check the argument to see if we should use a fake capturer and encoder. |
73 bool fake = false; | 73 bool fake = false; |
74 if (argc > 1 && std::string(argv[1]) == "--fake") { | 74 if (argc > 1 && std::string(argv[1]) == "--fake") { |
75 fake = true; | 75 fake = true; |
76 } | 76 } |
77 | 77 |
78 // Prompt user for username and auth token. | 78 // Prompt user for username and password. |
79 std::string username; | 79 std::string username; |
80 std::cout << "JID: "; | 80 std::cout << "JID: "; |
81 std::cin >> username; | 81 std::cin >> username; |
82 std::string auth_token; | 82 std::string password; |
83 std::cout << "Auth Token: "; | 83 SetConsoleEcho(false); |
84 std::cin >> auth_token; | 84 std::cout << "Password: "; |
| 85 std::cin >> password; |
| 86 SetConsoleEcho(true); |
| 87 std::cout << std::endl; |
85 | 88 |
86 scoped_ptr<remoting::Capturer> capturer; | 89 scoped_ptr<remoting::Capturer> capturer; |
87 scoped_ptr<remoting::Encoder> encoder; | 90 scoped_ptr<remoting::Encoder> encoder; |
88 scoped_ptr<remoting::EventExecutor> executor; | 91 scoped_ptr<remoting::EventExecutor> executor; |
89 #if defined(OS_WIN) | 92 #if defined(OS_WIN) |
90 capturer.reset(new remoting::CapturerGdi()); | 93 capturer.reset(new remoting::CapturerGdi()); |
91 executor.reset(new remoting::EventExecutorWin()); | 94 executor.reset(new remoting::EventExecutorWin()); |
92 #elif defined(OS_LINUX) | 95 #elif defined(OS_LINUX) |
93 capturer.reset(new remoting::CapturerLinux()); | 96 capturer.reset(new remoting::CapturerLinux()); |
94 executor.reset(new remoting::EventExecutorLinux()); | 97 executor.reset(new remoting::EventExecutorLinux()); |
95 #elif defined(OS_MAC) | 98 #elif defined(OS_MAC) |
96 capturer.reset(new remoting::CapturerMac()); | 99 capturer.reset(new remoting::CapturerMac()); |
97 executor.reset(new remoting::EventExecutorMac()); | 100 executor.reset(new remoting::EventExecutorMac()); |
98 #endif | 101 #endif |
99 encoder.reset(new remoting::EncoderVerbatim()); | 102 encoder.reset(new remoting::EncoderVerbatim()); |
100 | 103 |
101 if (fake) { | 104 if (fake) { |
102 // Inject a fake capturer. | 105 // Inject a fake capturer. |
103 capturer.reset(new remoting::CapturerFake()); | 106 capturer.reset(new remoting::CapturerFake()); |
104 } | 107 } |
105 | 108 |
106 // Construct a simple host with username and auth_token. | 109 // Construct a simple host with username and password. |
107 // TODO(hclam): Allow the host to load saved credentials. | 110 // TODO(hclam): Allow the host to load saved credentials. |
108 scoped_refptr<remoting::SimpleHost> host | 111 scoped_refptr<remoting::SimpleHost> host |
109 = new remoting::SimpleHost(username, auth_token, | 112 = new remoting::SimpleHost(username, password, |
110 capturer.release(), | 113 capturer.release(), |
111 encoder.release(), | 114 encoder.release(), |
112 executor.release()); | 115 executor.release()); |
113 host->Run(); | 116 host->Run(); |
114 return 0; | 117 return 0; |
115 } | 118 } |
OLD | NEW |