zijiehe | dd0b05c | 2016-05-05 18:44:15 | [diff] [blame] | 1 | // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include "base/at_exit.h" |
| 6 | #include "base/command_line.h" |
| 7 | #include "base/logging.h" |
| 8 | #include "remoting/host/resources.h" |
| 9 | #include "remoting/proto/event.pb.h" |
| 10 | #include "remoting/test/it2me_standalone_host.h" |
| 11 | |
| 12 | #if defined(OS_LINUX) |
| 13 | #include <gtk/gtk.h> |
zijiehe | dd0b05c | 2016-05-05 18:44:15 | [diff] [blame] | 14 | |
| 15 | #include "base/linux_util.h" |
Daniel Bratell | b40fc33 | 2017-12-04 10:28:21 | [diff] [blame] | 16 | #include "ui/gfx/x/x11.h" |
zijiehe | dd0b05c | 2016-05-05 18:44:15 | [diff] [blame] | 17 | #endif // defined(OS_LINUX) |
| 18 | |
| 19 | int main(int argc, const char** argv) { |
| 20 | base::AtExitManager at_exit_manager; |
| 21 | base::CommandLine::Init(argc, argv); |
| 22 | remoting::test::It2MeStandaloneHost host; |
| 23 | |
| 24 | #if defined(OS_LINUX) |
| 25 | // Required in order for us to run multiple X11 threads. |
| 26 | XInitThreads(); |
| 27 | |
| 28 | // Required for any calls into GTK functions, such as the Disconnect and |
| 29 | // Continue windows. Calling with nullptr arguments because we don't have |
| 30 | // any command line arguments for gtk to consume. |
Tom Anderson | afb0660 | 2018-08-23 23:13:09 | [diff] [blame] | 31 | #if GTK_CHECK_VERSION(3, 90, 0) |
| 32 | gtk_init(); |
| 33 | #else |
zijiehe | dd0b05c | 2016-05-05 18:44:15 | [diff] [blame] | 34 | gtk_init(nullptr, nullptr); |
Tom Anderson | afb0660 | 2018-08-23 23:13:09 | [diff] [blame] | 35 | #endif |
zijiehe | dd0b05c | 2016-05-05 18:44:15 | [diff] [blame] | 36 | |
| 37 | // Need to prime the host OS version value for linux to prevent IO on the |
| 38 | // network thread. base::GetLinuxDistro() caches the result. |
| 39 | base::GetLinuxDistro(); |
| 40 | #endif // OS_LINUX |
| 41 | remoting::LoadResources(""); |
| 42 | host.StartOutputTimer(); |
| 43 | host.Run(); |
| 44 | } |