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

Unified Diff: remoting/host/remoting_me2me_host.cc

Issue 9567010: Making the me2me host compiling and running on Windows. This includes making it a window applicatio… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 8 years, 10 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 | « remoting/host/remoting_host_messages.mc ('k') | remoting/remoting.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/remoting_me2me_host.cc
diff --git a/remoting/host/remoting_me2me_host.cc b/remoting/host/remoting_me2me_host.cc
index 5676f1a75f8b136ed913c6ac6e3a281f4ea01113..c4922db4c9fef03f33e3fb3e3379ad60ada5c70c 100644
--- a/remoting/host/remoting_me2me_host.cc
+++ b/remoting/host/remoting_me2me_host.cc
@@ -5,6 +5,10 @@
// This file implements a standalone host process for Me2Me, which is currently
// used for the Linux-only Virtual Me2Me build.
+#if defined(OS_WIN)
+#include <windows.h>
+#endif
+
#include <string>
#include "base/at_exit.h"
@@ -15,6 +19,7 @@
#include "base/file_util.h"
#include "base/logging.h"
#include "base/message_loop.h"
+#include "base/path_service.h"
#include "base/threading/thread.h"
#include "build/build_config.h"
#include "crypto/nss_util.h"
@@ -59,6 +64,18 @@ const FilePath::CharType kDefaultHostConfigFile[] =
const int kMinPortNumber = 12400;
const int kMaxPortNumber = 12409;
+FilePath GetDefaultConfigDir() {
+ FilePath default_config_dir;
+
+#if defined(OS_WIN)
+ PathService::Get(base::DIR_PROFILE, &default_config_dir);
+#else
+ default_config_dir = file_util::GetHomeDir();
+#endif
+
+ return default_config_dir.Append(kDefaultConfigDir);
+}
+
} // namespace
namespace remoting {
@@ -78,9 +95,7 @@ class HostProcess {
}
void InitWithCommandLine(const CommandLine* cmd_line) {
- FilePath default_config_dir =
- file_util::GetHomeDir().Append(kDefaultConfigDir);
-
+ FilePath default_config_dir = GetDefaultConfigDir();
if (cmd_line->HasSwitch(kAuthConfigSwitchName)) {
auth_config_path_ = cmd_line->GetSwitchValuePath(kAuthConfigSwitchName);
} else {
@@ -121,14 +136,14 @@ class HostProcess {
scoped_refptr<JsonHostConfig> auth_config =
new JsonHostConfig(auth_config_path_, io_message_loop);
- std::string failed_path;
+ FilePath failed_path;
if (!host_config->Read()) {
- failed_path = host_config_path_.value();
+ failed_path = host_config_path_;
} else if (!auth_config->Read()) {
- failed_path = auth_config_path_.value();
+ failed_path = auth_config_path_;
}
if (!failed_path.empty()) {
- LOG(ERROR) << "Failed to read configuration file " << failed_path;
+ LOG(ERROR) << "Failed to read configuration file " << failed_path.value();
return false;
}
@@ -224,7 +239,7 @@ class HostProcess {
log_to_server_.reset(
new LogToServer(host_, ServerLogEntry::ME2ME, signal_strategy_.get()));
- host_event_logger_.reset(new HostEventLogger(host_, kApplicationName));
+ host_event_logger_ = HostEventLogger::Create(host_, kApplicationName);
host_->Start();
@@ -312,3 +327,16 @@ int main(int argc, char** argv) {
return me2me_host.Run();
}
+
+#if defined(OS_WIN)
+
+int CALLBACK WinMain(HINSTANCE instance,
+ HINSTANCE previous_instance,
+ LPSTR command_line,
+ int show_command) {
+ // CommandLine::Init() ignores the passed |argc| and |argv| on Windows getting
+ // the command line from GetCommandLineW(), so we can safely pass NULL here.
+ return main(0, NULL);
+}
+
+#endif
« no previous file with comments | « remoting/host/remoting_host_messages.mc ('k') | remoting/remoting.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698