| 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 #ifndef REMOTING_HOST_CHROMOTING_HOST_H_ | 5 #ifndef REMOTING_HOST_CHROMOTING_HOST_H_ |
| 6 #define REMOTING_HOST_CHROMOTING_HOST_H_ | 6 #define REMOTING_HOST_CHROMOTING_HOST_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "base/memory/scoped_vector.h" | 14 #include "base/memory/scoped_vector.h" |
| 15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 16 #include "base/observer_list.h" | 16 #include "base/observer_list.h" |
| 17 #include "base/threading/non_thread_safe.h" | 17 #include "base/threading/non_thread_safe.h" |
| 18 #include "base/threading/thread.h" | 18 #include "base/threading/thread.h" |
| 19 #include "net/base/backoff_entry.h" | 19 #include "net/base/backoff_entry.h" |
| 20 #include "remoting/host/chromoting_host_context.h" |
| 20 #include "remoting/host/client_session.h" | 21 #include "remoting/host/client_session.h" |
| 21 #include "remoting/host/host_extension.h" | 22 #include "remoting/host/host_extension.h" |
| 22 #include "remoting/host/host_status_monitor.h" | 23 #include "remoting/host/host_status_monitor.h" |
| 23 #include "remoting/host/host_status_observer.h" | 24 #include "remoting/host/host_status_observer.h" |
| 24 #include "remoting/protocol/authenticator.h" | 25 #include "remoting/protocol/authenticator.h" |
| 25 #include "remoting/protocol/connection_to_client.h" | 26 #include "remoting/protocol/connection_to_client.h" |
| 26 #include "remoting/protocol/pairing_registry.h" | 27 #include "remoting/protocol/pairing_registry.h" |
| 27 #include "remoting/protocol/session_manager.h" | 28 #include "remoting/protocol/session_manager.h" |
| 28 | 29 |
| 29 namespace base { | 30 namespace base { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 // incoming connection. | 65 // incoming connection. |
| 65 class ChromotingHost : public base::NonThreadSafe, | 66 class ChromotingHost : public base::NonThreadSafe, |
| 66 public ClientSession::EventHandler, | 67 public ClientSession::EventHandler, |
| 67 public HostStatusMonitor { | 68 public HostStatusMonitor { |
| 68 public: | 69 public: |
| 69 // |desktop_environment_factory| must outlive this object. | 70 // |desktop_environment_factory| must outlive this object. |
| 70 ChromotingHost( | 71 ChromotingHost( |
| 71 DesktopEnvironmentFactory* desktop_environment_factory, | 72 DesktopEnvironmentFactory* desktop_environment_factory, |
| 72 std::unique_ptr<protocol::SessionManager> session_manager, | 73 std::unique_ptr<protocol::SessionManager> session_manager, |
| 73 scoped_refptr<protocol::TransportContext> transport_context, | 74 scoped_refptr<protocol::TransportContext> transport_context, |
| 74 scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner, | 75 const ChromotingHostContext& context); |
| 75 scoped_refptr<base::SingleThreadTaskRunner> video_encode_task_runner); | |
| 76 ~ChromotingHost() override; | 76 ~ChromotingHost() override; |
| 77 | 77 |
| 78 // Asynchronously starts the host. | 78 // Asynchronously starts the host. |
| 79 // | 79 // |
| 80 // After this is invoked, the host process will connect to the talk | 80 // After this is invoked, the host process will connect to the talk |
| 81 // network and start listening for incoming connections. | 81 // network and start listening for incoming connections. |
| 82 // | 82 // |
| 83 // This method can only be called once during the lifetime of this object. | 83 // This method can only be called once during the lifetime of this object. |
| 84 void Start(const std::string& host_owner); | 84 void Start(const std::string& host_owner); |
| 85 | 85 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 // callbacks for disconnected clients after this call returns. | 148 // callbacks for disconnected clients after this call returns. |
| 149 void DisconnectAllClients(); | 149 void DisconnectAllClients(); |
| 150 | 150 |
| 151 // Unless specified otherwise all members of this class must be | 151 // Unless specified otherwise all members of this class must be |
| 152 // used on the network thread only. | 152 // used on the network thread only. |
| 153 | 153 |
| 154 // Parameters specified when the host was created. | 154 // Parameters specified when the host was created. |
| 155 DesktopEnvironmentFactory* desktop_environment_factory_; | 155 DesktopEnvironmentFactory* desktop_environment_factory_; |
| 156 std::unique_ptr<protocol::SessionManager> session_manager_; | 156 std::unique_ptr<protocol::SessionManager> session_manager_; |
| 157 scoped_refptr<protocol::TransportContext> transport_context_; | 157 scoped_refptr<protocol::TransportContext> transport_context_; |
| 158 scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner_; | 158 std::unique_ptr<ChromotingHostContext> context_; |
| 159 scoped_refptr<base::SingleThreadTaskRunner> video_encode_task_runner_; | |
| 160 | 159 |
| 161 // Must be used on the network thread only. | 160 // Must be used on the network thread only. |
| 162 base::ObserverList<HostStatusObserver> status_observers_; | 161 base::ObserverList<HostStatusObserver> status_observers_; |
| 163 | 162 |
| 164 // The connections to remote clients. | 163 // The connections to remote clients. |
| 165 ClientList clients_; | 164 ClientList clients_; |
| 166 | 165 |
| 167 // True if the host has been started. | 166 // True if the host has been started. |
| 168 bool started_; | 167 bool started_; |
| 169 | 168 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 183 HostExtensionList extensions_; | 182 HostExtensionList extensions_; |
| 184 | 183 |
| 185 base::WeakPtrFactory<ChromotingHost> weak_factory_; | 184 base::WeakPtrFactory<ChromotingHost> weak_factory_; |
| 186 | 185 |
| 187 DISALLOW_COPY_AND_ASSIGN(ChromotingHost); | 186 DISALLOW_COPY_AND_ASSIGN(ChromotingHost); |
| 188 }; | 187 }; |
| 189 | 188 |
| 190 } // namespace remoting | 189 } // namespace remoting |
| 191 | 190 |
| 192 #endif // REMOTING_HOST_CHROMOTING_HOST_H_ | 191 #endif // REMOTING_HOST_CHROMOTING_HOST_H_ |
| OLD | NEW |