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

Unified Diff: remoting/host/remoting_me2me_host.cc

Issue 10913260: Cleanups in Chromoting Host. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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
Index: remoting/host/remoting_me2me_host.cc
diff --git a/remoting/host/remoting_me2me_host.cc b/remoting/host/remoting_me2me_host.cc
index 1e518af2dbf6c976db7cae98cb99b56c11b58845..020f2003a7bbaf43477debacf2f762b7be89e2a3 100644
--- a/remoting/host/remoting_me2me_host.cc
+++ b/remoting/host/remoting_me2me_host.cc
@@ -37,7 +37,6 @@
#include "remoting/host/chromoting_host_context.h"
#include "remoting/host/chromoting_messages.h"
#include "remoting/host/config_file_watcher.h"
-#include "remoting/host/constants.h"
#include "remoting/host/config_file_watcher.h"
#include "remoting/host/desktop_environment_factory.h"
#include "remoting/host/dns_blackhole_checker.h"
@@ -45,6 +44,7 @@
#include "remoting/host/heartbeat_sender.h"
#include "remoting/host/host_config.h"
#include "remoting/host/host_event_logger.h"
+#include "remoting/host/host_exit_codes.h"
#include "remoting/host/host_user_interface.h"
#include "remoting/host/json_host_config.h"
#include "remoting/host/log_to_server.h"
@@ -68,10 +68,6 @@
#include "remoting/host/curtain_mode_mac.h"
#endif // defined(OS_MACOSX)
-#if defined(OS_POSIX)
-#include <signal.h>
-#endif // defined(OS_POSIX)
-
// N.B. OS_WIN is defined by including src/base headers.
#if defined(OS_WIN)
#include <commctrl.h>
@@ -194,10 +190,10 @@ class HostProcess
// the first configuration update. Otherwise, post a task to create new
// authenticator factory in case PIN has changed.
if (policy_watcher_.get() == NULL) {
-#if defined(OS_MACOSX) || defined(OS_WIN)
bool want_user_interface = true;
-
-#if defined(OS_MACOSX)
+#if defined(OS_LINUX)
+ want_user_interface = false;
+#elif defined(OS_MACOSX)
// Don't try to display any UI on top of the system's login screen as this
// is rejected by the Window Server on OS X 10.7.4, and prevents the
// capturer from working (http://crbug.com/140984).
@@ -205,15 +201,12 @@ class HostProcess
// TODO(lambroslambrou): Use a better technique of detecting whether we're
// running in the LoginWindow context, and refactor this into a separate
// function to be used here and in CurtainMode::ActivateCurtain().
- if (getuid() == 0) {
- want_user_interface = false;
- }
+ want_user_interface = getuid() != 0;
#endif // OS_MACOSX
if (want_user_interface) {
host_user_interface_.reset(new HostUserInterface(context_.get()));
}
-#endif // OS_MACOSX || OS_WIN
StartWatchingPolicy();
} else {
@@ -236,7 +229,6 @@ class HostProcess
void StartWatchingConfigChanges() {
#if !defined(REMOTING_MULTI_PROCESS)
-
// Start watching the host configuration file.
config_watcher_.reset(new ConfigFileWatcher(context_->ui_task_runner(),
context_->file_task_runner(),
@@ -245,13 +237,13 @@ class HostProcess
#endif // !defined(REMOTING_MULTI_PROCESS)
}
-#if defined(OS_POSIX)
void ListenForShutdownSignal() {
+#if defined(OS_POSIX)
remoting::RegisterSignalHandler(
SIGTERM,
base::Bind(&HostProcess::SigTermHandler, base::Unretained(this)));
- }
#endif // OS_POSIX
+ }
void CreateAuthenticatorFactory() {
DCHECK(context_->network_task_runner()->BelongsToCurrentThread());
@@ -294,12 +286,10 @@ class HostProcess
return;
}
-#if defined(OS_POSIX)
context_->network_task_runner()->PostTask(
FROM_HERE,
base::Bind(&HostProcess::ListenForShutdownSignal,
base::Unretained(this)));
-#endif // OS_POSIX
StartWatchingConfigChanges();
}
@@ -310,15 +300,10 @@ class HostProcess
void ShutdownHostProcess() {
DCHECK(context_->ui_task_runner()->BelongsToCurrentThread());
-#if !defined(REMOTING_MULTI_PROCESS)
alexeypa (please no reviews) 2012/09/14 15:45:26 This #if should stay. It is needed for multi-proce
Sergey Ulanov 2012/09/14 17:35:02 Right, it's just we never create config_watcher_ a
config_watcher_.reset();
-#endif // !defined(REMOTING_MULTI_PROCESS)
daemon_channel_.reset();
-
-#if defined(OS_MACOSX) || defined(OS_WIN)
host_user_interface_.reset();
-#endif
if (policy_watcher_.get()) {
base::WaitableEvent done_event(true, false);
@@ -577,13 +562,11 @@ class HostProcess
new LogToServer(host_, ServerLogEntry::ME2ME, signal_strategy_.get()));
host_event_logger_ = HostEventLogger::Create(host_, kApplicationName);
-#if defined(OS_MACOSX) || defined(OS_WIN)
if (host_user_interface_.get()) {
host_user_interface_->Start(
host_, base::Bind(&HostProcess::OnDisconnectRequested,
base::Unretained(this)));
}
-#endif
host_->Start(xmpp_login_);
@@ -671,10 +654,8 @@ class HostProcess
scoped_ptr<net::NetworkChangeNotifier> network_change_notifier_;
JsonHostConfig config_;
-#if !defined(REMOTING_MULTI_PROCESS)
alexeypa (please no reviews) 2012/09/14 15:45:26 This #if should stay. It is needed for multi-proce
Sergey Ulanov 2012/09/14 17:35:02 Same here. This change doesn't mean we actually wa
FilePath host_config_path_;
scoped_ptr<ConfigFileWatcher> config_watcher_;
-#endif // !defined(REMOTING_MULTI_PROCESS)
std::string host_id_;
HostKeyPair key_pair_;
@@ -700,9 +681,7 @@ class HostProcess
scoped_ptr<LogToServer> log_to_server_;
scoped_ptr<HostEventLogger> host_event_logger_;
-#if defined(OS_MACOSX) || defined(OS_WIN)
scoped_ptr<HostUserInterface> host_user_interface_;
-#endif
scoped_refptr<ChromotingHost> host_;

Powered by Google App Engine
This is Rietveld 408576698