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 file implements a simple X11 chromoting client. | 5 // This file implements a simple X11 chromoting client. |
6 | 6 |
7 #include <iostream> | 7 #include <iostream> |
8 | 8 |
9 #include "base/at_exit.h" | 9 #include "base/at_exit.h" |
10 #include "remoting/client/chromoting_client.h" | 10 #include "remoting/client/chromoting_client.h" |
11 #include "remoting/client/client_config.h" | 11 #include "remoting/client/client_config.h" |
12 #include "remoting/client/client_util.h" | 12 #include "remoting/client/client_util.h" |
13 #include "remoting/client/jingle_host_connection.h" | 13 #include "remoting/client/jingle_host_connection.h" |
| 14 #include "remoting/client/rectangle_update_decoder.h" |
14 #include "remoting/client/x11_view.h" | 15 #include "remoting/client/x11_view.h" |
15 #include "remoting/client/x11_input_handler.h" | 16 #include "remoting/client/x11_input_handler.h" |
16 | 17 |
17 void ClientQuit(MessageLoop* loop) { | 18 void ClientQuit(MessageLoop* loop) { |
18 loop->PostTask(FROM_HERE, new MessageLoop::QuitTask()); | 19 loop->PostTask(FROM_HERE, new MessageLoop::QuitTask()); |
19 } | 20 } |
20 | 21 |
21 int main(int argc, char** argv) { | 22 int main(int argc, char** argv) { |
22 base::AtExitManager at_exit; | 23 base::AtExitManager at_exit; |
23 | 24 |
24 remoting::ClientConfig config; | 25 remoting::ClientConfig config; |
25 if (!remoting::GetLoginInfoFromArgs(argc, argv, &config)) { | 26 if (!remoting::GetLoginInfoFromArgs(argc, argv, &config)) { |
26 std::cout << "Unable to obtain login info" << std::endl; | 27 std::cout << "Unable to obtain login info" << std::endl; |
27 return 1; | 28 return 1; |
28 } | 29 } |
29 | 30 |
30 MessageLoop ui_loop; | 31 MessageLoop ui_loop; |
31 remoting::ClientContext context; | 32 remoting::ClientContext context; |
32 remoting::JingleHostConnection connection(&context); | 33 remoting::JingleHostConnection connection(&context); |
33 remoting::X11View view; | 34 remoting::X11View view; |
| 35 remoting::RectangleUpdateDecoder rectangle_decoder( |
| 36 context.decode_message_loop(), &view); |
34 remoting::X11InputHandler input_handler(&context, &connection, &view); | 37 remoting::X11InputHandler input_handler(&context, &connection, &view); |
35 remoting::ChromotingClient client(config, &context, &connection, &view, | 38 remoting::ChromotingClient client( |
36 &input_handler, NewRunnableFunction(&ClientQuit, &ui_loop)); | 39 config, &context, &connection, &view, &rectangle_decoder, &input_handler, |
| 40 NewRunnableFunction(&ClientQuit, &ui_loop)); |
37 | 41 |
38 // Run the client on a new MessageLoop until | 42 // Run the client on a new MessageLoop until |
39 context.Start(); | 43 context.Start(); |
40 client.Start(); | 44 client.Start(); |
41 ui_loop.Run(); | 45 ui_loop.Run(); |
42 | 46 |
43 client.Stop(); | 47 client.Stop(); |
44 context.Stop(); | 48 context.Stop(); |
45 | 49 |
46 return 0; | 50 return 0; |
47 } | 51 } |
OLD | NEW |