| 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> |
| 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_channel_enum.h" |
| 20 #include "extensions/browser/api/api_resource.h" |
| 21 #include "extensions/browser/api/api_resource_manager.h" |
| 19 #include "extensions/browser/api/cast_channel/cast_auth_util.h" | 22 #include "extensions/browser/api/cast_channel/cast_auth_util.h" |
| 20 #include "extensions/browser/api/cast_channel/cast_socket.h" | 23 #include "extensions/browser/api/cast_channel/cast_socket.h" |
| 21 #include "extensions/browser/api/cast_channel/cast_transport.h" | 24 #include "extensions/browser/api/cast_channel/cast_transport.h" |
| 22 #include "extensions/common/api/cast_channel.h" | |
| 23 #include "extensions/common/api/cast_channel/logging.pb.h" | 25 #include "extensions/common/api/cast_channel/logging.pb.h" |
| 24 #include "net/base/completion_callback.h" | 26 #include "net/base/completion_callback.h" |
| 25 #include "net/base/io_buffer.h" | 27 #include "net/base/io_buffer.h" |
| 26 #include "net/base/ip_endpoint.h" | 28 #include "net/base/ip_endpoint.h" |
| 27 #include "net/log/net_log_source.h" | 29 #include "net/log/net_log_source.h" |
| 28 | 30 |
| 29 namespace net { | 31 namespace net { |
| 30 class CertVerifier; | 32 class CertVerifier; |
| 31 class CTPolicyEnforcer; | 33 class CTPolicyEnforcer; |
| 32 class CTVerifier; | 34 class CTVerifier; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 51 VIDEO_OUT = 1 << 0, | 53 VIDEO_OUT = 1 << 0, |
| 52 VIDEO_IN = 1 << 1, | 54 VIDEO_IN = 1 << 1, |
| 53 AUDIO_OUT = 1 << 2, | 55 AUDIO_OUT = 1 << 2, |
| 54 AUDIO_IN = 1 << 3, | 56 AUDIO_IN = 1 << 3, |
| 55 DEV_MODE = 1 << 4 | 57 DEV_MODE = 1 << 4 |
| 56 }; | 58 }; |
| 57 | 59 |
| 58 // Public interface of the CastSocket class. | 60 // Public interface of the CastSocket class. |
| 59 class CastSocket { | 61 class CastSocket { |
| 60 public: | 62 public: |
| 63 using ChannelError = ::cast_channel::ChannelError; |
| 64 using ChannelAuthType = ::cast_channel::ChannelAuthType; |
| 65 using ReadyState = ::cast_channel::ReadyState; |
| 66 |
| 61 virtual ~CastSocket() {} | 67 virtual ~CastSocket() {} |
| 62 | 68 |
| 69 // Used by BrowserContextKeyedAPIFactory. |
| 70 static const char* service_name() { return "CastSocketImplManager"; } |
| 71 |
| 63 // Connects the channel to the peer. If successful, the channel will be in | 72 // Connects the channel to the peer. If successful, the channel will be in |
| 64 // READY_STATE_OPEN. DO NOT delete the CastSocket object in |callback|. | 73 // READY_STATE_OPEN. DO NOT delete the CastSocket object in |callback|. |
| 65 // Instead use Close(). | 74 // Instead use Close(). |
| 66 // |callback| will be invoked with any ChannelError that occurred, or | 75 // |callback| will be invoked with any ChannelError that occurred, or |
| 67 // CHANNEL_ERROR_NONE if successful. | 76 // CHANNEL_ERROR_NONE if successful. |
| 68 // If the CastSocket is destroyed while the connection is pending, |callback| | 77 // If the CastSocket is destroyed while the connection is pending, |callback| |
| 69 // will be invoked with CHANNEL_ERROR_UNKNOWN. In this case, invoking | 78 // will be invoked with CHANNEL_ERROR_UNKNOWN. In this case, invoking |
| 70 // |callback| must not result in any re-entrancy behavior. | 79 // |callback| must not result in any re-entrancy behavior. |
| 71 // |delegate| receives message receipt and error events. | 80 // |delegate| receives message receipt and error events. |
| 72 // Ownership of |delegate| is transferred to this CastSocket. | 81 // Ownership of |delegate| is transferred to this CastSocket. |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 // information. | 393 // information. |
| 385 AuthTransportDelegate* auth_delegate_; | 394 AuthTransportDelegate* auth_delegate_; |
| 386 | 395 |
| 387 DISALLOW_COPY_AND_ASSIGN(CastSocketImpl); | 396 DISALLOW_COPY_AND_ASSIGN(CastSocketImpl); |
| 388 }; | 397 }; |
| 389 } // namespace cast_channel | 398 } // namespace cast_channel |
| 390 } // namespace api | 399 } // namespace api |
| 391 } // namespace extensions | 400 } // namespace extensions |
| 392 | 401 |
| 393 #endif // EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_SOCKET_H_ | 402 #endif // EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_SOCKET_H_ |
| OLD | NEW |