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 // Presents a confirmation dialog to the user before starting the connection |
| 113 // process. |
| 114 void ShowConfirmationPrompt(); |
| 115 |
| 116 // Processes the result of the confirmation dialog. |
| 117 void OnConfirmationResult(It2MeConfirmationDialog::Result result); |
| 118 |
109 // Called by Connect() to check for policies and start connection process. | 119 // Called by Connect() to check for policies and start connection process. |
110 void ReadPolicyAndConnect(); | 120 void ReadPolicyAndConnect(); |
111 | 121 |
112 // Called by ReadPolicyAndConnect once policies have been read. | 122 // Called by ReadPolicyAndConnect once policies have been read. |
113 void FinishConnect(); | 123 void FinishConnect(); |
114 | 124 |
115 // Called when the support host registration completes. | 125 // Called when the support host registration completes. |
116 void OnReceivedSupportID(bool success, | 126 void OnReceivedSupportID(bool success, |
117 const std::string& support_id, | 127 const std::string& support_id, |
118 const base::TimeDelta& lifetime); | 128 const base::TimeDelta& lifetime); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 scoped_ptr<SignalStrategy> signal_strategy_; | 162 scoped_ptr<SignalStrategy> signal_strategy_; |
153 scoped_ptr<RegisterSupportHostRequest> register_request_; | 163 scoped_ptr<RegisterSupportHostRequest> register_request_; |
154 scoped_ptr<HostStatusLogger> host_status_logger_; | 164 scoped_ptr<HostStatusLogger> host_status_logger_; |
155 scoped_ptr<DesktopEnvironmentFactory> desktop_environment_factory_; | 165 scoped_ptr<DesktopEnvironmentFactory> desktop_environment_factory_; |
156 scoped_ptr<HostEventLogger> host_event_logger_; | 166 scoped_ptr<HostEventLogger> host_event_logger_; |
157 | 167 |
158 scoped_ptr<ChromotingHost> host_; | 168 scoped_ptr<ChromotingHost> host_; |
159 int failed_login_attempts_; | 169 int failed_login_attempts_; |
160 | 170 |
161 scoped_ptr<policy_hack::PolicyWatcher> policy_watcher_; | 171 scoped_ptr<policy_hack::PolicyWatcher> policy_watcher_; |
| 172 scoped_ptr<It2MeConfirmationDialogFactory> confirmation_dialog_factory_; |
| 173 scoped_ptr<It2MeConfirmationDialogProxy> confirmation_dialog_proxy_; |
162 | 174 |
163 // Host the current nat traversal policy setting. | 175 // Host the current nat traversal policy setting. |
164 bool nat_traversal_enabled_; | 176 bool nat_traversal_enabled_; |
165 | 177 |
166 // The host domain policy setting. | 178 // The host domain policy setting. |
167 std::string required_host_domain_; | 179 std::string required_host_domain_; |
168 | 180 |
169 // Indicates whether or not a policy has ever been read. This is to ensure | 181 // 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 | 182 // that on startup, we do not accidentally start a connection before we have |
171 // queried our policy restrictions. | 183 // queried our policy restrictions. |
(...skipping 29 matching lines...) Expand all Loading... |
201 const std::string& directory_bot_jid); | 213 const std::string& directory_bot_jid); |
202 | 214 |
203 private: | 215 private: |
204 policy::PolicyService* policy_service_; | 216 policy::PolicyService* policy_service_; |
205 DISALLOW_COPY_AND_ASSIGN(It2MeHostFactory); | 217 DISALLOW_COPY_AND_ASSIGN(It2MeHostFactory); |
206 }; | 218 }; |
207 | 219 |
208 } // namespace remoting | 220 } // namespace remoting |
209 | 221 |
210 #endif // REMOTING_HOST_IT2ME_IT2ME_HOST_H_ | 222 #endif // REMOTING_HOST_IT2ME_IT2ME_HOST_H_ |
OLD | NEW |