| 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 a standalone host process for Me2Me. | 5 // This file implements a standalone host process for Me2Me. |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/at_exit.h" | 9 #include "base/at_exit.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "base/file_path.h" | 13 #include "base/file_path.h" |
| 14 #include "base/file_util.h" | 14 #include "base/file_util.h" |
| 15 #include "base/logging.h" | 15 #include "base/logging.h" |
| 16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
| 17 #include "base/message_loop.h" | 17 #include "base/message_loop.h" |
| 18 #include "base/scoped_native_library.h" | 18 #include "base/scoped_native_library.h" |
| 19 #include "base/string_util.h" | 19 #include "base/string_util.h" |
| 20 #include "base/stringize_macros.h" |
| 20 #include "base/synchronization/waitable_event.h" | 21 #include "base/synchronization/waitable_event.h" |
| 21 #include "base/threading/thread.h" | 22 #include "base/threading/thread.h" |
| 22 #include "base/utf_string_conversions.h" | 23 #include "base/utf_string_conversions.h" |
| 23 #include "base/win/windows_version.h" | 24 #include "base/win/windows_version.h" |
| 24 #include "build/build_config.h" | 25 #include "build/build_config.h" |
| 25 #include "crypto/nss_util.h" | 26 #include "crypto/nss_util.h" |
| 26 #include "ipc/ipc_channel.h" | 27 #include "ipc/ipc_channel.h" |
| 27 #include "ipc/ipc_channel_proxy.h" | 28 #include "ipc/ipc_channel_proxy.h" |
| 28 #include "net/base/network_change_notifier.h" | 29 #include "net/base/network_change_notifier.h" |
| 29 #include "net/socket/ssl_server_socket.h" | 30 #include "net/socket/ssl_server_socket.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 #endif // defined(TOOLKIT_GTK) | 75 #endif // defined(TOOLKIT_GTK) |
| 75 | 76 |
| 76 namespace { | 77 namespace { |
| 77 | 78 |
| 78 // This is used for tagging system event logs. | 79 // This is used for tagging system event logs. |
| 79 const char kApplicationName[] = "chromoting"; | 80 const char kApplicationName[] = "chromoting"; |
| 80 | 81 |
| 81 // The command line switch specifying the name of the daemon IPC endpoint. | 82 // The command line switch specifying the name of the daemon IPC endpoint. |
| 82 const char kDaemonIpcSwitchName[] = "daemon-pipe"; | 83 const char kDaemonIpcSwitchName[] = "daemon-pipe"; |
| 83 | 84 |
| 85 // The command line switch used to get version of the daemon. |
| 86 const char kVersionSwitchName[] = "version"; |
| 87 |
| 84 const char kUnofficialOAuth2ClientId[] = | 88 const char kUnofficialOAuth2ClientId[] = |
| 85 "440925447803-2pi3v45bff6tp1rde2f7q6lgbor3o5uj.apps.googleusercontent.com"; | 89 "440925447803-2pi3v45bff6tp1rde2f7q6lgbor3o5uj.apps.googleusercontent.com"; |
| 86 const char kUnofficialOAuth2ClientSecret[] = "W2ieEsG-R1gIA4MMurGrgMc_"; | 90 const char kUnofficialOAuth2ClientSecret[] = "W2ieEsG-R1gIA4MMurGrgMc_"; |
| 87 | 91 |
| 88 const char kOfficialOAuth2ClientId[] = | 92 const char kOfficialOAuth2ClientId[] = |
| 89 "440925447803-avn2sj1kc099s0r7v62je5s339mu0am1.apps.googleusercontent.com"; | 93 "440925447803-avn2sj1kc099s0r7v62je5s339mu0am1.apps.googleusercontent.com"; |
| 90 const char kOfficialOAuth2ClientSecret[] = "Bgur6DFiOMM1h8x-AQpuTQlK"; | 94 const char kOfficialOAuth2ClientSecret[] = "Bgur6DFiOMM1h8x-AQpuTQlK"; |
| 91 | 95 |
| 92 void QuitMessageLoop(MessageLoop* message_loop) { | 96 void QuitMessageLoop(MessageLoop* message_loop) { |
| 93 message_loop->PostTask(FROM_HERE, MessageLoop::QuitClosure()); | 97 message_loop->PostTask(FROM_HERE, MessageLoop::QuitClosure()); |
| (...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 691 // Needed so we don't leak objects when threads are created. | 695 // Needed so we don't leak objects when threads are created. |
| 692 base::mac::ScopedNSAutoreleasePool pool; | 696 base::mac::ScopedNSAutoreleasePool pool; |
| 693 #endif | 697 #endif |
| 694 | 698 |
| 695 CommandLine::Init(argc, argv); | 699 CommandLine::Init(argc, argv); |
| 696 | 700 |
| 697 // This object instance is required by Chrome code (for example, | 701 // This object instance is required by Chrome code (for example, |
| 698 // LazyInstance, MessageLoop). | 702 // LazyInstance, MessageLoop). |
| 699 base::AtExitManager exit_manager; | 703 base::AtExitManager exit_manager; |
| 700 | 704 |
| 705 if (CommandLine::ForCurrentProcess()->HasSwitch(kVersionSwitchName)) { |
| 706 printf("%s\n", STRINGIZE(VERSION)); |
| 707 return 0; |
| 708 } |
| 709 |
| 701 // Initialize logging with an appropriate log-file location, and default to | 710 // Initialize logging with an appropriate log-file location, and default to |
| 702 // log to that on Windows, or to standard error output otherwise. | 711 // log to that on Windows, or to standard error output otherwise. |
| 703 FilePath debug_log = remoting::GetConfigDir(). | 712 FilePath debug_log = remoting::GetConfigDir(). |
| 704 Append(FILE_PATH_LITERAL("debug.log")); | 713 Append(FILE_PATH_LITERAL("debug.log")); |
| 705 InitLogging(debug_log.value().c_str(), | 714 InitLogging(debug_log.value().c_str(), |
| 706 #if defined(OS_WIN) | 715 #if defined(OS_WIN) |
| 707 logging::LOG_ONLY_TO_FILE, | 716 logging::LOG_ONLY_TO_FILE, |
| 708 #else | 717 #else |
| 709 logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG, | 718 logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG, |
| 710 #endif | 719 #endif |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 779 user32.GetFunctionPointer("SetProcessDPIAware")); | 788 user32.GetFunctionPointer("SetProcessDPIAware")); |
| 780 set_process_dpi_aware(); | 789 set_process_dpi_aware(); |
| 781 } | 790 } |
| 782 | 791 |
| 783 // CommandLine::Init() ignores the passed |argc| and |argv| on Windows getting | 792 // CommandLine::Init() ignores the passed |argc| and |argv| on Windows getting |
| 784 // the command line from GetCommandLineW(), so we can safely pass NULL here. | 793 // the command line from GetCommandLineW(), so we can safely pass NULL here. |
| 785 return main(0, NULL); | 794 return main(0, NULL); |
| 786 } | 795 } |
| 787 | 796 |
| 788 #endif // defined(OS_WIN) | 797 #endif // defined(OS_WIN) |
| OLD | NEW |