Commit 23d0ee46 authored by alexeypa@chromium.org's avatar alexeypa@chromium.org

Removing --host-binary parameter in preparation to the coming me2me host refactoring.


Review URL: https://chromiumcodereview.appspot.com/10832054

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@149298 0039d316-1c4b-4281-b951-d872f2087c98
parent a70b4351
......@@ -133,7 +133,7 @@
Name="$(var.ServiceName)"
DisplayName="[chromoting_service_display_name]"
Description="[chromoting_service_description]"
Arguments="--host-binary="[binaries]remoting_me2me_host.exe" --auth-config="[config_files]host.json" --host-config="[config_files]host.json""
Arguments="--auth-config="[config_files]host.json" --host-config="[config_files]host.json""
Start="demand"
Account="LocalSystem"
ErrorControl="ignore"
......
......@@ -131,14 +131,14 @@ bool SasInjectorWin::InjectSas() {
// Load sas.dll. The library is expected to be in the same folder as this
// binary.
if (!sas_dll_.is_valid()) {
FilePath exe_path;
if (!PathService::Get(base::FILE_EXE, &exe_path)) {
FilePath dir_path;
if (!PathService::Get(base::DIR_EXE, &dir_path)) {
LOG(ERROR) << "Failed to get the executable file name.";
return false;
}
sas_dll_.Reset(base::LoadNativeLibrary(
exe_path.DirName().Append(kSasDllFileName), NULL));
sas_dll_.Reset(base::LoadNativeLibrary(dir_path.Append(kSasDllFileName),
NULL));
}
if (!sas_dll_.is_valid()) {
LOG(ERROR) << "Failed to load '" << kSasDllFileName << "'";
......
......@@ -15,10 +15,9 @@
#include "base/base_paths.h"
#include "base/bind.h"
#include "base/command_line.h"
#include "base/file_util.h"
#include "base/file_path.h"
#include "base/logging.h"
#include "base/message_loop.h"
#include "base/path_service.h"
#include "base/single_thread_task_runner.h"
#include "base/stringprintf.h"
#include "base/threading/thread.h"
......@@ -50,9 +49,6 @@ const wchar_t kRunActionName[] = L"run";
// "--console" runs the service interactively for debugging purposes.
const char kConsoleSwitchName[] = "console";
// "--host-binary" specifies the host binary to run in console session.
const char kHostBinarySwitchName[] = "host-binary";
// "--help" or "--?" prints the usage message.
const char kHelpSwitchName[] = "help";
const char kQuestionSwitchName[] = "?";
......@@ -66,7 +62,6 @@ const char kUsageMessage[] =
"\n"
"Options:\n"
" --console - Run the service interactively for debugging purposes.\n"
" --host-binary - Specifies the host binary to run.\n"
" --help, --? - Print this message.\n";
// Exit codes:
......@@ -173,14 +168,6 @@ bool HostService::InitWithCommandLine(const CommandLine* command_line) {
}
}
if (command_line->HasSwitch(kHostBinarySwitchName)) {
host_binary_ = command_line->GetSwitchValuePath(kHostBinarySwitchName);
} else {
LOG(ERROR) << "Invalid command line: --" << kHostBinarySwitchName
<< " is required.";
return false;
}
// Run interactively if needed.
if (run_routine_ == &HostService::RunAsService &&
command_line->HasSwitch(kConsoleSwitchName)) {
......@@ -208,7 +195,6 @@ void HostService::RunMessageLoop(MessageLoop* message_loop) {
launcher_.reset(new WtsSessionProcessLauncher(
base::Bind(&HostService::OnLauncherShutdown, base::Unretained(this)),
this,
host_binary_,
main_task_runner_,
io_thread.message_loop_proxy()));
......
......@@ -7,7 +7,6 @@
#include <windows.h>
#include "base/file_path.h"
#include "base/memory/ref_counted.h"
#include "base/memory/singleton.h"
#include "base/observer_list.h"
......@@ -88,9 +87,6 @@ class HostService : public WtsConsoleMonitor {
scoped_ptr<WtsSessionProcessLauncher> launcher_;
// The host binary name.
FilePath host_binary_;
// Service message loop.
scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_;
......
......@@ -15,8 +15,11 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/command_line.h"
#include "base/file_path.h"
#include "base/file_util.h"
#include "base/logging.h"
#include "base/single_thread_task_runner.h"
#include "base/path_service.h"
#include "base/process_util.h"
#include "base/rand_util.h"
#include "base/stringprintf.h"
......@@ -40,6 +43,9 @@ namespace {
const int kMaxLaunchDelaySeconds = 60;
const int kMinLaunchDelaySeconds = 1;
const FilePath::CharType kMe2meHostBinaryName[] =
FILE_PATH_LITERAL("remoting_me2me_host.exe");
// Match the pipe name prefix used by Chrome IPC channels.
const wchar_t kChromePipeNamePrefix[] = L"\\\\.\\pipe\\chrome.";
......@@ -214,11 +220,9 @@ const uint32 kInvalidSessionId = 0xffffffff;
WtsSessionProcessLauncher::WtsSessionProcessLauncher(
const base::Closure& stopped_callback,
WtsConsoleMonitor* monitor,
const FilePath& host_binary,
scoped_refptr<base::SingleThreadTaskRunner> main_message_loop,
scoped_refptr<base::SingleThreadTaskRunner> ipc_message_loop)
: Stoppable(main_message_loop, stopped_callback),
host_binary_(host_binary),
main_message_loop_(main_message_loop),
ipc_message_loop_(ipc_message_loop),
monitor_(monitor),
......@@ -249,6 +253,15 @@ void WtsSessionProcessLauncher::LaunchProcess() {
launch_time_ = base::Time::Now();
// Construct the host binary name.
FilePath dir_path;
if (!PathService::Get(base::DIR_EXE, &dir_path)) {
LOG(ERROR) << "Failed to get the executable file name.";
Stop();
return;
}
FilePath host_binary = dir_path.Append(kMe2meHostBinaryName);
std::wstring channel_name;
ScopedHandle pipe;
if (CreatePipeForIpcChannel(this, &channel_name, &pipe)) {
......@@ -261,7 +274,7 @@ void WtsSessionProcessLauncher::LaunchProcess() {
// Create the host process command line passing the name of the IPC channel
// to use and copying known switches from the service's command line.
CommandLine command_line(host_binary_);
CommandLine command_line(host_binary);
command_line.AppendSwitchNative(kChromotingIpcSwitchName, channel_name);
command_line.CopySwitchesFrom(*CommandLine::ForCurrentProcess(),
kCopiedSwitchNames,
......@@ -269,7 +282,7 @@ void WtsSessionProcessLauncher::LaunchProcess() {
// Try to launch the process and attach an object watcher to the returned
// handle so that we get notified when the process terminates.
if (LaunchProcessWithToken(host_binary_,
if (LaunchProcessWithToken(host_binary,
command_line.GetCommandLineString(),
session_token_,
&process_)) {
......
......@@ -8,7 +8,6 @@
#include <windows.h>
#include "base/basictypes.h"
#include "base/file_path.h"
#include "base/compiler_specific.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
......@@ -44,14 +43,12 @@ class WtsSessionProcessLauncher
public IPC::Listener,
public WtsConsoleObserver {
public:
// Constructs a WtsSessionProcessLauncher object. |host_binary| is the name of
// the executable to be launched in the console session. All interaction with
// Constructs a WtsSessionProcessLauncher object. All interaction with
// |monitor| should happen on |main_message_loop|. |ipc_message_loop| has
// to be an I/O message loop.
WtsSessionProcessLauncher(
const base::Closure& stopped_callback,
WtsConsoleMonitor* monitor,
const FilePath& host_binary,
scoped_refptr<base::SingleThreadTaskRunner> main_message_loop,
scoped_refptr<base::SingleThreadTaskRunner> ipc_message_loop);
......@@ -81,9 +78,6 @@ class WtsSessionProcessLauncher
// |session_token_|.
void OnSendSasToConsole();
// Name of the host executable.
FilePath host_binary_;
// Time of the last launch attempt.
base::Time launch_time_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment