1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// This file implements a simple X11 chromoting client.
#include <iostream>
#include "base/at_exit.h"
#include "remoting/client/chromoting_client.h"
#include "remoting/client/client_config.h"
#include "remoting/client/client_util.h"
#include "remoting/client/jingle_host_connection.h"
#include "remoting/client/rectangle_update_decoder.h"
#include "remoting/client/x11_view.h"
#include "remoting/client/x11_input_handler.h"
void ClientQuit(MessageLoop* loop) {
loop->PostTask(FROM_HERE, new MessageLoop::QuitTask());
}
int main(int argc, char** argv) {
base::AtExitManager at_exit;
remoting::ClientConfig config;
if (!remoting::GetLoginInfoFromArgs(argc, argv, &config)) {
std::cout << "Unable to obtain login info" << std::endl;
return 1;
}
MessageLoop ui_loop;
remoting::ClientContext context;
remoting::JingleHostConnection connection(&context);
remoting::X11View view;
remoting::RectangleUpdateDecoder rectangle_decoder(
context.decode_message_loop(), &view);
remoting::X11InputHandler input_handler(&context, &connection, &view);
remoting::ChromotingClient client(
config, &context, &connection, &view, &rectangle_decoder, &input_handler,
NewRunnableFunction(&ClientQuit, &ui_loop));
// Run the client on a new MessageLoop until
context.Start();
client.Start();
ui_loop.Run();
client.Stop();
context.Stop();
return 0;
}
|