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

Side by Side Diff: remoting/host/desktop_process.cc

Issue 10910075: [Chromoting] Adding the desktop integration binary to the host installation on Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix preprocessor conditions in .WXS & rebased Created 8 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « remoting/host/desktop_process.h ('k') | remoting/host/plugin/host_plugin.ver » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 //
5 // This file implements the Windows service controlling Me2Me host processes
6 // running within user sessions.
7
8 #include "remoting/host/desktop_process.h"
9
10 #include "base/at_exit.h"
11 #include "base/command_line.h"
12 #include "base/file_path.h"
13 #include "base/logging.h"
14 #include "base/scoped_native_library.h"
15 #include "base/stringprintf.h"
16 #include "base/utf_string_conversions.h"
17 #include "base/win/windows_version.h"
18 #include "remoting/host/branding.h"
19 #include "remoting/host/constants.h"
20 #include "remoting/host/usage_stats_consent.h"
21
22 #if defined(OS_MACOSX)
23 #include "base/mac/scoped_nsautorelease_pool.h"
24 #endif // defined(OS_MACOSX)
25
26 #if defined(OS_WIN)
27 #include <commctrl.h>
28 #endif // defined(OS_WIN)
29
30 namespace {
31
32 // "--help" or "--?" prints the usage message.
33 const char kHelpSwitchName[] = "help";
34 const char kQuestionSwitchName[] = "?";
35
36 const wchar_t kUsageMessage[] =
37 L"\n"
38 L"Usage: %ls [options]\n"
39 L"\n"
40 L"Options:\n"
41 L" --help, --? - Print this message.\n";
42
43 void usage(const FilePath& program_name) {
44 LOG(INFO) << StringPrintf(kUsageMessage,
45 UTF16ToWide(program_name.value()).c_str());
46 }
47
48 } // namespace
49
50 namespace remoting {
51
52 DesktopProcess::DesktopProcess() {
53 }
54
55 DesktopProcess::~DesktopProcess() {
56 }
57
58 int DesktopProcess::Run() {
59 NOTIMPLEMENTED();
60 return 0;
61 }
62
63 } // namespace remoting
64
65 int main(int argc, char** argv) {
66 #if defined(OS_MACOSX)
67 // Needed so we don't leak objects when threads are created.
68 base::mac::ScopedNSAutoreleasePool pool;
69 #endif
70
71 CommandLine::Init(argc, argv);
72
73 // This object instance is required by Chrome code (for example,
74 // LazyInstance, MessageLoop).
75 base::AtExitManager exit_manager;
76
77 // Initialize logging with an appropriate log-file location, and default to
78 // log to that on Windows, or to standard error output otherwise.
79 FilePath debug_log = remoting::GetConfigDir().
80 Append(FILE_PATH_LITERAL("debug.log"));
81 InitLogging(debug_log.value().c_str(),
82 #if defined(OS_WIN)
83 logging::LOG_ONLY_TO_FILE,
84 #else
85 logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG,
86 #endif
87 logging::DONT_LOCK_LOG_FILE,
88 logging::APPEND_TO_OLD_LOG_FILE,
89 logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS);
90
91 const CommandLine* command_line = CommandLine::ForCurrentProcess();
92 if (command_line->HasSwitch(kHelpSwitchName) ||
93 command_line->HasSwitch(kQuestionSwitchName)) {
94 usage(command_line->GetProgram());
95 return remoting::kSuccessExitCode;
96 }
97
98 remoting::DesktopProcess desktop_process;
99 return desktop_process.Run();
100 }
101
102 #if defined(OS_WIN)
103
104 int CALLBACK WinMain(HINSTANCE instance,
105 HINSTANCE previous_instance,
106 LPSTR raw_command_line,
107 int show_command) {
108 #ifdef OFFICIAL_BUILD
109 if (remoting::IsUsageStatsAllowed()) {
110 remoting::InitializeCrashReporting();
111 }
112 #endif // OFFICIAL_BUILD
113
114 // Register and initialize common controls.
115 INITCOMMONCONTROLSEX info;
116 info.dwSize = sizeof(info);
117 info.dwICC = ICC_STANDARD_CLASSES;
118 InitCommonControlsEx(&info);
119
120 // Mark the process as DPI-aware, so Windows won't scale coordinates in APIs.
121 // N.B. This API exists on Vista and above.
122 if (base::win::GetVersion() >= base::win::VERSION_VISTA) {
123 FilePath path(base::GetNativeLibraryName(UTF8ToUTF16("user32")));
124 base::ScopedNativeLibrary user32(path);
125 CHECK(user32.is_valid());
126
127 typedef BOOL (WINAPI * SetProcessDPIAwareFn)();
128 SetProcessDPIAwareFn set_process_dpi_aware =
129 static_cast<SetProcessDPIAwareFn>(
130 user32.GetFunctionPointer("SetProcessDPIAware"));
131 set_process_dpi_aware();
132 }
133
134 // CommandLine::Init() ignores the passed |argc| and |argv| on Windows getting
135 // the command line from GetCommandLineW(), so we can safely pass NULL here.
136 return main(0, NULL);
137 }
138
139 #endif // defined(OS_WIN)
OLDNEW
« no previous file with comments | « remoting/host/desktop_process.h ('k') | remoting/host/plugin/host_plugin.ver » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698