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

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

Issue 2749004: Token-based authentication for chromoting. (Closed)
Patch Set: - Created 10 years, 6 months 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
« no previous file with comments | « remoting/host/simple_host.cc ('k') | remoting/jingle_glue/jingle_client.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 // 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
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 password. 78 // Prompt user for username and auth token.
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 password; 82 std::string auth_token;
83 SetConsoleEcho(false); 83 std::cout << "Auth Token: ";
84 std::cout << "Password: "; 84 std::cin >> auth_token;
85 std::cin >> password;
86 SetConsoleEcho(true);
87 std::cout << std::endl;
88 85
89 scoped_ptr<remoting::Capturer> capturer; 86 scoped_ptr<remoting::Capturer> capturer;
90 scoped_ptr<remoting::Encoder> encoder; 87 scoped_ptr<remoting::Encoder> encoder;
91 scoped_ptr<remoting::EventExecutor> executor; 88 scoped_ptr<remoting::EventExecutor> executor;
92 #if defined(OS_WIN) 89 #if defined(OS_WIN)
93 capturer.reset(new remoting::CapturerGdi()); 90 capturer.reset(new remoting::CapturerGdi());
94 executor.reset(new remoting::EventExecutorWin()); 91 executor.reset(new remoting::EventExecutorWin());
95 #elif defined(OS_LINUX) 92 #elif defined(OS_LINUX)
96 capturer.reset(new remoting::CapturerLinux()); 93 capturer.reset(new remoting::CapturerLinux());
97 executor.reset(new remoting::EventExecutorLinux()); 94 executor.reset(new remoting::EventExecutorLinux());
98 #elif defined(OS_MAC) 95 #elif defined(OS_MAC)
99 capturer.reset(new remoting::CapturerMac()); 96 capturer.reset(new remoting::CapturerMac());
100 executor.reset(new remoting::EventExecutorMac()); 97 executor.reset(new remoting::EventExecutorMac());
101 #endif 98 #endif
102 encoder.reset(new remoting::EncoderVerbatim()); 99 encoder.reset(new remoting::EncoderVerbatim());
103 100
104 if (fake) { 101 if (fake) {
105 // Inject a fake capturer. 102 // Inject a fake capturer.
106 capturer.reset(new remoting::CapturerFake()); 103 capturer.reset(new remoting::CapturerFake());
107 } 104 }
108 105
109 // Construct a simple host with username and password. 106 // Construct a simple host with username and auth_token.
110 // TODO(hclam): Allow the host to load saved credentials. 107 // TODO(hclam): Allow the host to load saved credentials.
111 scoped_refptr<remoting::SimpleHost> host 108 scoped_refptr<remoting::SimpleHost> host
112 = new remoting::SimpleHost(username, password, 109 = new remoting::SimpleHost(username, auth_token,
113 capturer.release(), 110 capturer.release(),
114 encoder.release(), 111 encoder.release(),
115 executor.release()); 112 executor.release());
116 host->Run(); 113 host->Run();
117 return 0; 114 return 0;
118 } 115 }
OLDNEW
« no previous file with comments | « remoting/host/simple_host.cc ('k') | remoting/jingle_glue/jingle_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698