| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_IT2ME_IT2ME_HOST_H_ | 5 #ifndef REMOTING_HOST_IT2ME_IT2ME_HOST_H_ |
| 6 #define REMOTING_HOST_IT2ME_IT2ME_HOST_H_ | 6 #define REMOTING_HOST_IT2ME_IT2ME_HOST_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> |
| 9 | 10 |
| 10 #include "base/macros.h" | 11 #include "base/macros.h" |
| 11 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 13 #include "base/single_thread_task_runner.h" | 14 #include "base/single_thread_task_runner.h" |
| 14 #include "remoting/host/host_status_observer.h" | 15 #include "remoting/host/host_status_observer.h" |
| 15 #include "remoting/host/it2me/it2me_confirmation_dialog.h" | 16 #include "remoting/host/it2me/it2me_confirmation_dialog.h" |
| 16 #include "remoting/host/it2me/it2me_confirmation_dialog_proxy.h" | 17 #include "remoting/host/it2me/it2me_confirmation_dialog_proxy.h" |
| 17 #include "remoting/protocol/validating_authenticator.h" | 18 #include "remoting/protocol/validating_authenticator.h" |
| 18 #include "remoting/signaling/xmpp_signal_strategy.h" | 19 #include "remoting/signaling/xmpp_signal_strategy.h" |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 const std::string& remote_jid, | 159 const std::string& remote_jid, |
| 159 const protocol::ValidatingAuthenticator::ResultCallback& result_callback); | 160 const protocol::ValidatingAuthenticator::ResultCallback& result_callback); |
| 160 | 161 |
| 161 // Caller supplied fields. | 162 // Caller supplied fields. |
| 162 std::unique_ptr<ChromotingHostContext> host_context_; | 163 std::unique_ptr<ChromotingHostContext> host_context_; |
| 163 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 164 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| 164 base::WeakPtr<It2MeHost::Observer> observer_; | 165 base::WeakPtr<It2MeHost::Observer> observer_; |
| 165 XmppSignalStrategy::XmppServerConfig xmpp_server_config_; | 166 XmppSignalStrategy::XmppServerConfig xmpp_server_config_; |
| 166 std::string directory_bot_jid_; | 167 std::string directory_bot_jid_; |
| 167 | 168 |
| 168 It2MeHostState state_; | 169 It2MeHostState state_ = kDisconnected; |
| 169 | 170 |
| 170 scoped_refptr<RsaKeyPair> host_key_pair_; | 171 scoped_refptr<RsaKeyPair> host_key_pair_; |
| 171 std::unique_ptr<SignalStrategy> signal_strategy_; | 172 std::unique_ptr<SignalStrategy> signal_strategy_; |
| 172 std::unique_ptr<RegisterSupportHostRequest> register_request_; | 173 std::unique_ptr<RegisterSupportHostRequest> register_request_; |
| 173 std::unique_ptr<HostStatusLogger> host_status_logger_; | 174 std::unique_ptr<HostStatusLogger> host_status_logger_; |
| 174 std::unique_ptr<DesktopEnvironmentFactory> desktop_environment_factory_; | 175 std::unique_ptr<DesktopEnvironmentFactory> desktop_environment_factory_; |
| 175 std::unique_ptr<HostEventLogger> host_event_logger_; | 176 std::unique_ptr<HostEventLogger> host_event_logger_; |
| 176 | 177 |
| 177 std::unique_ptr<ChromotingHost> host_; | 178 std::unique_ptr<ChromotingHost> host_; |
| 178 int failed_login_attempts_; | 179 int failed_login_attempts_ = 0; |
| 179 | 180 |
| 180 std::unique_ptr<PolicyWatcher> policy_watcher_; | 181 std::unique_ptr<PolicyWatcher> policy_watcher_; |
| 181 std::unique_ptr<It2MeConfirmationDialogFactory> confirmation_dialog_factory_; | 182 std::unique_ptr<It2MeConfirmationDialogFactory> confirmation_dialog_factory_; |
| 182 std::unique_ptr<It2MeConfirmationDialogProxy> confirmation_dialog_proxy_; | 183 std::unique_ptr<It2MeConfirmationDialogProxy> confirmation_dialog_proxy_; |
| 183 | 184 |
| 184 // Host the current nat traversal policy setting. | 185 // Host the current nat traversal policy setting. |
| 185 bool nat_traversal_enabled_; | 186 bool nat_traversal_enabled_ = false; |
| 186 | 187 |
| 187 // The client and host domain policy setting. | 188 // The client and host domain policy setting. |
| 188 std::string required_client_domain_; | 189 std::string required_client_domain_; |
| 189 std::string required_host_domain_; | 190 std::string required_host_domain_; |
| 190 | 191 |
| 191 // Indicates whether or not a policy has ever been read. This is to ensure | 192 // Indicates whether or not a policy has ever been read. This is to ensure |
| 192 // that on startup, we do not accidentally start a connection before we have | 193 // that on startup, we do not accidentally start a connection before we have |
| 193 // queried our policy restrictions. | 194 // queried our policy restrictions. |
| 194 bool policy_received_; | 195 bool policy_received_ = false; |
| 195 | 196 |
| 196 // On startup, it is possible to have Connect() called before the policy read | 197 // On startup, it is possible to have Connect() called before the policy read |
| 197 // is completed. Rather than just failing, we thunk the connection call so | 198 // is completed. Rather than just failing, we thunk the connection call so |
| 198 // it can be executed after at least one successful policy read. This | 199 // it can be executed after at least one successful policy read. This |
| 199 // variable contains the thunk if it is necessary. | 200 // variable contains the thunk if it is necessary. |
| 200 base::Closure pending_connect_; | 201 base::Closure pending_connect_; |
| 201 | 202 |
| 202 // Called after the client machine initiates the connection process and | 203 // Called after the client machine initiates the connection process and |
| 203 // determines whether to reject the connection or allow it to continue. | 204 // determines whether to reject the connection or allow it to continue. |
| 204 protocol::ValidatingAuthenticator::ValidationCallback validation_callback_; | 205 protocol::ValidatingAuthenticator::ValidationCallback validation_callback_; |
| 205 | 206 |
| 206 DISALLOW_COPY_AND_ASSIGN(It2MeHost); | 207 DISALLOW_COPY_AND_ASSIGN(It2MeHost); |
| 207 }; | 208 }; |
| 208 | 209 |
| 209 // Having a factory interface makes it possible for the test to provide a mock | 210 // Having a factory interface makes it possible for the test to provide a mock |
| 210 // implementation of the It2MeHost. | 211 // implementation of the It2MeHost. |
| 211 class It2MeHostFactory { | 212 class It2MeHostFactory { |
| 212 public: | 213 public: |
| 213 It2MeHostFactory(); | 214 It2MeHostFactory(); |
| 214 virtual ~It2MeHostFactory(); | 215 virtual ~It2MeHostFactory(); |
| 215 | 216 |
| 216 // |policy_service| is used for creating the policy watcher for new | 217 // |policy_service| is used for creating the policy watcher for new |
| 217 // instances of It2MeHost on ChromeOS. The caller must ensure that | 218 // instances of It2MeHost on ChromeOS. The caller must ensure that |
| 218 // |policy_service| is valid throughout the lifetime of the It2MeHostFactory | 219 // |policy_service| is valid throughout the lifetime of each created It2MeHost |
| 219 // and each created It2MeHost object. This is currently possible because | 220 // object. This is currently possible because |policy_service| is a global |
| 220 // |policy_service| is a global singleton available from the browser process. | 221 // singleton available from the browser process. |
| 221 virtual void set_policy_service(policy::PolicyService* policy_service); | |
| 222 | |
| 223 virtual scoped_refptr<It2MeHost> CreateIt2MeHost( | 222 virtual scoped_refptr<It2MeHost> CreateIt2MeHost( |
| 224 std::unique_ptr<ChromotingHostContext> context, | 223 std::unique_ptr<ChromotingHostContext> context, |
| 224 policy::PolicyService* policy_service, |
| 225 base::WeakPtr<It2MeHost::Observer> observer, | 225 base::WeakPtr<It2MeHost::Observer> observer, |
| 226 const XmppSignalStrategy::XmppServerConfig& xmpp_server_config, | 226 const XmppSignalStrategy::XmppServerConfig& xmpp_server_config, |
| 227 const std::string& directory_bot_jid); | 227 const std::string& directory_bot_jid); |
| 228 | 228 |
| 229 private: | 229 private: |
| 230 policy::PolicyService* policy_service_; | |
| 231 DISALLOW_COPY_AND_ASSIGN(It2MeHostFactory); | 230 DISALLOW_COPY_AND_ASSIGN(It2MeHostFactory); |
| 232 }; | 231 }; |
| 233 | 232 |
| 234 } // namespace remoting | 233 } // namespace remoting |
| 235 | 234 |
| 236 #endif // REMOTING_HOST_IT2ME_IT2ME_HOST_H_ | 235 #endif // REMOTING_HOST_IT2ME_IT2ME_HOST_H_ |
| OLD | NEW |