| 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" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 #include <signal.h> | 61 #include <signal.h> |
| 62 #include "remoting/host/posix/signal_handler.h" | 62 #include "remoting/host/posix/signal_handler.h" |
| 63 #endif // defined(OS_POSIX) | 63 #endif // defined(OS_POSIX) |
| 64 | 64 |
| 65 #if defined(OS_MACOSX) | 65 #if defined(OS_MACOSX) |
| 66 #include "base/mac/scoped_cftyperef.h" | 66 #include "base/mac/scoped_cftyperef.h" |
| 67 #include "base/mac/scoped_nsautorelease_pool.h" | 67 #include "base/mac/scoped_nsautorelease_pool.h" |
| 68 #include "remoting/host/curtain_mode_mac.h" | 68 #include "remoting/host/curtain_mode_mac.h" |
| 69 #endif // defined(OS_MACOSX) | 69 #endif // defined(OS_MACOSX) |
| 70 | 70 |
| 71 #if defined(OS_POSIX) | 71 #if defined(OS_LINUX) |
| 72 #include <signal.h> | 72 #include "remoting/host/audio_capturer_linux.h" |
| 73 #endif // defined(OS_POSIX) | 73 #endif // defined(OS_LINUX) |
| 74 | 74 |
| 75 // N.B. OS_WIN is defined by including src/base headers. | 75 // N.B. OS_WIN is defined by including src/base headers. |
| 76 #if defined(OS_WIN) | 76 #if defined(OS_WIN) |
| 77 #include <commctrl.h> | 77 #include <commctrl.h> |
| 78 #include "remoting/host/win/session_desktop_environment_factory.h" | 78 #include "remoting/host/win/session_desktop_environment_factory.h" |
| 79 #endif // defined(OS_WIN) | 79 #endif // defined(OS_WIN) |
| 80 | 80 |
| 81 #if defined(TOOLKIT_GTK) | 81 #if defined(TOOLKIT_GTK) |
| 82 #include "ui/gfx/gtk_util.h" | 82 #include "ui/gfx/gtk_util.h" |
| 83 #endif // defined(TOOLKIT_GTK) | 83 #endif // defined(TOOLKIT_GTK) |
| 84 | 84 |
| 85 namespace { | 85 namespace { |
| 86 | 86 |
| 87 // This is used for tagging system event logs. | 87 // This is used for tagging system event logs. |
| 88 const char kApplicationName[] = "chromoting"; | 88 const char kApplicationName[] = "chromoting"; |
| 89 | 89 |
| 90 // The command line switch specifying the name of the daemon IPC endpoint. | 90 // The command line switch specifying the name of the daemon IPC endpoint. |
| 91 const char kDaemonIpcSwitchName[] = "daemon-pipe"; | 91 const char kDaemonIpcSwitchName[] = "daemon-pipe"; |
| 92 | 92 |
| 93 // The command line switch used to get version of the daemon. | 93 // The command line switch used to get version of the daemon. |
| 94 const char kVersionSwitchName[] = "version"; | 94 const char kVersionSwitchName[] = "version"; |
| 95 | 95 |
| 96 // The command line switch used to pass name of the pipe to capture audio on |
| 97 // linux. |
| 98 const char kAudioPipeSwitchName[] = "audio-pipe-name"; |
| 99 |
| 96 const char kUnofficialOAuth2ClientId[] = | 100 const char kUnofficialOAuth2ClientId[] = |
| 97 "440925447803-2pi3v45bff6tp1rde2f7q6lgbor3o5uj.apps.googleusercontent.com"; | 101 "440925447803-2pi3v45bff6tp1rde2f7q6lgbor3o5uj.apps.googleusercontent.com"; |
| 98 const char kUnofficialOAuth2ClientSecret[] = "W2ieEsG-R1gIA4MMurGrgMc_"; | 102 const char kUnofficialOAuth2ClientSecret[] = "W2ieEsG-R1gIA4MMurGrgMc_"; |
| 99 | 103 |
| 100 void QuitMessageLoop(MessageLoop* message_loop) { | 104 void QuitMessageLoop(MessageLoop* message_loop) { |
| 101 message_loop->PostTask(FROM_HERE, MessageLoop::QuitClosure()); | 105 message_loop->PostTask(FROM_HERE, MessageLoop::QuitClosure()); |
| 102 } | 106 } |
| 103 | 107 |
| 104 } // namespace | 108 } // namespace |
| 105 | 109 |
| (...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 695 | 699 |
| 696 #if defined(OS_MACOSX) || defined(OS_WIN) | 700 #if defined(OS_MACOSX) || defined(OS_WIN) |
| 697 scoped_ptr<HostUserInterface> host_user_interface_; | 701 scoped_ptr<HostUserInterface> host_user_interface_; |
| 698 #endif | 702 #endif |
| 699 | 703 |
| 700 scoped_refptr<ChromotingHost> host_; | 704 scoped_refptr<ChromotingHost> host_; |
| 701 | 705 |
| 702 int exit_code_; | 706 int exit_code_; |
| 703 | 707 |
| 704 #if defined(OS_MACOSX) | 708 #if defined(OS_MACOSX) |
| 705 remoting::CurtainMode curtain_; | 709 remoting::CurtainMode curtain_; |
| 706 #endif | 710 #endif // defined(OS_MACOSX) |
| 707 }; | 711 }; |
| 708 | 712 |
| 709 } // namespace remoting | 713 } // namespace remoting |
| 710 | 714 |
| 711 int main(int argc, char** argv) { | 715 int main(int argc, char** argv) { |
| 712 #if defined(OS_MACOSX) | 716 #if defined(OS_MACOSX) |
| 713 // Needed so we don't leak objects when threads are created. | 717 // Needed so we don't leak objects when threads are created. |
| 714 base::mac::ScopedNSAutoreleasePool pool; | 718 base::mac::ScopedNSAutoreleasePool pool; |
| 715 #endif | 719 #endif |
| 716 | 720 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 744 // Continue windows, though these should not be used for the Me2Me case | 748 // Continue windows, though these should not be used for the Me2Me case |
| 745 // (crbug.com/104377). | 749 // (crbug.com/104377). |
| 746 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); | 750 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); |
| 747 gfx::GtkInitFromCommandLine(*cmd_line); | 751 gfx::GtkInitFromCommandLine(*cmd_line); |
| 748 #endif // TOOLKIT_GTK | 752 #endif // TOOLKIT_GTK |
| 749 | 753 |
| 750 // Enable support for SSL server sockets, which must be done while still | 754 // Enable support for SSL server sockets, which must be done while still |
| 751 // single-threaded. | 755 // single-threaded. |
| 752 net::EnableSSLServerSockets(); | 756 net::EnableSSLServerSockets(); |
| 753 | 757 |
| 754 #if defined(OS_LINUX) | |
| 755 remoting::VideoFrameCapturer::EnableXDamage(true); | |
| 756 #endif | |
| 757 | |
| 758 // Create the main message loop and start helper threads. | 758 // Create the main message loop and start helper threads. |
| 759 MessageLoop message_loop(MessageLoop::TYPE_UI); | 759 MessageLoop message_loop(MessageLoop::TYPE_UI); |
| 760 base::Closure quit_message_loop = base::Bind(&QuitMessageLoop, &message_loop); | 760 base::Closure quit_message_loop = base::Bind(&QuitMessageLoop, &message_loop); |
| 761 scoped_ptr<remoting::ChromotingHostContext> context( | 761 scoped_ptr<remoting::ChromotingHostContext> context( |
| 762 new remoting::ChromotingHostContext( | 762 new remoting::ChromotingHostContext( |
| 763 new remoting::AutoThreadTaskRunner(message_loop.message_loop_proxy(), | 763 new remoting::AutoThreadTaskRunner(message_loop.message_loop_proxy(), |
| 764 quit_message_loop))); | 764 quit_message_loop))); |
| 765 |
| 766 #if defined(OS_LINUX) |
| 767 // TODO(sergeyu): Pass configuration parameters to the Linux-specific version |
| 768 // of DesktopEnvironmentFactory when we have it. |
| 769 remoting::VideoFrameCapturer::EnableXDamage(true); |
| 770 remoting::AudioCapturerLinux::SetPipeName(CommandLine::ForCurrentProcess()-> |
| 771 GetSwitchValuePath(kAudioPipeSwitchName)); |
| 772 #endif // defined(OS_LINUX) |
| 773 |
| 765 if (!context->Start()) | 774 if (!context->Start()) |
| 766 return remoting::kHostInitializationFailed; | 775 return remoting::kHostInitializationFailed; |
| 767 | 776 |
| 768 // Create the host process instance and enter the main message loop. | 777 // Create the host process instance and enter the main message loop. |
| 769 remoting::HostProcess me2me_host(context.Pass()); | 778 remoting::HostProcess me2me_host(context.Pass()); |
| 770 me2me_host.StartHostProcess(); | 779 me2me_host.StartHostProcess(); |
| 771 message_loop.Run(); | 780 message_loop.Run(); |
| 772 return me2me_host.get_exit_code(); | 781 return me2me_host.get_exit_code(); |
| 773 } | 782 } |
| 774 | 783 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 806 user32.GetFunctionPointer("SetProcessDPIAware")); | 815 user32.GetFunctionPointer("SetProcessDPIAware")); |
| 807 set_process_dpi_aware(); | 816 set_process_dpi_aware(); |
| 808 } | 817 } |
| 809 | 818 |
| 810 // CommandLine::Init() ignores the passed |argc| and |argv| on Windows getting | 819 // CommandLine::Init() ignores the passed |argc| and |argv| on Windows getting |
| 811 // the command line from GetCommandLineW(), so we can safely pass NULL here. | 820 // the command line from GetCommandLineW(), so we can safely pass NULL here. |
| 812 return main(0, NULL); | 821 return main(0, NULL); |
| 813 } | 822 } |
| 814 | 823 |
| 815 #endif // defined(OS_WIN) | 824 #endif // defined(OS_WIN) |
| OLD | NEW |