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

Unified Diff: remoting/host/setup/start_host.cc

Issue 471243002: Enable start_host compilation on Windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | remoting/remoting_host.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/setup/start_host.cc
diff --git a/remoting/host/setup/start_host.cc b/remoting/host/setup/start_host.cc
index 99580418dad8556dc55de9be0656b0f2bf87931c..efca68f13b2dacaea1cb10da3c36f0bd3b047942 100644
--- a/remoting/host/setup/start_host.cc
+++ b/remoting/host/setup/start_host.cc
@@ -1,9 +1,10 @@
// Copyright (c) 2012 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.
+//
+// A simple command-line app that registers and starts a host.
#include <stdio.h>
-#include <termios.h>
#include "base/at_exit.h"
#include "base/command_line.h"
@@ -18,7 +19,9 @@
#include "remoting/host/setup/oauth_helper.h"
#include "remoting/host/setup/pin_validator.h"
-// A simple command-line app that registers and starts a host.
+#if !defined(OS_WIN)
+#include <termios.h>
+#endif // !defined(OS_WIN)
using remoting::HostStarter;
@@ -30,6 +33,16 @@ base::MessageLoop* g_message_loop = NULL;
// Lets us hide the PIN that a user types.
void SetEcho(bool echo) {
+#if defined(OS_WIN)
+ DWORD mode;
+ HANDLE console_handle = GetStdHandle(STD_INPUT_HANDLE);
+ if (!GetConsoleMode(console_handle, &mode)) {
+ LOG(ERROR) << "GetConsoleMode failed";
+ return;
+ }
+ SetConsoleMode(console_handle,
+ (mode & ~ENABLE_ECHO_INPUT) | (echo ? ENABLE_ECHO_INPUT : 0));
+#else
termios term;
tcgetattr(STDIN_FILENO, &term);
if (echo) {
@@ -38,6 +51,7 @@ void SetEcho(bool echo) {
term.c_lflag &= ~ECHO;
}
tcsetattr(STDIN_FILENO, TCSANOW, &term);
+#endif // !defined(OS_WIN)
}
// Reads a newline-terminated string from stdin.
« no previous file with comments | « no previous file | remoting/remoting_host.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698