OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include <stdio.h> | 5 #include <stdio.h> |
6 #include <termios.h> | 6 #include <termios.h> |
7 | 7 |
8 #include "base/at_exit.h" | 8 #include "base/at_exit.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
11 #include "base/stringprintf.h" | 11 #include "base/stringprintf.h" |
12 #include "base/threading/thread.h" | 12 #include "base/threading/thread.h" |
13 #include "google_apis/gaia/gaia_urls.h" | 13 #include "google_apis/gaia/gaia_urls.h" |
14 #include "net/url_request/url_fetcher.h" | 14 #include "net/url_request/url_fetcher.h" |
15 #include "net/url_request/url_request_context_getter.h" | 15 #include "net/url_request/url_request_context_getter.h" |
16 #include "remoting/host/service_urls.h" | 16 #include "remoting/host/service_urls.h" |
17 #include "remoting/host/setup/host_starter.h" | 17 #include "remoting/host/setup/host_starter.h" |
18 #include "remoting/host/setup/oauth_helper.h" | 18 #include "remoting/host/setup/oauth_helper.h" |
19 #include "remoting/host/setup/pin_validator.h" | 19 #include "remoting/host/setup/pin_validator.h" |
20 #include "remoting/host/url_request_context.h" | 20 #include "remoting/host/url_request_context.h" |
21 | 21 |
22 // A simple command-line app that registers and starts a host. | 22 // A simple command-line app that registers and starts a host. |
23 | 23 |
24 using remoting::HostStarter; | 24 using remoting::HostStarter; |
25 | 25 |
26 // True if the host was started successfully. | 26 // True if the host was started successfully. |
27 bool g_started = false; | 27 bool g_started = false; |
28 | 28 |
29 // The main message loop. | 29 // The main message loop. |
30 MessageLoop* g_message_loop = NULL; | 30 base::MessageLoop* g_message_loop = NULL; |
31 | 31 |
32 // Lets us hide the PIN that a user types. | 32 // Lets us hide the PIN that a user types. |
33 void SetEcho(bool echo) { | 33 void SetEcho(bool echo) { |
34 termios term; | 34 termios term; |
35 tcgetattr(STDIN_FILENO, &term); | 35 tcgetattr(STDIN_FILENO, &term); |
36 if (echo) { | 36 if (echo) { |
37 term.c_lflag |= ECHO; | 37 term.c_lflag |= ECHO; |
38 } else { | 38 } else { |
39 term.c_lflag &= ~ECHO; | 39 term.c_lflag &= ~ECHO; |
40 } | 40 } |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 | 178 |
179 // Destroy the HostStarter and URLRequestContextGetter before stopping the | 179 // Destroy the HostStarter and URLRequestContextGetter before stopping the |
180 // IO thread. | 180 // IO thread. |
181 host_starter.reset(); | 181 host_starter.reset(); |
182 url_request_context_getter = NULL; | 182 url_request_context_getter = NULL; |
183 | 183 |
184 io_thread.Stop(); | 184 io_thread.Stop(); |
185 | 185 |
186 return g_started ? 0 : 1; | 186 return g_started ? 0 : 1; |
187 } | 187 } |
OLD | NEW |