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