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

Side by Side Diff: components/cast_channel/cast_socket.h

Issue 2942743002: [cast_channel] Clean up CastSocketImpl ctor parameters (Closed)
Patch Set: 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 unified diff | Download patch
OLDNEW
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 COMPONENTS_CAST_CHANNEL_CAST_SOCKET_H_ 5 #ifndef COMPONENTS_CAST_CHANNEL_CAST_SOCKET_H_
6 #define COMPONENTS_CAST_CHANNEL_CAST_SOCKET_H_ 6 #define COMPONENTS_CAST_CHANNEL_CAST_SOCKET_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <queue> 10 #include <queue>
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 }; 123 };
124 124
125 // This class implements a channel between Chrome and a Cast device using a TCP 125 // This class implements a channel between Chrome and a Cast device using a TCP
126 // socket with SSL. The channel may authenticate that the receiver is a genuine 126 // socket with SSL. The channel may authenticate that the receiver is a genuine
127 // Cast device. All CastSocketImpl objects must be used only on the IO thread. 127 // Cast device. All CastSocketImpl objects must be used only on the IO thread.
128 // 128 //
129 // NOTE: Not called "CastChannel" to reduce confusion with the generated API 129 // NOTE: Not called "CastChannel" to reduce confusion with the generated API
130 // code. 130 // code.
131 class CastSocketImpl : public CastSocket { 131 class CastSocketImpl : public CastSocket {
132 public: 132 public:
133 // Creates a new CastSocket that connects to |ip_endpoint| with 133 // Creates a new CastSocket that connects to |ip_endpoint|.
134 // |channel_auth|. |owner_extension_id| is the id of the extension that opened
135 // the socket. |channel_auth| must not be CHANNEL_AUTH_NONE.
136 // Parameters: 134 // Parameters:
137 // |owner_extension_id|: ID of the extension calling the API.
138 // |ip_endpoint|: IP address of the remote host. 135 // |ip_endpoint|: IP address of the remote host.
139 // |channel_auth|: Authentication method used for connecting to a Cast
140 // receiver.
141 // |net_log|: Log of socket events. 136 // |net_log|: Log of socket events.
142 // |connect_timeout|: Connection timeout interval. 137 // |connect_timeout|: Connection timeout interval.
143 // |logger|: Log of cast channel events. 138 // |logger|: Log of cast channel events.
144 CastSocketImpl(const std::string& owner_extension_id, 139 CastSocketImpl(const net::IPEndPoint& ip_endpoint,
145 const net::IPEndPoint& ip_endpoint,
146 ChannelAuthType channel_auth,
147 net::NetLog* net_log, 140 net::NetLog* net_log,
148 const base::TimeDelta& connect_timeout, 141 const base::TimeDelta& connect_timeout,
imcheng 2017/06/14 22:25:34 Optional: It's fine to pass base::TimeDelta by val
zhaobin 2017/06/15 02:22:22 Fixed in another patch (https://codereview.chromiu
149 bool keep_alive, 142 bool keep_alive,
150 const scoped_refptr<Logger>& logger, 143 const scoped_refptr<Logger>& logger,
151 uint64_t device_capabilities); 144 uint64_t device_capabilities);
152 145
153 // For test-only. 146 // For test-only.
154 // This constructor allows for setting a custom AuthContext. 147 // This constructor allows for setting a custom AuthContext.
155 CastSocketImpl(const std::string& owner_extension_id, 148 CastSocketImpl(const net::IPEndPoint& ip_endpoint,
156 const net::IPEndPoint& ip_endpoint,
157 ChannelAuthType channel_auth,
158 net::NetLog* net_log, 149 net::NetLog* net_log,
159 const base::TimeDelta& connect_timeout, 150 const base::TimeDelta& connect_timeout,
160 bool keep_alive, 151 bool keep_alive,
161 const scoped_refptr<Logger>& logger, 152 const scoped_refptr<Logger>& logger,
162 uint64_t device_capabilities, 153 uint64_t device_capabilities,
163 const AuthContext& auth_context); 154 const AuthContext& auth_context);
164 155
165 // Ensures that the socket is closed. 156 // Ensures that the socket is closed.
166 ~CastSocketImpl() override; 157 ~CastSocketImpl() override;
167 158
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 void SetConnectState(proto::ConnectionState connect_state); 281 void SetConnectState(proto::ConnectionState connect_state);
291 void SetReadyState(ReadyState ready_state); 282 void SetReadyState(ReadyState ready_state);
292 283
293 THREAD_CHECKER(thread_checker_); 284 THREAD_CHECKER(thread_checker_);
294 285
295 // The id of the channel. 286 // The id of the channel.
296 int channel_id_; 287 int channel_id_;
297 // The IP endpoint that the the channel is connected to. 288 // The IP endpoint that the the channel is connected to.
298 net::IPEndPoint ip_endpoint_; 289 net::IPEndPoint ip_endpoint_;
299 // Receiver authentication requested for the channel. 290 // Receiver authentication requested for the channel.
300 ChannelAuthType channel_auth_; 291 ChannelAuthType channel_auth_;
mark a. foltz 2017/06/14 22:33:21 It should be possible to remove this (it can only
zhaobin 2017/06/15 02:22:22 Done.
301 // The NetLog for this service. 292 // The NetLog for this service.
302 net::NetLog* net_log_; 293 net::NetLog* net_log_;
303 // The NetLog source for this service. 294 // The NetLog source for this service.
304 net::NetLogSource net_log_source_; 295 net::NetLogSource net_log_source_;
305 // True when keep-alive signaling should be handled for this socket. 296 // True when keep-alive signaling should be handled for this socket.
306 bool keep_alive_; 297 bool keep_alive_;
307 298
308 // Shared logging object, used to log CastSocket events for diagnostics. 299 // Shared logging object, used to log CastSocket events for diagnostics.
309 scoped_refptr<Logger> logger_; 300 scoped_refptr<Logger> logger_;
310 301
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 376
386 // Raw pointer to the auth handshake delegate. Used to get detailed error 377 // Raw pointer to the auth handshake delegate. Used to get detailed error
387 // information. 378 // information.
388 AuthTransportDelegate* auth_delegate_; 379 AuthTransportDelegate* auth_delegate_;
389 380
390 DISALLOW_COPY_AND_ASSIGN(CastSocketImpl); 381 DISALLOW_COPY_AND_ASSIGN(CastSocketImpl);
391 }; 382 };
392 } // namespace cast_channel 383 } // namespace cast_channel
393 384
394 #endif // COMPONENTS_CAST_CHANNEL_CAST_SOCKET_H_ 385 #endif // COMPONENTS_CAST_CHANNEL_CAST_SOCKET_H_
OLDNEW
« 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