Chromium Code Reviews| Index: components/cast_channel/cast_socket.h |
| diff --git a/components/cast_channel/cast_socket.h b/components/cast_channel/cast_socket.h |
| index 5d7d58ea3fd4d3ae2a465843f8b0f18772a31d81..f338fe889af0713db5e136a2cb24371514fbbd5b 100644 |
| --- a/components/cast_channel/cast_socket.h |
| +++ b/components/cast_channel/cast_socket.h |
| @@ -56,6 +56,9 @@ enum CastDeviceCapability { |
| // Public interface of the CastSocket class. |
| class CastSocket { |
| public: |
| + using OnOpenCallback = |
| + base::Callback<void(int channel_id, ChannelError error_state)>; |
| + |
| class Observer { |
| public: |
| virtual ~Observer() {} |
| @@ -83,7 +86,7 @@ class CastSocket { |
| // will be invoked with CHANNEL_ERROR_UNKNOWN. In this case, invoking |
| // |callback| must not result in any re-entrancy behavior. |
| // Ownership of |delegate| is transferred to this CastSocket. |
| - virtual void Connect(base::Callback<void(ChannelError)> callback) = 0; |
| + virtual void Connect(const OnOpenCallback& callback) = 0; |
| // Closes the channel if not already closed. On completion, the channel will |
| // be in READY_STATE_CLOSED. |
| @@ -169,7 +172,7 @@ class CastSocketImpl : public CastSocket { |
| ~CastSocketImpl() override; |
| // CastSocket interface. |
| - void Connect(base::Callback<void(ChannelError)> callback) override; |
| + void Connect(const OnOpenCallback& callback) override; |
| CastTransport* transport() const override; |
| void Close(const net::CompletionCallback& callback) override; |
| const net::IPEndPoint& ip_endpoint() const override; |
| @@ -230,6 +233,8 @@ class CastSocketImpl : public CastSocket { |
| // capability must not have a certificate with audio only policy. |
| bool VerifyChannelPolicy(const AuthResult& result); |
| + void Connect(); |
| + |
| private: |
| FRIEND_TEST_ALL_PREFIXES(CastSocketTest, TestConnectAuthMessageCorrupted); |
| FRIEND_TEST_ALL_PREFIXES(CastSocketTest, |
| @@ -357,7 +362,7 @@ class CastSocketImpl : public CastSocket { |
| std::unique_ptr<CastMessage> challenge_reply_; |
| // Callback invoked when the socket is connected or fails to connect. |
|
mark a. foltz
2017/06/21 17:41:42
nit: Callbacks
zhaobin
2017/06/21 21:58:25
Done.
|
| - base::Callback<void(ChannelError)> connect_callback_; |
| + std::vector<OnOpenCallback> connect_callbacks_; |
| // Callback invoked by |connect_timeout_timer_| to cancel the connection. |
| base::CancelableClosure connect_timeout_callback_; |