OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 // | 4 // |
5 // This file implements the Windows service controlling Me2Me host processes | 5 // This file implements the Windows service controlling Me2Me host processes |
6 // running within user sessions. | 6 // running within user sessions. |
7 | 7 |
8 #include "base/at_exit.h" | 8 #include "base/at_exit.h" |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 const char kHelpSwitchName[] = "help"; | 40 const char kHelpSwitchName[] = "help"; |
41 const char kQuestionSwitchName[] = "?"; | 41 const char kQuestionSwitchName[] = "?"; |
42 | 42 |
43 const char kUsageMessage[] = | 43 const char kUsageMessage[] = |
44 "\n" | 44 "\n" |
45 "Usage: %s [options]\n" | 45 "Usage: %s [options]\n" |
46 "\n" | 46 "\n" |
47 "Options:\n" | 47 "Options:\n" |
48 " --help, --? - Print this message.\n"; | 48 " --help, --? - Print this message.\n"; |
49 | 49 |
50 void Usage(const FilePath& program_name) { | 50 void Usage(const base::FilePath& program_name) { |
51 std::string display_name = UTF16ToUTF8(program_name.LossyDisplayName()); | 51 std::string display_name = UTF16ToUTF8(program_name.LossyDisplayName()); |
52 LOG(INFO) << StringPrintf(kUsageMessage, display_name.c_str()); | 52 LOG(INFO) << StringPrintf(kUsageMessage, display_name.c_str()); |
53 } | 53 } |
54 | 54 |
55 } // namespace | 55 } // namespace |
56 | 56 |
57 int main(int argc, char** argv) { | 57 int main(int argc, char** argv) { |
58 #if defined(OS_MACOSX) | 58 #if defined(OS_MACOSX) |
59 // Needed so we don't leak objects when threads are created. | 59 // Needed so we don't leak objects when threads are created. |
60 base::mac::ScopedNSAutoreleasePool pool; | 60 base::mac::ScopedNSAutoreleasePool pool; |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 | 118 |
119 // Register and initialize common controls. | 119 // Register and initialize common controls. |
120 INITCOMMONCONTROLSEX info; | 120 INITCOMMONCONTROLSEX info; |
121 info.dwSize = sizeof(info); | 121 info.dwSize = sizeof(info); |
122 info.dwICC = ICC_STANDARD_CLASSES; | 122 info.dwICC = ICC_STANDARD_CLASSES; |
123 InitCommonControlsEx(&info); | 123 InitCommonControlsEx(&info); |
124 | 124 |
125 // Mark the process as DPI-aware, so Windows won't scale coordinates in APIs. | 125 // Mark the process as DPI-aware, so Windows won't scale coordinates in APIs. |
126 // N.B. This API exists on Vista and above. | 126 // N.B. This API exists on Vista and above. |
127 if (base::win::GetVersion() >= base::win::VERSION_VISTA) { | 127 if (base::win::GetVersion() >= base::win::VERSION_VISTA) { |
128 FilePath path(base::GetNativeLibraryName(UTF8ToUTF16("user32"))); | 128 base::FilePath path(base::GetNativeLibraryName(UTF8ToUTF16("user32"))); |
129 base::ScopedNativeLibrary user32(path); | 129 base::ScopedNativeLibrary user32(path); |
130 CHECK(user32.is_valid()); | 130 CHECK(user32.is_valid()); |
131 | 131 |
132 typedef BOOL (WINAPI * SetProcessDPIAwareFn)(); | 132 typedef BOOL (WINAPI * SetProcessDPIAwareFn)(); |
133 SetProcessDPIAwareFn set_process_dpi_aware = | 133 SetProcessDPIAwareFn set_process_dpi_aware = |
134 static_cast<SetProcessDPIAwareFn>( | 134 static_cast<SetProcessDPIAwareFn>( |
135 user32.GetFunctionPointer("SetProcessDPIAware")); | 135 user32.GetFunctionPointer("SetProcessDPIAware")); |
136 set_process_dpi_aware(); | 136 set_process_dpi_aware(); |
137 } | 137 } |
138 | 138 |
139 // CommandLine::Init() ignores the passed |argc| and |argv| on Windows getting | 139 // CommandLine::Init() ignores the passed |argc| and |argv| on Windows getting |
140 // the command line from GetCommandLineW(), so we can safely pass NULL here. | 140 // the command line from GetCommandLineW(), so we can safely pass NULL here. |
141 return main(0, NULL); | 141 return main(0, NULL); |
142 } | 142 } |
143 | 143 |
144 #endif // defined(OS_WIN) | 144 #endif // defined(OS_WIN) |
OLD | NEW |