Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(102)

Side by Side Diff: remoting/host/it2me/it2me_host.h

Issue 2724223003: Disconnect all users if too many connection requests are received for It2Me (Closed)
Patch Set: Fixing another non-Windows build error Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | remoting/host/it2me/it2me_host.cc » ('j') | remoting/host/it2me/it2me_host.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 void SetStateForTesting(It2MeHostState state, 91 void SetStateForTesting(It2MeHostState state,
92 const std::string& error_message) { 92 const std::string& error_message) {
93 SetState(state, error_message); 93 SetState(state, error_message);
94 } 94 }
95 95
96 // Updates the current policies based on |policies|. Runs |done_callback| on 96 // Updates the current policies based on |policies|. Runs |done_callback| on
97 // the calling thread once the policies have been updated. 97 // the calling thread once the policies have been updated.
98 void SetPolicyForTesting(std::unique_ptr<base::DictionaryValue> policies, 98 void SetPolicyForTesting(std::unique_ptr<base::DictionaryValue> policies,
99 const base::Closure& done_callback); 99 const base::Closure& done_callback);
100 100
101 // Returns the callback used for validating the connection. Do not run the 101 // Returns the callback used for validating incoming connections.
102 // returned callback after this object has been destroyed. 102 // Do not run the returned callback after this object has been destroyed.
103 protocol::ValidatingAuthenticator::ValidationCallback 103 protocol::ValidatingAuthenticator::ValidationCallback
104 GetValidationCallbackForTesting(); 104 GetIncomingConnectionCallbackForTesting();
105
106 // Returns the callback used for validating accepted connections.
107 // Do not run the returned callback after this object has been destroyed.
108 protocol::ValidatingAuthenticator::ValidationCallback
109 GetAcceptedConnectionCallbackForTesting();
105 110
106 protected: 111 protected:
107 friend class base::RefCountedThreadSafe<It2MeHost>; 112 friend class base::RefCountedThreadSafe<It2MeHost>;
108 113
109 ~It2MeHost() override; 114 ~It2MeHost() override;
110 115
111 ChromotingHostContext* host_context() { return host_context_.get(); } 116 ChromotingHostContext* host_context() { return host_context_.get(); }
112 base::WeakPtr<It2MeHost::Observer> observer() { return observer_; } 117 base::WeakPtr<It2MeHost::Observer> observer() { return observer_; }
113 118
114 private: 119 private:
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 void UpdateClientDomainPolicy(const std::string& client_domain); 151 void UpdateClientDomainPolicy(const std::string& client_domain);
147 152
148 void DisconnectOnNetworkThread(); 153 void DisconnectOnNetworkThread();
149 154
150 // Uses details of the connection and current policies to determine if the 155 // Uses details of the connection and current policies to determine if the
151 // connection should be accepted or rejected. 156 // connection should be accepted or rejected.
152 void ValidateConnectionDetails( 157 void ValidateConnectionDetails(
153 const std::string& remote_jid, 158 const std::string& remote_jid,
154 const protocol::ValidatingAuthenticator::ResultCallback& result_callback); 159 const protocol::ValidatingAuthenticator::ResultCallback& result_callback);
155 160
161 // Allows the user to accept or reject the connection before it is completed.
162 void ShowConfirmationDialog(
163 const std::string& remote_jid,
164 const protocol::ValidatingAuthenticator::ResultCallback& result_callback);
165
156 // Caller supplied fields. 166 // Caller supplied fields.
157 std::unique_ptr<ChromotingHostContext> host_context_; 167 std::unique_ptr<ChromotingHostContext> host_context_;
158 base::WeakPtr<It2MeHost::Observer> observer_; 168 base::WeakPtr<It2MeHost::Observer> observer_;
159 std::unique_ptr<SignalStrategy> signal_strategy_; 169 std::unique_ptr<SignalStrategy> signal_strategy_;
160 std::string username_; 170 std::string username_;
161 std::string directory_bot_jid_; 171 std::string directory_bot_jid_;
162 172
163 It2MeHostState state_ = kDisconnected; 173 It2MeHostState state_ = kDisconnected;
164 174
165 scoped_refptr<RsaKeyPair> host_key_pair_; 175 scoped_refptr<RsaKeyPair> host_key_pair_;
(...skipping 20 matching lines...) Expand all
186 // that on startup, we do not accidentally start a connection before we have 196 // that on startup, we do not accidentally start a connection before we have
187 // queried our policy restrictions. 197 // queried our policy restrictions.
188 bool policy_received_ = false; 198 bool policy_received_ = false;
189 199
190 // On startup, it is possible to have Connect() called before the policy read 200 // On startup, it is possible to have Connect() called before the policy read
191 // is completed. Rather than just failing, we thunk the connection call so 201 // is completed. Rather than just failing, we thunk the connection call so
192 // it can be executed after at least one successful policy read. This 202 // it can be executed after at least one successful policy read. This
193 // variable contains the thunk if it is necessary. 203 // variable contains the thunk if it is necessary.
194 base::Closure pending_connect_; 204 base::Closure pending_connect_;
195 205
196 // Called after the client machine initiates the connection process and
197 // determines whether to reject the connection or allow it to continue.
198 protocol::ValidatingAuthenticator::ValidationCallback validation_callback_;
199
200 DISALLOW_COPY_AND_ASSIGN(It2MeHost); 206 DISALLOW_COPY_AND_ASSIGN(It2MeHost);
201 }; 207 };
202 208
203 // Having a factory interface makes it possible for the test to provide a mock 209 // Having a factory interface makes it possible for the test to provide a mock
204 // implementation of the It2MeHost. 210 // implementation of the It2MeHost.
205 class It2MeHostFactory { 211 class It2MeHostFactory {
206 public: 212 public:
207 It2MeHostFactory(); 213 It2MeHostFactory();
208 virtual ~It2MeHostFactory(); 214 virtual ~It2MeHostFactory();
209 215
(...skipping 10 matching lines...) Expand all
220 const std::string& username, 226 const std::string& username,
221 const std::string& directory_bot_jid); 227 const std::string& directory_bot_jid);
222 228
223 private: 229 private:
224 DISALLOW_COPY_AND_ASSIGN(It2MeHostFactory); 230 DISALLOW_COPY_AND_ASSIGN(It2MeHostFactory);
225 }; 231 };
226 232
227 } // namespace remoting 233 } // namespace remoting
228 234
229 #endif // REMOTING_HOST_IT2ME_IT2ME_HOST_H_ 235 #endif // REMOTING_HOST_IT2ME_IT2ME_HOST_H_
OLDNEW
« no previous file with comments | « no previous file | remoting/host/it2me/it2me_host.cc » ('j') | remoting/host/it2me/it2me_host.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698