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 #include <string> |
10 | 10 |
(...skipping 19 matching lines...) Expand all Loading... |
30 class ChromotingHost; | 30 class ChromotingHost; |
31 class ChromotingHostContext; | 31 class ChromotingHostContext; |
32 class DesktopEnvironmentFactory; | 32 class DesktopEnvironmentFactory; |
33 class HostEventLogger; | 33 class HostEventLogger; |
34 class HostNPScriptObject; | 34 class HostNPScriptObject; |
35 class HostStatusLogger; | 35 class HostStatusLogger; |
36 class PolicyWatcher; | 36 class PolicyWatcher; |
37 class RegisterSupportHostRequest; | 37 class RegisterSupportHostRequest; |
38 class RsaKeyPair; | 38 class RsaKeyPair; |
39 | 39 |
40 // These state values are duplicated in host_session.js and the Android Java | 40 // These state values are duplicated in host_session.js. Remember to update |
41 // It2MeObserver class. Remember to update all copies when making changes. | 41 // both copies when making changes. |
42 enum It2MeHostState { | 42 enum It2MeHostState { |
43 kDisconnected, | 43 kDisconnected, |
44 kStarting, | 44 kStarting, |
45 kRequestedAccessCode, | 45 kRequestedAccessCode, |
46 kReceivedAccessCode, | 46 kReceivedAccessCode, |
| 47 kConnecting, |
47 kConnected, | 48 kConnected, |
48 kError, | 49 kError, |
49 kInvalidDomainError | 50 kInvalidDomainError, |
50 }; | 51 }; |
51 | 52 |
52 // Internal implementation of the plugin's It2Me host function. | 53 // Internal implementation of the plugin's It2Me host function. |
53 class It2MeHost : public base::RefCountedThreadSafe<It2MeHost>, | 54 class It2MeHost : public base::RefCountedThreadSafe<It2MeHost>, |
54 public HostStatusObserver { | 55 public HostStatusObserver { |
55 public: | 56 public: |
56 class Observer { | 57 class Observer { |
57 public: | 58 public: |
58 virtual void OnClientAuthenticated(const std::string& client_username) = 0; | 59 virtual void OnClientAuthenticated(const std::string& client_username) = 0; |
59 virtual void OnStoreAccessCode(const std::string& access_code, | 60 virtual void OnStoreAccessCode(const std::string& access_code, |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 | 109 |
109 ~It2MeHost() override; | 110 ~It2MeHost() override; |
110 | 111 |
111 ChromotingHostContext* host_context() { return host_context_.get(); } | 112 ChromotingHostContext* host_context() { return host_context_.get(); } |
112 base::WeakPtr<It2MeHost::Observer> observer() { return observer_; } | 113 base::WeakPtr<It2MeHost::Observer> observer() { return observer_; } |
113 | 114 |
114 private: | 115 private: |
115 // Updates state of the host. Can be called only on the network thread. | 116 // Updates state of the host. Can be called only on the network thread. |
116 void SetState(It2MeHostState state, const std::string& error_message); | 117 void SetState(It2MeHostState state, const std::string& error_message); |
117 | 118 |
118 // Returns true if the host is connected. | 119 // Returns true if the host is in a post-starting, non-error state. |
119 bool IsConnected() const; | 120 bool IsRunning() const; |
120 | 121 |
121 // Processes the result of the confirmation dialog. | 122 // Processes the result of the confirmation dialog. |
122 void OnConfirmationResult( | 123 void OnConfirmationResult( |
123 const protocol::ValidatingAuthenticator::ResultCallback& result_callback, | 124 const protocol::ValidatingAuthenticator::ResultCallback& result_callback, |
124 It2MeConfirmationDialog::Result result); | 125 It2MeConfirmationDialog::Result result); |
125 | 126 |
126 // Called by Connect() to check for policies and start connection process. | 127 // Called by Connect() to check for policies and start connection process. |
127 void ReadPolicyAndConnect(); | 128 void ReadPolicyAndConnect(); |
128 | 129 |
129 // Called by ReadPolicyAndConnect once policies have been read. | 130 // Called by ReadPolicyAndConnect once policies have been read. |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 const std::string& username, | 221 const std::string& username, |
221 const std::string& directory_bot_jid); | 222 const std::string& directory_bot_jid); |
222 | 223 |
223 private: | 224 private: |
224 DISALLOW_COPY_AND_ASSIGN(It2MeHostFactory); | 225 DISALLOW_COPY_AND_ASSIGN(It2MeHostFactory); |
225 }; | 226 }; |
226 | 227 |
227 } // namespace remoting | 228 } // namespace remoting |
228 | 229 |
229 #endif // REMOTING_HOST_IT2ME_IT2ME_HOST_H_ | 230 #endif // REMOTING_HOST_IT2ME_IT2ME_HOST_H_ |
OLD | NEW |