Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(248)

Side by Side Diff: remoting/host/setup/start_host_main.cc

Issue 2049173003: Updating remoting_start_host to use remoting_core.dll (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 // A simple command-line app that registers and starts a host. 5 #include "remoting/host/setup/start_host_main.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdio.h> 8 #include <stdio.h>
9 9
10 #include "base/at_exit.h" 10 #include "base/at_exit.h"
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/run_loop.h" 12 #include "base/run_loop.h"
13 #include "base/strings/stringprintf.h" 13 #include "base/strings/stringprintf.h"
14 #include "base/threading/thread.h" 14 #include "base/threading/thread.h"
15 #include "build/build_config.h" 15 #include "build/build_config.h"
16 #include "net/url_request/url_fetcher.h" 16 #include "net/url_request/url_fetcher.h"
17 #include "net/url_request/url_request_context_getter.h" 17 #include "net/url_request/url_request_context_getter.h"
18 #include "remoting/base/logging.h" 18 #include "remoting/base/logging.h"
19 #include "remoting/base/url_request_context_getter.h" 19 #include "remoting/base/url_request_context_getter.h"
20 #include "remoting/host/service_urls.h" 20 #include "remoting/host/service_urls.h"
21 #include "remoting/host/setup/host_starter.h" 21 #include "remoting/host/setup/host_starter.h"
22 #include "remoting/host/setup/oauth_helper.h" 22 #include "remoting/host/setup/oauth_helper.h"
23 #include "remoting/host/setup/pin_validator.h" 23 #include "remoting/host/setup/pin_validator.h"
24 24
25 #if defined(OS_POSIX) 25 #if defined(OS_POSIX)
26 #include <termios.h> 26 #include <termios.h>
27 #include <unistd.h> 27 #include <unistd.h>
28 #endif // defined(OS_POSIX) 28 #endif // defined(OS_POSIX)
29 29
30 #if defined(OS_WIN) 30 #if defined(OS_WIN)
31 #include "remoting/host/win/elevation_helpers.h" 31 #include "remoting/host/win/elevation_helpers.h"
32 #endif // defined(OS_WIN) 32 #endif // defined(OS_WIN)
33 33
34 namespace {
35
34 using remoting::HostStarter; 36 using remoting::HostStarter;
Sergey Ulanov 2016/06/08 21:47:10 Wouldn't need this if this code was inside remotin
joedow 2016/06/09 04:17:52 Done.
35 37
36 // True if the host was started successfully. 38 // True if the host was started successfully.
37 bool g_started = false; 39 bool g_started = false;
38 40
39 // The main message loop. 41 // The main message loop.
40 base::MessageLoop* g_message_loop = nullptr; 42 base::MessageLoop* g_message_loop = nullptr;
41 43
42 // Lets us hide the PIN that a user types. 44 // Lets us hide the PIN that a user types.
43 void SetEcho(bool echo) { 45 void SetEcho(bool echo) {
44 #if defined(OS_WIN) 46 #if defined(OS_WIN)
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 break; 105 break;
104 } 106 }
105 107
106 g_message_loop->QuitNow(); 108 g_message_loop->QuitNow();
107 } 109 }
108 110
109 std::string GetAuthorizationCodeUri() { 111 std::string GetAuthorizationCodeUri() {
110 return remoting::GetOauthStartUrl(remoting::GetDefaultOauthRedirectUrl()); 112 return remoting::GetOauthStartUrl(remoting::GetDefaultOauthRedirectUrl());
111 } 113 }
112 114
113 int main(int argc, char** argv) { 115 } // namespace
116
117 namespace remoting {
Sergey Ulanov 2016/06/08 21:47:10 Move this before the anonymous namespace above, i.
joedow 2016/06/09 04:17:52 Done.
118
119 int StartHostMain(int argc, char** argv) {
114 // google_apis::GetOAuth2ClientID/Secret need a static CommandLine. 120 // google_apis::GetOAuth2ClientID/Secret need a static CommandLine.
115 base::CommandLine::Init(argc, argv); 121 base::CommandLine::Init(argc, argv);
116 const base::CommandLine* command_line = 122 const base::CommandLine* command_line =
117 base::CommandLine::ForCurrentProcess(); 123 base::CommandLine::ForCurrentProcess();
118 124
119 // This object instance is required by Chrome code (for example, 125 // This object instance is required by Chrome code (for example,
120 // FilePath, LazyInstance, MessageLoop). 126 // FilePath, LazyInstance, MessageLoop).
121 base::AtExitManager exit_manager; 127 base::AtExitManager exit_manager;
122 128
123 logging::LoggingSettings settings; 129 logging::LoggingSettings settings;
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 232
227 // Destroy the HostStarter and URLRequestContextGetter before stopping the 233 // Destroy the HostStarter and URLRequestContextGetter before stopping the
228 // IO thread. 234 // IO thread.
229 host_starter.reset(); 235 host_starter.reset();
230 url_request_context_getter = nullptr; 236 url_request_context_getter = nullptr;
231 237
232 io_thread.Stop(); 238 io_thread.Stop();
233 239
234 return g_started ? 0 : 1; 240 return g_started ? 0 : 1;
235 } 241 }
242
243 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698