| 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 "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| 11 #include "base/single_thread_task_runner.h" | 11 #include "base/single_thread_task_runner.h" |
| 12 #include "remoting/host/host_status_observer.h" | 12 #include "remoting/host/host_status_observer.h" |
| 13 #include "remoting/host/it2me/it2me_confirmation_dialog.h" |
| 14 #include "remoting/host/it2me/it2me_confirmation_dialog_proxy.h" |
| 13 #include "remoting/signaling/xmpp_signal_strategy.h" | 15 #include "remoting/signaling/xmpp_signal_strategy.h" |
| 14 | 16 |
| 15 namespace base { | 17 namespace base { |
| 16 class DictionaryValue; | 18 class DictionaryValue; |
| 17 } | 19 } |
| 18 | 20 |
| 19 namespace policy { | 21 namespace policy { |
| 20 class PolicyService; | 22 class PolicyService; |
| 21 } // namespace policy | 23 } // namespace policy |
| 22 | 24 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 virtual void OnClientAuthenticated(const std::string& client_username) = 0; | 59 virtual void OnClientAuthenticated(const std::string& client_username) = 0; |
| 58 virtual void OnStoreAccessCode(const std::string& access_code, | 60 virtual void OnStoreAccessCode(const std::string& access_code, |
| 59 base::TimeDelta access_code_lifetime) = 0; | 61 base::TimeDelta access_code_lifetime) = 0; |
| 60 virtual void OnNatPolicyChanged(bool nat_traversal_enabled) = 0; | 62 virtual void OnNatPolicyChanged(bool nat_traversal_enabled) = 0; |
| 61 virtual void OnStateChanged(It2MeHostState state) = 0; | 63 virtual void OnStateChanged(It2MeHostState state) = 0; |
| 62 }; | 64 }; |
| 63 | 65 |
| 64 It2MeHost( | 66 It2MeHost( |
| 65 scoped_ptr<ChromotingHostContext> context, | 67 scoped_ptr<ChromotingHostContext> context, |
| 66 scoped_ptr<policy_hack::PolicyWatcher> policy_watcher, | 68 scoped_ptr<policy_hack::PolicyWatcher> policy_watcher, |
| 69 scoped_ptr<It2MeConfirmationDialogFactory> confirmation_dialog_factory, |
| 67 base::WeakPtr<It2MeHost::Observer> observer, | 70 base::WeakPtr<It2MeHost::Observer> observer, |
| 68 const XmppSignalStrategy::XmppServerConfig& xmpp_server_config, | 71 const XmppSignalStrategy::XmppServerConfig& xmpp_server_config, |
| 69 const std::string& directory_bot_jid); | 72 const std::string& directory_bot_jid); |
| 70 | 73 |
| 71 // Methods called by the script object, from the plugin thread. | 74 // Methods called by the script object, from the plugin thread. |
| 72 | 75 |
| 73 // Creates It2Me host structures and starts the host. | 76 // Creates It2Me host structures and starts the host. |
| 74 virtual void Connect(); | 77 virtual void Connect(); |
| 75 | 78 |
| 76 // Disconnects the host, ready for tear-down. | 79 // Disconnects the host, ready for tear-down. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 99 } | 102 } |
| 100 base::WeakPtr<It2MeHost::Observer> observer() { return observer_; } | 103 base::WeakPtr<It2MeHost::Observer> observer() { return observer_; } |
| 101 | 104 |
| 102 private: | 105 private: |
| 103 // Updates state of the host. Can be called only on the network thread. | 106 // Updates state of the host. Can be called only on the network thread. |
| 104 void SetState(It2MeHostState state); | 107 void SetState(It2MeHostState state); |
| 105 | 108 |
| 106 // Returns true if the host is connected. | 109 // Returns true if the host is connected. |
| 107 bool IsConnected() const; | 110 bool IsConnected() const; |
| 108 | 111 |
| 112 void ConfirmAndConnect(); |
| 113 |
| 114 void OnConfirmationResult(It2MeConfirmationDialog::Result result); |
| 115 |
| 109 // Called by Connect() to check for policies and start connection process. | 116 // Called by Connect() to check for policies and start connection process. |
| 110 void ReadPolicyAndConnect(); | 117 void ReadPolicyAndConnect(); |
| 111 | 118 |
| 112 // Called by ReadPolicyAndConnect once policies have been read. | 119 // Called by ReadPolicyAndConnect once policies have been read. |
| 113 void FinishConnect(); | 120 void FinishConnect(); |
| 114 | 121 |
| 115 // Called when the support host registration completes. | 122 // Called when the support host registration completes. |
| 116 void OnReceivedSupportID(bool success, | 123 void OnReceivedSupportID(bool success, |
| 117 const std::string& support_id, | 124 const std::string& support_id, |
| 118 const base::TimeDelta& lifetime); | 125 const base::TimeDelta& lifetime); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 scoped_ptr<RegisterSupportHostRequest> register_request_; | 160 scoped_ptr<RegisterSupportHostRequest> register_request_; |
| 154 scoped_ptr<HostStatusLogger> host_status_logger_; | 161 scoped_ptr<HostStatusLogger> host_status_logger_; |
| 155 scoped_ptr<DesktopEnvironmentFactory> desktop_environment_factory_; | 162 scoped_ptr<DesktopEnvironmentFactory> desktop_environment_factory_; |
| 156 scoped_ptr<HostEventLogger> host_event_logger_; | 163 scoped_ptr<HostEventLogger> host_event_logger_; |
| 157 | 164 |
| 158 scoped_ptr<ChromotingHost> host_; | 165 scoped_ptr<ChromotingHost> host_; |
| 159 int failed_login_attempts_; | 166 int failed_login_attempts_; |
| 160 | 167 |
| 161 scoped_ptr<policy_hack::PolicyWatcher> policy_watcher_; | 168 scoped_ptr<policy_hack::PolicyWatcher> policy_watcher_; |
| 162 | 169 |
| 170 scoped_ptr<It2MeConfirmationDialogFactory> confirmation_dialog_factory_; |
| 171 scoped_ptr<It2MeConfirmationDialogProxy> confirmation_dialog_proxy_; |
| 172 |
| 163 // Host the current nat traversal policy setting. | 173 // Host the current nat traversal policy setting. |
| 164 bool nat_traversal_enabled_; | 174 bool nat_traversal_enabled_; |
| 165 | 175 |
| 166 // The host domain policy setting. | 176 // The host domain policy setting. |
| 167 std::string required_host_domain_; | 177 std::string required_host_domain_; |
| 168 | 178 |
| 169 // Indicates whether or not a policy has ever been read. This is to ensure | 179 // Indicates whether or not a policy has ever been read. This is to ensure |
| 170 // that on startup, we do not accidentally start a connection before we have | 180 // that on startup, we do not accidentally start a connection before we have |
| 171 // queried our policy restrictions. | 181 // queried our policy restrictions. |
| 172 bool policy_received_; | 182 bool policy_received_; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 201 const std::string& directory_bot_jid); | 211 const std::string& directory_bot_jid); |
| 202 | 212 |
| 203 private: | 213 private: |
| 204 policy::PolicyService* policy_service_; | 214 policy::PolicyService* policy_service_; |
| 205 DISALLOW_COPY_AND_ASSIGN(It2MeHostFactory); | 215 DISALLOW_COPY_AND_ASSIGN(It2MeHostFactory); |
| 206 }; | 216 }; |
| 207 | 217 |
| 208 } // namespace remoting | 218 } // namespace remoting |
| 209 | 219 |
| 210 #endif // REMOTING_HOST_IT2ME_IT2ME_HOST_H_ | 220 #endif // REMOTING_HOST_IT2ME_IT2ME_HOST_H_ |
| OLD | NEW |