| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "remoting/host/setup/me2me_native_messaging_host_main.h" | 5 #include "remoting/host/setup/me2me_native_messaging_host_main.h" |
| 6 | 6 |
| 7 #include "base/at_exit.h" | 7 #include "base/at_exit.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| 11 #include "base/strings/string_number_conversions.h" | 11 #include "base/strings/string_number_conversions.h" |
| 12 #include "net/url_request/url_fetcher.h" | 12 #include "net/url_request/url_fetcher.h" |
| 13 #include "remoting/base/breakpad.h" | |
| 14 #include "remoting/host/host_exit_codes.h" | 13 #include "remoting/host/host_exit_codes.h" |
| 15 #include "remoting/host/logging.h" | 14 #include "remoting/host/logging.h" |
| 16 #include "remoting/host/pairing_registry_delegate.h" | 15 #include "remoting/host/pairing_registry_delegate.h" |
| 17 #include "remoting/host/setup/me2me_native_messaging_host.h" | 16 #include "remoting/host/setup/me2me_native_messaging_host.h" |
| 18 #include "remoting/host/usage_stats_consent.h" | |
| 19 | |
| 20 #if defined(OS_MACOSX) | |
| 21 #include "base/mac/scoped_nsautorelease_pool.h" | |
| 22 #endif // defined(OS_MACOSX) | |
| 23 | 17 |
| 24 #if defined(OS_WIN) | 18 #if defined(OS_WIN) |
| 25 #include "base/win/registry.h" | 19 #include "base/win/registry.h" |
| 26 #include "base/win/windows_version.h" | 20 #include "base/win/windows_version.h" |
| 27 #include "remoting/host/pairing_registry_delegate_win.h" | 21 #include "remoting/host/pairing_registry_delegate_win.h" |
| 28 #endif // defined(OS_WIN) | 22 #endif // defined(OS_WIN) |
| 29 | 23 |
| 30 using remoting::protocol::PairingRegistry; | 24 using remoting::protocol::PairingRegistry; |
| 31 | 25 |
| 32 namespace { | 26 namespace { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 53 // UAC is turned off, TOKEN_ELEVATION will tell you the process is elevated. | 47 // UAC is turned off, TOKEN_ELEVATION will tell you the process is elevated. |
| 54 DWORD size; | 48 DWORD size; |
| 55 TOKEN_ELEVATION elevation; | 49 TOKEN_ELEVATION elevation; |
| 56 GetTokenInformation(process_token, TokenElevation, | 50 GetTokenInformation(process_token, TokenElevation, |
| 57 &elevation, sizeof(elevation), &size); | 51 &elevation, sizeof(elevation), &size); |
| 58 return elevation.TokenIsElevated != 0; | 52 return elevation.TokenIsElevated != 0; |
| 59 } | 53 } |
| 60 #endif // defined(OS_WIN) | 54 #endif // defined(OS_WIN) |
| 61 | 55 |
| 62 int StartMe2MeNativeMessagingHost() { | 56 int StartMe2MeNativeMessagingHost() { |
| 63 #if defined(OS_MACOSX) | |
| 64 // Needed so we don't leak objects when threads are created. | |
| 65 base::mac::ScopedNSAutoreleasePool pool; | |
| 66 #endif // defined(OS_MACOSX) | |
| 67 | |
| 68 #if defined(REMOTING_ENABLE_BREAKPAD) | |
| 69 // Initialize Breakpad as early as possible. On Mac the command-line needs to | |
| 70 // be initialized first, so that the preference for crash-reporting can be | |
| 71 // looked up in the config file. | |
| 72 if (IsUsageStatsAllowed()) { | |
| 73 InitializeCrashReporting(); | |
| 74 } | |
| 75 #endif // defined(REMOTING_ENABLE_BREAKPAD) | |
| 76 | |
| 77 // Mac OS X requires that the main thread be a UI message loop in order to | 57 // Mac OS X requires that the main thread be a UI message loop in order to |
| 78 // receive distributed notifications from the System Preferences pane. An | 58 // receive distributed notifications from the System Preferences pane. An |
| 79 // IO thread is needed for the pairing registry and URL context getter. | 59 // IO thread is needed for the pairing registry and URL context getter. |
| 80 base::Thread io_thread("io_thread"); | 60 base::Thread io_thread("io_thread"); |
| 81 io_thread.StartWithOptions( | 61 io_thread.StartWithOptions( |
| 82 base::Thread::Options(base::MessageLoop::TYPE_IO, 0)); | 62 base::Thread::Options(base::MessageLoop::TYPE_IO, 0)); |
| 83 | 63 |
| 84 base::MessageLoopForUI message_loop; | 64 base::MessageLoopForUI message_loop; |
| 85 base::RunLoop run_loop; | 65 base::RunLoop run_loop; |
| 86 | 66 |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 // This object instance is required by Chrome code (such as MessageLoop). | 231 // This object instance is required by Chrome code (such as MessageLoop). |
| 252 base::AtExitManager exit_manager; | 232 base::AtExitManager exit_manager; |
| 253 | 233 |
| 254 CommandLine::Init(argc, argv); | 234 CommandLine::Init(argc, argv); |
| 255 remoting::InitHostLogging(); | 235 remoting::InitHostLogging(); |
| 256 | 236 |
| 257 return StartMe2MeNativeMessagingHost(); | 237 return StartMe2MeNativeMessagingHost(); |
| 258 } | 238 } |
| 259 | 239 |
| 260 } // namespace remoting | 240 } // namespace remoting |
| OLD | NEW |