| Index: extensions/browser/api/cast_channel/cast_socket.h
|
| diff --git a/extensions/browser/api/cast_channel/cast_socket.h b/extensions/browser/api/cast_channel/cast_socket.h
|
| index 7b4b6b59b27a07a91518ef9233a41762d41bb6e3..6e5e876c16cb308bd1eaad25e8b3f0e4880d0aaa 100644
|
| --- a/extensions/browser/api/cast_channel/cast_socket.h
|
| +++ b/extensions/browser/api/cast_channel/cast_socket.h
|
| @@ -42,43 +42,44 @@ class MessageFramer;
|
|
|
| // This class implements a channel between Chrome and a Cast device using a TCP
|
| // socket with SSL. The channel may authenticate that the receiver is a genuine
|
| -// Cast device. All CastSocket objects must be used only on the IO thread.
|
| +// Cast device. All CastSocketImpl objects must be used only on the IO thread.
|
| //
|
| // NOTE: Not called "CastChannel" to reduce confusion with the generated API
|
| // code.
|
| -class CastSocket : public ApiResource {
|
| +class CastSocketImpl : public ApiResource {
|
| public:
|
| - // Object to be informed of incoming messages and errors. The CastSocket that
|
| + // Object to be informed of incoming messages and errors. The CastSocketImpl
|
| + // that
|
| // owns the delegate must not be deleted by it, only by the ApiResourceManager
|
| // or in the callback to Close().
|
| class Delegate {
|
| public:
|
| // An error occurred on the channel. |last_errors| contains the last errors
|
| // logged for the channel from the implementation.
|
| - virtual void OnError(const CastSocket* socket,
|
| + virtual void OnError(const CastSocketImpl* socket,
|
| ChannelError error_state,
|
| const LastErrors& last_errors) = 0;
|
| // A message was received on the channel.
|
| - virtual void OnMessage(const CastSocket* socket,
|
| + virtual void OnMessage(const CastSocketImpl* socket,
|
| const MessageInfo& message) = 0;
|
|
|
| protected:
|
| virtual ~Delegate() {}
|
| };
|
|
|
| - // Creates a new CastSocket that connects to |ip_endpoint| with
|
| + // Creates a new CastSocketImpl that connects to |ip_endpoint| with
|
| // |channel_auth|. |owner_extension_id| is the id of the extension that opened
|
| // the socket. |channel_auth| must not be CHANNEL_AUTH_NONE.
|
| - CastSocket(const std::string& owner_extension_id,
|
| - const net::IPEndPoint& ip_endpoint,
|
| - ChannelAuthType channel_auth,
|
| - CastSocket::Delegate* delegate,
|
| - net::NetLog* net_log,
|
| - const base::TimeDelta& connect_timeout,
|
| - const scoped_refptr<Logger>& logger);
|
| + CastSocketImpl(const std::string& owner_extension_id,
|
| + const net::IPEndPoint& ip_endpoint,
|
| + ChannelAuthType channel_auth,
|
| + CastSocketImpl::Delegate* delegate,
|
| + net::NetLog* net_log,
|
| + const base::TimeDelta& connect_timeout,
|
| + const scoped_refptr<Logger>& logger);
|
|
|
| // Ensures that the socket is closed.
|
| - virtual ~CastSocket();
|
| + virtual ~CastSocketImpl();
|
|
|
| // The IP endpoint for the destination of the channel.
|
| const net::IPEndPoint& ip_endpoint() const { return ip_endpoint_; }
|
| @@ -104,7 +105,7 @@ class CastSocket : public ApiResource {
|
| virtual ChannelError error_state() const;
|
|
|
| // Connects the channel to the peer. If successful, the channel will be in
|
| - // READY_STATE_OPEN. DO NOT delete the CastSocket object in |callback|.
|
| + // READY_STATE_OPEN. DO NOT delete the CastSocketImpl object in |callback|.
|
| // Instead use Close().
|
| virtual void Connect(const net::CompletionCallback& callback);
|
|
|
| @@ -114,16 +115,16 @@ class CastSocket : public ApiResource {
|
| // Note that if an error occurs the following happens:
|
| // 1. Completion callbacks for all pending writes are invoked with error.
|
| // 2. Delegate::OnError is called once.
|
| - // 3. CastSocket is closed.
|
| + // 3. CastSocketImpl is closed.
|
| //
|
| - // DO NOT delete the CastSocket object in |callback|. Instead use Close().
|
| + // DO NOT delete the CastSocketImpl object in |callback|. Instead use Close().
|
| virtual void SendMessage(const MessageInfo& message,
|
| const net::CompletionCallback& callback);
|
|
|
| // Closes the channel if not already closed. On completion, the channel will
|
| // be in READY_STATE_CLOSED.
|
| //
|
| - // It is fine to delete the CastSocket object in |callback|.
|
| + // It is fine to delete the CastSocketImpl object in |callback|.
|
| virtual void Close(const net::CompletionCallback& callback);
|
|
|
| // Internal connection states.
|
| @@ -157,11 +158,11 @@ class CastSocket : public ApiResource {
|
| };
|
|
|
| private:
|
| - friend class ApiResourceManager<CastSocket>;
|
| - friend class CastSocketTest;
|
| - friend class TestCastSocket;
|
| + friend class ApiResourceManager<CastSocketImpl>;
|
| + friend class CastSocketImplTest;
|
| + friend class TestCastSocketImpl;
|
|
|
| - static const char* service_name() { return "CastSocketManager"; }
|
| + static const char* service_name() { return "CastSocketImplManager"; }
|
|
|
| // Creates an instance of TCPClientSocket.
|
| virtual scoped_ptr<net::TCPClientSocket> CreateTcpSocket();
|
| @@ -287,7 +288,7 @@ class CastSocket : public ApiResource {
|
| // The NetLog source for this service.
|
| net::NetLog::Source net_log_source_;
|
|
|
| - // Logger used to track multiple CastSockets. Does NOT own this object.
|
| + // Logger used to track multiple CastSocketImpls. Does NOT own this object.
|
| scoped_refptr<Logger> logger_;
|
|
|
| // CertVerifier is owned by us but should be deleted AFTER SSLClientSocket
|
| @@ -359,12 +360,13 @@ class CastSocket : public ApiResource {
|
| // being written.
|
| std::queue<WriteRequest> write_queue_;
|
|
|
| - FRIEND_TEST_ALL_PREFIXES(CastSocketTest, TestFullSecureConnectionFlowAsync);
|
| - FRIEND_TEST_ALL_PREFIXES(CastSocketTest, TestRead);
|
| - FRIEND_TEST_ALL_PREFIXES(CastSocketTest, TestReadHeaderParseError);
|
| - FRIEND_TEST_ALL_PREFIXES(CastSocketTest, TestReadMany);
|
| - FRIEND_TEST_ALL_PREFIXES(CastSocketTest, TestWriteErrorLargeMessage);
|
| - DISALLOW_COPY_AND_ASSIGN(CastSocket);
|
| + FRIEND_TEST_ALL_PREFIXES(CastSocketImplTest,
|
| + TestFullSecureConnectionFlowAsync);
|
| + FRIEND_TEST_ALL_PREFIXES(CastSocketImplTest, TestRead);
|
| + FRIEND_TEST_ALL_PREFIXES(CastSocketImplTest, TestReadHeaderParseError);
|
| + FRIEND_TEST_ALL_PREFIXES(CastSocketImplTest, TestReadMany);
|
| + FRIEND_TEST_ALL_PREFIXES(CastSocketImplTest, TestWriteErrorLargeMessage);
|
| + DISALLOW_COPY_AND_ASSIGN(CastSocketImpl);
|
| };
|
| } // namespace cast_channel
|
| } // namespace core_api
|
|
|