| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_SOCKET_H_ | 5 #ifndef EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_SOCKET_H_ |
| 6 #define EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_SOCKET_H_ | 6 #define EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_SOCKET_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <queue> | 10 #include <queue> |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 FRIEND_TEST_ALL_PREFIXES(CastSocketTest, TestConnectAuthMessageCorrupted); | 211 FRIEND_TEST_ALL_PREFIXES(CastSocketTest, TestConnectAuthMessageCorrupted); |
| 212 FRIEND_TEST_ALL_PREFIXES(CastSocketTest, | 212 FRIEND_TEST_ALL_PREFIXES(CastSocketTest, |
| 213 TestConnectChallengeReplyReceiveError); | 213 TestConnectChallengeReplyReceiveError); |
| 214 FRIEND_TEST_ALL_PREFIXES(CastSocketTest, | 214 FRIEND_TEST_ALL_PREFIXES(CastSocketTest, |
| 215 TestConnectChallengeVerificationFails); | 215 TestConnectChallengeVerificationFails); |
| 216 friend class AuthTransportDelegate; | 216 friend class AuthTransportDelegate; |
| 217 friend class ApiResourceManager<CastSocketImpl>; | 217 friend class ApiResourceManager<CastSocketImpl>; |
| 218 friend class CastSocketTest; | 218 friend class CastSocketTest; |
| 219 friend class TestCastSocket; | 219 friend class TestCastSocket; |
| 220 | 220 |
| 221 static void EnsureNonceTimely(); |
| 222 |
| 221 void SetErrorState(ChannelError error_state) override; | 223 void SetErrorState(ChannelError error_state) override; |
| 222 | 224 |
| 223 // Frees resources and cancels pending callbacks. |ready_state_| will be set | 225 // Frees resources and cancels pending callbacks. |ready_state_| will be set |
| 224 // READY_STATE_CLOSED on completion. A no-op if |ready_state_| is already | 226 // READY_STATE_CLOSED on completion. A no-op if |ready_state_| is already |
| 225 // READY_STATE_CLOSED. | 227 // READY_STATE_CLOSED. |
| 226 void CloseInternal(); | 228 void CloseInternal(); |
| 227 | 229 |
| 228 // Creates an instance of TCPClientSocket. | 230 // Creates an instance of TCPClientSocket. |
| 229 virtual std::unique_ptr<net::TCPClientSocket> CreateTcpSocket(); | 231 virtual std::unique_ptr<net::TCPClientSocket> CreateTcpSocket(); |
| 230 // Creates an instance of SSLClientSocket with the given underlying |socket|. | 232 // Creates an instance of SSLClientSocket with the given underlying |socket|. |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 // Runs the external connection callback and resets it. | 278 // Runs the external connection callback and resets it. |
| 277 void DoConnectCallback(); | 279 void DoConnectCallback(); |
| 278 | 280 |
| 279 virtual bool CalledOnValidThread() const; | 281 virtual bool CalledOnValidThread() const; |
| 280 | 282 |
| 281 virtual base::Timer* GetTimer(); | 283 virtual base::Timer* GetTimer(); |
| 282 | 284 |
| 283 void SetConnectState(proto::ConnectionState connect_state); | 285 void SetConnectState(proto::ConnectionState connect_state); |
| 284 void SetReadyState(ReadyState ready_state); | 286 void SetReadyState(ReadyState ready_state); |
| 285 | 287 |
| 288 // The nonce challenge to send to the Cast receiver. |
| 289 // The nonce is updated daily. |
| 290 static std::string nonce_; |
| 291 static base::Time nonce_generation_time_; |
| 292 |
| 286 base::ThreadChecker thread_checker_; | 293 base::ThreadChecker thread_checker_; |
| 287 | 294 |
| 288 const std::string owner_extension_id_; | 295 const std::string owner_extension_id_; |
| 289 // The id of the channel. | 296 // The id of the channel. |
| 290 int channel_id_; | 297 int channel_id_; |
| 291 // The IP endpoint that the the channel is connected to. | 298 // The IP endpoint that the the channel is connected to. |
| 292 net::IPEndPoint ip_endpoint_; | 299 net::IPEndPoint ip_endpoint_; |
| 293 // Receiver authentication requested for the channel. | 300 // Receiver authentication requested for the channel. |
| 294 ChannelAuthType channel_auth_; | 301 ChannelAuthType channel_auth_; |
| 295 // The NetLog for this service. | 302 // The NetLog for this service. |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 // information. | 386 // information. |
| 380 AuthTransportDelegate* auth_delegate_; | 387 AuthTransportDelegate* auth_delegate_; |
| 381 | 388 |
| 382 DISALLOW_COPY_AND_ASSIGN(CastSocketImpl); | 389 DISALLOW_COPY_AND_ASSIGN(CastSocketImpl); |
| 383 }; | 390 }; |
| 384 } // namespace cast_channel | 391 } // namespace cast_channel |
| 385 } // namespace api | 392 } // namespace api |
| 386 } // namespace extensions | 393 } // namespace extensions |
| 387 | 394 |
| 388 #endif // EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_SOCKET_H_ | 395 #endif // EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_SOCKET_H_ |
| OLD | NEW |