summaryrefslogtreecommitdiffstats
path: root/remoting/host/desktop_process_main.cc
diff options
context:
space:
mode:
authoralexeypa@chromium.org <alexeypa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-23 06:07:21 +0000
committeralexeypa@chromium.org <alexeypa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-23 06:07:21 +0000
commit9410c0aff6ffd2452b4fea685868c69c6d934b83 (patch)
tree1b69b21efbf9d258734af83b520c27f38c8c3293 /remoting/host/desktop_process_main.cc
parent55a27b9fd8c16314dcc1551351c961c4bed19093 (diff)
downloadchromium_src-9410c0aff6ffd2452b4fea685868c69c6d934b83.zip
chromium_src-9410c0aff6ffd2452b4fea685868c69c6d934b83.tar.gz
chromium_src-9410c0aff6ffd2452b4fea685868c69c6d934b83.tar.bz2
Use a single shared entry point for all Chromoting processes.
This CL combines entry points for four different kinds of Chromoting processes into a single shared entry point routine. The "--type" command line parameter is used to determine the type of the processes to be launched. This effectively makes all the executabes interchangable, reducing the number of EXE binaries to two: remoting_host.exe and remoting_desktop.exe. The latter is needed because of level="requireAdministrator" and uiAccess="true" settings in its manifest. Collateral changes: - Added a debug only remoting_console.exe binary that can run in the console. - dpiAware=true is set via the manifest instead of calling SetProcessDPIAware(). - A cross-platform define REMOTING_ENABLE_BREAKPAD is now used to enable Breakpad integration code. - The "--host-config" command line switch is not passed to the network process by the multi-process daemon. - The "--elevate" and "--version" command line switches are processed by the shared entry point now. - The usage message has been updated. BUG=170200 Review URL: https://chromiumcodereview.appspot.com/12328040 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@184293 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/host/desktop_process_main.cc')
-rw-r--r--remoting/host/desktop_process_main.cc104
1 files changed, 6 insertions, 98 deletions
diff --git a/remoting/host/desktop_process_main.cc b/remoting/host/desktop_process_main.cc
index 0b121d3..9432108 100644
--- a/remoting/host/desktop_process_main.cc
+++ b/remoting/host/desktop_process_main.cc
@@ -5,121 +5,29 @@
// This file implements the Windows service controlling Me2Me host processes
// running within user sessions.
-#include "remoting/host/desktop_process_main.h"
-
-#include "base/at_exit.h"
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/command_line.h"
-#include "base/file_path.h"
#include "base/memory/scoped_ptr.h"
#include "base/message_loop.h"
#include "base/run_loop.h"
-#include "base/scoped_native_library.h"
-#include "base/stringprintf.h"
-#include "base/utf_string_conversions.h"
-#include "base/win/windows_version.h"
#include "remoting/base/auto_thread_task_runner.h"
-#include "remoting/base/breakpad.h"
#include "remoting/host/basic_desktop_environment.h"
#include "remoting/host/desktop_process.h"
#include "remoting/host/host_exit_codes.h"
-#include "remoting/host/logging.h"
-#include "remoting/host/usage_stats_consent.h"
+#include "remoting/host/host_main.h"
+#include "remoting/host/ipc_constants.h"
#include "remoting/host/win/session_desktop_environment.h"
-#if defined(OS_MACOSX)
-#include "base/mac/scoped_nsautorelease_pool.h"
-#endif // defined(OS_MACOSX)
-
-#if defined(OS_WIN)
-#include <commctrl.h>
-#endif // defined(OS_WIN)
-
-namespace {
-
-// The command line switch specifying the name of the daemon IPC endpoint.
-const char kDaemonIpcSwitchName[] = "daemon-pipe";
-
-// "--help" or "--?" prints the usage message.
-const char kHelpSwitchName[] = "help";
-const char kQuestionSwitchName[] = "?";
-
-const char kUsageMessage[] =
- "\n"
- "Usage: %s [options]\n"
- "\n"
- "Options:\n"
- " --help, --? - Print this message.\n";
-
-void Usage(const base::FilePath& program_name) {
- std::string display_name = UTF16ToUTF8(program_name.LossyDisplayName());
- LOG(INFO) << StringPrintf(kUsageMessage, display_name.c_str());
-}
-
-} // namespace
-
namespace remoting {
-int DesktopProcessMain(int argc, char** argv) {
-#if defined(OS_MACOSX)
- // Needed so we don't leak objects when threads are created.
- base::mac::ScopedNSAutoreleasePool pool;
-#endif
-
- CommandLine::Init(argc, argv);
-
- // Initialize Breakpad as early as possible. On Mac the command-line needs to
- // be initialized first, so that the preference for crash-reporting can be
- // looked up in the config file.
-#if defined(OFFICIAL_BUILD) && (defined(MAC_BREAKPAD) || defined(OS_WIN))
- if (IsUsageStatsAllowed()) {
- InitializeCrashReporting();
- }
-#endif // defined(OFFICIAL_BUILD) && (defined(MAC_BREAKPAD) || defined(OS_WIN))
-
- // This object instance is required by Chrome code (for example,
- // LazyInstance, MessageLoop).
- base::AtExitManager exit_manager;
-
- InitHostLogging();
-
-#if defined(OS_WIN)
- // Register and initialize common controls.
- INITCOMMONCONTROLSEX info;
- info.dwSize = sizeof(info);
- info.dwICC = ICC_STANDARD_CLASSES;
- InitCommonControlsEx(&info);
-
- // Mark the process as DPI-aware, so Windows won't scale coordinates in APIs.
- // N.B. This API exists on Vista and above.
- if (base::win::GetVersion() >= base::win::VERSION_VISTA) {
- base::FilePath path(base::GetNativeLibraryName(UTF8ToUTF16("user32")));
- base::ScopedNativeLibrary user32(path);
- CHECK(user32.is_valid());
-
- typedef BOOL (WINAPI * SetProcessDPIAwareFn)();
- SetProcessDPIAwareFn set_process_dpi_aware =
- static_cast<SetProcessDPIAwareFn>(
- user32.GetFunctionPointer("SetProcessDPIAware"));
- set_process_dpi_aware();
- }
-#endif // defined(OS_WIN)
-
+int DesktopProcessMain() {
const CommandLine* command_line = CommandLine::ForCurrentProcess();
- if (command_line->HasSwitch(kHelpSwitchName) ||
- command_line->HasSwitch(kQuestionSwitchName)) {
- Usage(command_line->GetProgram());
- return kSuccessExitCode;
- }
-
std::string channel_name =
- command_line->GetSwitchValueASCII(kDaemonIpcSwitchName);
+ command_line->GetSwitchValueASCII(kDaemonPipeSwitchName);
- if (channel_name.empty()) {
- Usage(command_line->GetProgram());
+ if (channel_name.empty())
return kUsageExitCode;
- }
MessageLoop message_loop(MessageLoop::TYPE_UI);
base::RunLoop run_loop;
@@ -155,6 +63,6 @@ int DesktopProcessMain(int argc, char** argv) {
#if !defined(OS_WIN)
int main(int argc, char** argv) {
- return remoting::DesktopProcessMain(argc, argv);
+ return remoting::HostMain(argc, argv);
}
#endif // !defined(OS_WIN)