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

Unified Diff: components/cast_channel/cast_socket.h

Issue 2925053005: [cast_channel] Implement CastSocketService::OpenSocket() (Closed)
Patch Set: move |logger_| from cast_channel_api to cast_socket_service Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/cast_channel/cast_channel_enum.h ('k') | components/cast_channel/cast_socket.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/cast_channel/cast_socket.h
diff --git a/components/cast_channel/cast_socket.h b/components/cast_channel/cast_socket.h
index 00c4e506aca7b72aed363109c3957db96afaa8d9..e51d26f281efddbf17f325fce34030ce000ff04f 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() {}
@@ -82,7 +85,7 @@ class CastSocket {
// If the CastSocket is destroyed while the connection is pending, |callback|
// will be invoked with CHANNEL_ERROR_UNKNOWN. In this case, invoking
// |callback| must not result in any re-entrancy behavior.
- 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.
@@ -167,7 +170,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;
@@ -228,6 +231,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,
@@ -354,8 +359,8 @@ class CastSocketImpl : public CastSocket {
// Reply received from the receiver to a challenge request.
std::unique_ptr<CastMessage> challenge_reply_;
- // Callback invoked when the socket is connected or fails to connect.
- base::Callback<void(ChannelError)> connect_callback_;
+ // Callbacks invoked when the socket is connected or fails to connect.
+ std::vector<OnOpenCallback> connect_callbacks_;
// Callback invoked by |connect_timeout_timer_| to cancel the connection.
base::CancelableClosure connect_timeout_callback_;
« no previous file with comments | « components/cast_channel/cast_channel_enum.h ('k') | components/cast_channel/cast_socket.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698