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 COMPONENTS_CAST_CHANNEL_CAST_SOCKET_H_ |
6 #define EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_SOCKET_H_ | 6 #define COMPONENTS_CAST_CHANNEL_CAST_SOCKET_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <queue> | 10 #include <queue> |
11 #include <string> | 11 #include <string> |
12 | 12 |
13 #include "base/cancelable_callback.h" | 13 #include "base/cancelable_callback.h" |
14 #include "base/gtest_prod_util.h" | 14 #include "base/gtest_prod_util.h" |
15 #include "base/macros.h" | 15 #include "base/macros.h" |
16 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
17 #include "base/threading/thread_checker.h" | 17 #include "base/threading/thread_checker.h" |
18 #include "base/timer/timer.h" | 18 #include "base/timer/timer.h" |
| 19 #include "components/cast_channel/cast_auth_util.h" |
19 #include "components/cast_channel/cast_channel_enum.h" | 20 #include "components/cast_channel/cast_channel_enum.h" |
20 #include "extensions/browser/api/api_resource.h" | 21 #include "components/cast_channel/cast_socket.h" |
21 #include "extensions/browser/api/api_resource_manager.h" | 22 #include "components/cast_channel/cast_transport.h" |
22 #include "extensions/browser/api/cast_channel/cast_auth_util.h" | 23 #include "components/cast_channel/proto/logging.pb.h" |
23 #include "extensions/browser/api/cast_channel/cast_socket.h" | |
24 #include "extensions/browser/api/cast_channel/cast_transport.h" | |
25 #include "extensions/common/api/cast_channel/logging.pb.h" | |
26 #include "net/base/completion_callback.h" | 24 #include "net/base/completion_callback.h" |
27 #include "net/base/io_buffer.h" | 25 #include "net/base/io_buffer.h" |
28 #include "net/base/ip_endpoint.h" | 26 #include "net/base/ip_endpoint.h" |
29 #include "net/log/net_log_source.h" | 27 #include "net/log/net_log_source.h" |
30 | 28 |
31 namespace net { | 29 namespace net { |
32 class CertVerifier; | 30 class CertVerifier; |
33 class CTPolicyEnforcer; | 31 class CTPolicyEnforcer; |
34 class CTVerifier; | 32 class CTVerifier; |
35 class NetLog; | 33 class NetLog; |
36 class SSLClientSocket; | 34 class SSLClientSocket; |
37 class StreamSocket; | 35 class StreamSocket; |
38 class TCPClientSocket; | 36 class TCPClientSocket; |
39 class TransportSecurityState; | 37 class TransportSecurityState; |
40 class X509Certificate; | 38 class X509Certificate; |
41 } | 39 } |
42 | 40 |
43 namespace extensions { | |
44 namespace api { | |
45 namespace cast_channel { | 41 namespace cast_channel { |
46 class CastMessage; | 42 class CastMessage; |
47 class Logger; | 43 class Logger; |
48 struct LastErrors; | 44 struct LastErrors; |
49 | 45 |
50 // Cast device capabilities. | 46 // Cast device capabilities. |
51 enum CastDeviceCapability { | 47 enum CastDeviceCapability { |
52 NONE = 0, | 48 NONE = 0, |
53 VIDEO_OUT = 1 << 0, | 49 VIDEO_OUT = 1 << 0, |
54 VIDEO_IN = 1 << 1, | 50 VIDEO_IN = 1 << 1, |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 // DoConnectLoop. | 278 // DoConnectLoop. |
283 void ResetConnectLoopCallback(); | 279 void ResetConnectLoopCallback(); |
284 | 280 |
285 // Posts a task to invoke |connect_loop_callback_| with |result| on the | 281 // Posts a task to invoke |connect_loop_callback_| with |result| on the |
286 // current message loop. | 282 // current message loop. |
287 void PostTaskToStartConnectLoop(int result); | 283 void PostTaskToStartConnectLoop(int result); |
288 | 284 |
289 // Runs the external connection callback and resets it. | 285 // Runs the external connection callback and resets it. |
290 void DoConnectCallback(); | 286 void DoConnectCallback(); |
291 | 287 |
292 virtual bool CalledOnValidThread() const; | |
293 | |
294 virtual base::Timer* GetTimer(); | 288 virtual base::Timer* GetTimer(); |
295 | 289 |
296 void SetConnectState(proto::ConnectionState connect_state); | 290 void SetConnectState(proto::ConnectionState connect_state); |
297 void SetReadyState(ReadyState ready_state); | 291 void SetReadyState(ReadyState ready_state); |
298 | 292 |
299 base::ThreadChecker thread_checker_; | 293 THREAD_CHECKER(thread_checker_); |
300 | 294 |
301 // The id of the channel. | 295 // The id of the channel. |
302 int channel_id_; | 296 int channel_id_; |
303 // The IP endpoint that the the channel is connected to. | 297 // The IP endpoint that the the channel is connected to. |
304 net::IPEndPoint ip_endpoint_; | 298 net::IPEndPoint ip_endpoint_; |
305 // Receiver authentication requested for the channel. | 299 // Receiver authentication requested for the channel. |
306 ChannelAuthType channel_auth_; | 300 ChannelAuthType channel_auth_; |
307 // The NetLog for this service. | 301 // The NetLog for this service. |
308 net::NetLog* net_log_; | 302 net::NetLog* net_log_; |
309 // The NetLog source for this service. | 303 // The NetLog source for this service. |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 // Caller's message read and error handling delegate. | 383 // Caller's message read and error handling delegate. |
390 std::unique_ptr<CastTransport::Delegate> delegate_; | 384 std::unique_ptr<CastTransport::Delegate> delegate_; |
391 | 385 |
392 // Raw pointer to the auth handshake delegate. Used to get detailed error | 386 // Raw pointer to the auth handshake delegate. Used to get detailed error |
393 // information. | 387 // information. |
394 AuthTransportDelegate* auth_delegate_; | 388 AuthTransportDelegate* auth_delegate_; |
395 | 389 |
396 DISALLOW_COPY_AND_ASSIGN(CastSocketImpl); | 390 DISALLOW_COPY_AND_ASSIGN(CastSocketImpl); |
397 }; | 391 }; |
398 } // namespace cast_channel | 392 } // namespace cast_channel |
399 } // namespace api | |
400 } // namespace extensions | |
401 | 393 |
402 #endif // EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_SOCKET_H_ | 394 #endif // COMPONENTS_CAST_CHANNEL_CAST_SOCKET_H_ |
OLD | NEW |