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

Unified Diff: components/cast_channel/cast_socket.h

Issue 2925053005: [cast_channel] Implement CastSocketService::OpenSocket() (Closed)
Patch Set: rebase 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 | « no previous file | components/cast_channel/cast_socket.cc » ('j') | components/cast_channel/cast_socket.cc » ('J')
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 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_;
« no previous file with comments | « no previous file | components/cast_channel/cast_socket.cc » ('j') | components/cast_channel/cast_socket.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698