OLD | NEW |
1 // Copyright (c) 2010 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 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 "base/message_loop.h" | 10 #include "base/message_loop.h" |
11 #include "remoting/client/chromoting_client.h" | 11 #include "remoting/client/chromoting_client.h" |
12 #include "remoting/client/client_config.h" | 12 #include "remoting/client/client_config.h" |
13 #include "remoting/client/client_context.h" | 13 #include "remoting/client/client_context.h" |
| 14 #include "remoting/client/client_logger.h" |
14 #include "remoting/client/client_util.h" | 15 #include "remoting/client/client_util.h" |
15 #include "remoting/client/rectangle_update_decoder.h" | 16 #include "remoting/client/rectangle_update_decoder.h" |
16 #include "remoting/client/x11_view.h" | 17 #include "remoting/client/x11_view.h" |
17 #include "remoting/client/x11_input_handler.h" | 18 #include "remoting/client/x11_input_handler.h" |
18 #include "remoting/protocol/connection_to_host.h" | 19 #include "remoting/protocol/connection_to_host.h" |
19 | 20 |
20 void ClientQuit(MessageLoop* loop) { | 21 void ClientQuit(MessageLoop* loop) { |
21 loop->PostTask(FROM_HERE, new MessageLoop::QuitTask()); | 22 loop->PostTask(FROM_HERE, new MessageLoop::QuitTask()); |
22 } | 23 } |
23 | 24 |
(...skipping 10 matching lines...) Expand all Loading... |
34 remoting::ClientContext context; | 35 remoting::ClientContext context; |
35 remoting::protocol::ConnectionToHost connection(context.jingle_thread(), | 36 remoting::protocol::ConnectionToHost connection(context.jingle_thread(), |
36 NULL, NULL, NULL); | 37 NULL, NULL, NULL); |
37 remoting::X11View view; | 38 remoting::X11View view; |
38 scoped_refptr<remoting::RectangleUpdateDecoder> rectangle_decoder = | 39 scoped_refptr<remoting::RectangleUpdateDecoder> rectangle_decoder = |
39 new remoting::RectangleUpdateDecoder(context.decode_message_loop(), | 40 new remoting::RectangleUpdateDecoder(context.decode_message_loop(), |
40 &view); | 41 &view); |
41 remoting::X11InputHandler input_handler(&context, &connection, &view); | 42 remoting::X11InputHandler input_handler(&context, &connection, &view); |
42 remoting::ChromotingClient client( | 43 remoting::ChromotingClient client( |
43 config, &context, &connection, &view, rectangle_decoder, &input_handler, | 44 config, &context, &connection, &view, rectangle_decoder, &input_handler, |
44 NewRunnableFunction(&ClientQuit, &ui_loop)); | 45 new remoting::ClientLogger(), NewRunnableFunction(&ClientQuit, &ui_loop)); |
45 | 46 |
46 // Run the client on a new MessageLoop until | 47 // Run the client on a new MessageLoop until |
47 context.Start(); | 48 context.Start(); |
48 client.Start(); | 49 client.Start(); |
49 ui_loop.Run(); | 50 ui_loop.Run(); |
50 | 51 |
51 client.Stop(); | 52 client.Stop(); |
52 context.Stop(); | 53 context.Stop(); |
53 | 54 |
54 return 0; | 55 return 0; |
55 } | 56 } |
OLD | NEW |