| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <cstdint> | 9 #include <cstdint> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 #include "build/build_config.h" | 29 #include "build/build_config.h" |
| 30 #include "components/policy/policy_constants.h" | 30 #include "components/policy/policy_constants.h" |
| 31 #include "ipc/attachment_broker_unprivileged.h" | 31 #include "ipc/attachment_broker_unprivileged.h" |
| 32 #include "ipc/ipc_channel.h" | 32 #include "ipc/ipc_channel.h" |
| 33 #include "ipc/ipc_channel_proxy.h" | 33 #include "ipc/ipc_channel_proxy.h" |
| 34 #include "ipc/ipc_listener.h" | 34 #include "ipc/ipc_listener.h" |
| 35 #include "jingle/glue/thread_wrapper.h" | 35 #include "jingle/glue/thread_wrapper.h" |
| 36 #include "net/base/network_change_notifier.h" | 36 #include "net/base/network_change_notifier.h" |
| 37 #include "net/base/url_util.h" | 37 #include "net/base/url_util.h" |
| 38 #include "net/socket/client_socket_factory.h" | 38 #include "net/socket/client_socket_factory.h" |
| 39 #include "net/socket/ssl_server_socket.h" | |
| 40 #include "net/url_request/url_fetcher.h" | 39 #include "net/url_request/url_fetcher.h" |
| 41 #include "remoting/base/auto_thread_task_runner.h" | 40 #include "remoting/base/auto_thread_task_runner.h" |
| 42 #include "remoting/base/breakpad.h" | 41 #include "remoting/base/breakpad.h" |
| 43 #include "remoting/base/chromium_url_request.h" | 42 #include "remoting/base/chromium_url_request.h" |
| 44 #include "remoting/base/constants.h" | 43 #include "remoting/base/constants.h" |
| 45 #include "remoting/base/logging.h" | 44 #include "remoting/base/logging.h" |
| 46 #include "remoting/base/rsa_key_pair.h" | 45 #include "remoting/base/rsa_key_pair.h" |
| 47 #include "remoting/base/util.h" | 46 #include "remoting/base/util.h" |
| 48 #include "remoting/host/branding.h" | 47 #include "remoting/host/branding.h" |
| 49 #include "remoting/host/chromoting_host.h" | 48 #include "remoting/host/chromoting_host.h" |
| (...skipping 1585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1635 // Required for any calls into GTK functions, such as the Disconnect and | 1634 // Required for any calls into GTK functions, such as the Disconnect and |
| 1636 // Continue windows, though these should not be used for the Me2Me case | 1635 // Continue windows, though these should not be used for the Me2Me case |
| 1637 // (crbug.com/104377). | 1636 // (crbug.com/104377). |
| 1638 gtk_init(nullptr, nullptr); | 1637 gtk_init(nullptr, nullptr); |
| 1639 | 1638 |
| 1640 // Need to prime the host OS version value for linux to prevent IO on the | 1639 // Need to prime the host OS version value for linux to prevent IO on the |
| 1641 // network thread. base::GetLinuxDistro() caches the result. | 1640 // network thread. base::GetLinuxDistro() caches the result. |
| 1642 base::GetLinuxDistro(); | 1641 base::GetLinuxDistro(); |
| 1643 #endif | 1642 #endif |
| 1644 | 1643 |
| 1645 // Enable support for SSL server sockets, which must be done while still | |
| 1646 // single-threaded. | |
| 1647 net::EnableSSLServerSockets(); | |
| 1648 | |
| 1649 // Create the main message loop and start helper threads. | 1644 // Create the main message loop and start helper threads. |
| 1650 base::MessageLoopForUI message_loop; | 1645 base::MessageLoopForUI message_loop; |
| 1651 std::unique_ptr<ChromotingHostContext> context = | 1646 std::unique_ptr<ChromotingHostContext> context = |
| 1652 ChromotingHostContext::Create( | 1647 ChromotingHostContext::Create( |
| 1653 new AutoThreadTaskRunner(message_loop.task_runner(), | 1648 new AutoThreadTaskRunner(message_loop.task_runner(), |
| 1654 base::MessageLoop::QuitWhenIdleClosure())); | 1649 base::MessageLoop::QuitWhenIdleClosure())); |
| 1655 if (!context) | 1650 if (!context) |
| 1656 return kInitializationFailed; | 1651 return kInitializationFailed; |
| 1657 | 1652 |
| 1658 // NetworkChangeNotifier must be initialized after MessageLoop. | 1653 // NetworkChangeNotifier must be initialized after MessageLoop. |
| 1659 std::unique_ptr<net::NetworkChangeNotifier> network_change_notifier( | 1654 std::unique_ptr<net::NetworkChangeNotifier> network_change_notifier( |
| 1660 net::NetworkChangeNotifier::Create()); | 1655 net::NetworkChangeNotifier::Create()); |
| 1661 | 1656 |
| 1662 // Create & start the HostProcess using these threads. | 1657 // Create & start the HostProcess using these threads. |
| 1663 // TODO(wez): The HostProcess holds a reference to itself until Shutdown(). | 1658 // TODO(wez): The HostProcess holds a reference to itself until Shutdown(). |
| 1664 // Remove this hack as part of the multi-process refactoring. | 1659 // Remove this hack as part of the multi-process refactoring. |
| 1665 int exit_code = kSuccessExitCode; | 1660 int exit_code = kSuccessExitCode; |
| 1666 ShutdownWatchdog shutdown_watchdog( | 1661 ShutdownWatchdog shutdown_watchdog( |
| 1667 base::TimeDelta::FromSeconds(kShutdownTimeoutSeconds)); | 1662 base::TimeDelta::FromSeconds(kShutdownTimeoutSeconds)); |
| 1668 new HostProcess(std::move(context), &exit_code, &shutdown_watchdog); | 1663 new HostProcess(std::move(context), &exit_code, &shutdown_watchdog); |
| 1669 | 1664 |
| 1670 // Run the main (also UI) message loop until the host no longer needs it. | 1665 // Run the main (also UI) message loop until the host no longer needs it. |
| 1671 base::RunLoop().Run(); | 1666 base::RunLoop().Run(); |
| 1672 | 1667 |
| 1673 return exit_code; | 1668 return exit_code; |
| 1674 } | 1669 } |
| 1675 | 1670 |
| 1676 } // namespace remoting | 1671 } // namespace remoting |
| OLD | NEW |