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

Unified Diff: remoting/host/remoting_me2me_host.cc

Issue 11970044: Merged all Chromoting Host code into remoting_core.dll (Windows). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: CR feedback. Rebased. Debug is compilable. Created 7 years, 11 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_me2me_host.h ('k') | remoting/host/verify_config_window_win.h » ('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 67b1045fc41b656d44d444408ba3ec8f7431ca92..ba8187094b5fccc409268bcdba771d1fd4ccd11f 100644
--- a/remoting/host/remoting_me2me_host.cc
+++ b/remoting/host/remoting_me2me_host.cc
@@ -4,6 +4,8 @@
//
// This file implements a standalone host process for Me2Me.
+#include "remoting/host/remoting_me2me_host.h"
+
#include <string>
#include "base/at_exit.h"
@@ -12,6 +14,7 @@
#include "base/command_line.h"
#include "base/file_path.h"
#include "base/file_util.h"
+#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "base/message_loop.h"
#include "base/scoped_native_library.h"
@@ -1036,9 +1039,7 @@ void HostProcess::OnCrash(const std::string& function_name,
CHECK(false);
}
-} // namespace remoting
-
-int main(int argc, char** argv) {
+int HostProcessMain(int argc, char** argv) {
#if defined(OS_MACOSX)
// Needed so we don't leak objects when threads are created.
base::mac::ScopedNSAutoreleasePool pool;
@@ -1046,15 +1047,14 @@ int main(int argc, char** argv) {
CommandLine::Init(argc, argv);
- // Initialize Breakpad as early as possible. On Windows, this happens in
- // WinMain(), so it shouldn't also be done here. 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(MAC_BREAKPAD)
- if (remoting::IsUsageStatsAllowed()) {
- remoting::InitializeCrashReporting();
+ // 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 // MAC_BREAKPAD
+#endif // defined(OFFICIAL_BUILD) && (defined(MAC_BREAKPAD) || defined(OS_WIN))
// This object instance is required by Chrome code (for example,
// LazyInstance, MessageLoop).
@@ -1065,7 +1065,29 @@ int main(int argc, char** argv) {
return 0;
}
- remoting::InitHostLogging();
+ 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) {
+ 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)
#if defined(TOOLKIT_GTK)
// Required for any calls into GTK functions, such as the Disconnect and
@@ -1081,18 +1103,18 @@ int main(int argc, char** argv) {
// Create the main message loop and start helper threads.
MessageLoop message_loop(MessageLoop::TYPE_UI);
- scoped_ptr<remoting::ChromotingHostContext> context =
- remoting::ChromotingHostContext::Create(
- new remoting::AutoThreadTaskRunner(message_loop.message_loop_proxy(),
- MessageLoop::QuitClosure()));
+ scoped_ptr<ChromotingHostContext> context =
+ ChromotingHostContext::Create(
+ new AutoThreadTaskRunner(message_loop.message_loop_proxy(),
+ MessageLoop::QuitClosure()));
if (!context)
- return remoting::kInitializationFailed;
+ return kInitializationFailed;
// Create & start the HostProcess using these threads.
// TODO(wez): The HostProcess holds a reference to itself until Shutdown().
// Remove this hack as part of the multi-process refactoring.
- int exit_code = remoting::kSuccessExitCode;
- new remoting::HostProcess(context.Pass(), &exit_code);
+ int exit_code = kSuccessExitCode;
+ new HostProcess(context.Pass(), &exit_code);
// Run the main (also UI) message loop until the host no longer needs it.
message_loop.Run();
@@ -1100,44 +1122,10 @@ int main(int argc, char** argv) {
return exit_code;
}
-#if defined(OS_WIN)
-HMODULE g_hModule = NULL;
-
-int CALLBACK WinMain(HINSTANCE instance,
- HINSTANCE previous_instance,
- LPSTR command_line,
- int show_command) {
-#if defined(OFFICIAL_BUILD)
- if (remoting::IsUsageStatsAllowed()) {
- remoting::InitializeCrashReporting();
- }
-#endif // OFFICIAL_BUILD
-
- g_hModule = instance;
-
- // 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) {
- 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();
- }
+} // namespace remoting
- // 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);
+#if !defined(OS_WIN)
+int main(int argc, char** argv) {
+ return remoting::HostProcessMain(argc, argv);
}
-
-#endif // defined(OS_WIN)
+#endif // !defined(OS_WIN)
« no previous file with comments | « remoting/host/remoting_me2me_host.h ('k') | remoting/host/verify_config_window_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698