diff options
author | marja@chromium.org <marja@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-31 09:12:32 +0000 |
---|---|---|
committer | marja@chromium.org <marja@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-31 09:12:32 +0000 |
commit | fe2da44a03faf54f1f26e6a67182d7945a876c1a (patch) | |
tree | 7a8e2777f58a004f3d9cd05cb43de3c882cc3d87 /remoting/host/win/host_service.cc | |
parent | e7d3877c620dd394c623bc9b5461c5004c2756f6 (diff) | |
download | chromium_src-fe2da44a03faf54f1f26e6a67182d7945a876c1a.zip chromium_src-fe2da44a03faf54f1f26e6a67182d7945a876c1a.tar.gz chromium_src-fe2da44a03faf54f1f26e6a67182d7945a876c1a.tar.bz2 |
Revert 179373. This makes the try jobs started by the commit queue fail.
> Merged all Chromoting Host code into remoting_core.dll (Windows).
>
> Consolidated all installable Chromoting Host core into remoting_core.dll and converted all executables into thin wrappers around entry points exposed by remoting_core.dll. This reduces size of the installer by approximately 600KB.
>
> This is the 2nd attempt to land this CL. It was previously reverted at r179322.
>
> BUG=170200
>
> Review URL: https://codereview.chromium.org/12088049
TBR=alexeypa@chromium.org
Review URL: https://codereview.chromium.org/12090089
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@179833 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/host/win/host_service.cc')
-rw-r--r-- | remoting/host/win/host_service.cc | 63 |
1 files changed, 62 insertions, 1 deletions
diff --git a/remoting/host/win/host_service.cc b/remoting/host/win/host_service.cc index 90e69c4..84c7f7c 100644 --- a/remoting/host/win/host_service.cc +++ b/remoting/host/win/host_service.cc @@ -11,6 +11,7 @@ #include <shellapi.h> #include <wtsapi32.h> +#include "base/at_exit.h" #include "base/base_paths.h" #include "base/base_switches.h" #include "base/bind.h" @@ -19,9 +20,12 @@ #include "base/message_loop.h" #include "base/run_loop.h" #include "base/single_thread_task_runner.h" +#include "base/stringprintf.h" #include "base/threading/thread.h" +#include "base/utf_string_conversions.h" #include "base/win/wrapped_window_proc.h" #include "remoting/base/auto_thread.h" +#include "remoting/base/breakpad.h" #include "remoting/base/scoped_sc_handle_win.h" #include "remoting/base/stoppable.h" #include "remoting/host/branding.h" @@ -32,13 +36,16 @@ #include "remoting/host/daemon_process.h" #endif // defined(REMOTING_MULTI_PROCESS) -#include "remoting/host/win/core_resource.h" +#include "remoting/host/usage_stats_consent.h" +#include "remoting/host/win/host_service_resource.h" #include "remoting/host/win/wts_console_observer.h" #if !defined(REMOTING_MULTI_PROCESS) #include "remoting/host/win/wts_console_session_process_driver.h" #endif // !defined(REMOTING_MULTI_PROCESS) +using base::StringPrintf; + namespace { // Session id that does not represent any session. @@ -59,11 +66,29 @@ const char kConsoleSwitchName[] = "console"; // a UAC prompt if necessary. const char kElevateSwitchName[] = "elevate"; +// "--help" or "--?" prints the usage message. +const char kHelpSwitchName[] = "help"; +const char kQuestionSwitchName[] = "?"; + +const wchar_t kUsageMessage[] = + L"\n" + L"Usage: %ls [options]\n" + L"\n" + L"Options:\n" + L" --console - Run the service interactively for debugging purposes.\n" + L" --elevate=<...> - Run <...> elevated.\n" + L" --help, --? - Print this message.\n"; + // The command line parameters that should be copied from the service's command // line when launching an elevated child. const char* kCopiedSwitchNames[] = { "host-config", "daemon-pipe", switches::kV, switches::kVModule }; +void usage(const FilePath& program_name) { + LOG(INFO) << StringPrintf(kUsageMessage, + UTF16ToWide(program_name.value()).c_str()); +} + } // namespace namespace remoting { @@ -432,3 +457,39 @@ LRESULT CALLBACK HostService::SessionChangeNotificationProc(HWND hwnd, } } // namespace remoting + +int CALLBACK WinMain(HINSTANCE instance, + HINSTANCE previous_instance, + LPSTR raw_command_line, + int show_command) { +#ifdef OFFICIAL_BUILD + if (remoting::IsUsageStatsAllowed()) { + remoting::InitializeCrashReporting(); + } +#endif // OFFICIAL_BUILD + + // This object instance is required by Chrome code (for example, + // FilePath, LazyInstance, MessageLoop, Singleton, etc). + base::AtExitManager exit_manager; + + // CommandLine::Init() ignores the passed |argc| and |argv| on Windows getting + // the command line from GetCommandLineW(), so we can safely pass NULL here. + CommandLine::Init(0, NULL); + + remoting::InitHostLogging(); + + const CommandLine* command_line = CommandLine::ForCurrentProcess(); + if (command_line->HasSwitch(kHelpSwitchName) || + command_line->HasSwitch(kQuestionSwitchName)) { + usage(command_line->GetProgram()); + return remoting::kSuccessExitCode; + } + + remoting::HostService* service = remoting::HostService::GetInstance(); + if (!service->InitWithCommandLine(command_line)) { + usage(command_line->GetProgram()); + return remoting::kUsageExitCode; + } + + return service->Run(); +} |