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

Unified Diff: remoting/host/remoting_me2me_host.cc

Issue 12179013: Revert 180433 because build\some.gyp was added to the CL by mistake. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 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_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
===================================================================
--- remoting/host/remoting_me2me_host.cc (revision 180437)
+++ remoting/host/remoting_me2me_host.cc (working copy)
@@ -4,8 +4,6 @@
//
// This file implements a standalone host process for Me2Me.
-#include "remoting/host/remoting_me2me_host.h"
-
#include <string>
#include "base/at_exit.h"
@@ -14,7 +12,6 @@
#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"
@@ -1050,7 +1047,9 @@
CHECK(false);
}
-int HostProcessMain(int argc, char** argv) {
+} // namespace remoting
+
+int main(int argc, char** argv) {
#if defined(OS_MACOSX)
// Needed so we don't leak objects when threads are created.
base::mac::ScopedNSAutoreleasePool pool;
@@ -1058,14 +1057,15 @@
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();
+ // 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();
}
-#endif // defined(OFFICIAL_BUILD) && (defined(MAC_BREAKPAD) || defined(OS_WIN))
+#endif // MAC_BREAKPAD
// This object instance is required by Chrome code (for example,
// LazyInstance, MessageLoop).
@@ -1076,30 +1076,8 @@
return 0;
}
- InitHostLogging();
+ remoting::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
// Continue windows, though these should not be used for the Me2Me case
@@ -1114,18 +1092,18 @@
// Create the main message loop and start helper threads.
MessageLoop message_loop(MessageLoop::TYPE_UI);
- scoped_ptr<ChromotingHostContext> context =
- ChromotingHostContext::Create(
- new AutoThreadTaskRunner(message_loop.message_loop_proxy(),
- MessageLoop::QuitClosure()));
+ scoped_ptr<remoting::ChromotingHostContext> context =
+ remoting::ChromotingHostContext::Create(
+ new remoting::AutoThreadTaskRunner(message_loop.message_loop_proxy(),
+ MessageLoop::QuitClosure()));
if (!context)
- return kInitializationFailed;
+ return remoting::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 = kSuccessExitCode;
- new HostProcess(context.Pass(), &exit_code);
+ int exit_code = remoting::kSuccessExitCode;
+ new remoting::HostProcess(context.Pass(), &exit_code);
// Run the main (also UI) message loop until the host no longer needs it.
message_loop.Run();
@@ -1133,10 +1111,44 @@
return exit_code;
}
-} // namespace remoting
+#if defined(OS_WIN)
+HMODULE g_hModule = NULL;
-#if !defined(OS_WIN)
-int main(int argc, char** argv) {
- return remoting::HostProcessMain(argc, argv);
+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) {
+ 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();
+ }
+
+ // 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 // !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