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

Side by Side Diff: extensions/browser/api/cast_channel/cast_socket.h

Issue 2709523008: [Cast Channel] Add support for nonce challenge to Cast channel authentication. (Closed)
Patch Set: Addresses comments Created 3 years, 9 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 EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_SOCKET_H_ 5 #ifndef EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_SOCKET_H_
6 #define EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_SOCKET_H_ 6 #define EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_SOCKET_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <queue> 10 #include <queue>
(...skipping 25 matching lines...) Expand all
36 class SSLClientSocket; 36 class SSLClientSocket;
37 class StreamSocket; 37 class StreamSocket;
38 class TCPClientSocket; 38 class TCPClientSocket;
39 class TransportSecurityState; 39 class TransportSecurityState;
40 class X509Certificate; 40 class X509Certificate;
41 } 41 }
42 42
43 namespace extensions { 43 namespace extensions {
44 namespace api { 44 namespace api {
45 namespace cast_channel { 45 namespace cast_channel {
46 class AuthContext;
46 class CastMessage; 47 class CastMessage;
47 class Logger; 48 class Logger;
48 struct LastErrors; 49 struct LastErrors;
49 50
50 // Cast device capabilities. 51 // Cast device capabilities.
51 enum CastDeviceCapability { 52 enum CastDeviceCapability {
52 NONE = 0, 53 NONE = 0,
53 VIDEO_OUT = 1 << 0, 54 VIDEO_OUT = 1 << 0,
54 VIDEO_IN = 1 << 1, 55 VIDEO_IN = 1 << 1,
55 AUDIO_OUT = 1 << 2, 56 AUDIO_OUT = 1 << 2,
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 // |logger|: Log of cast channel events. 148 // |logger|: Log of cast channel events.
148 CastSocketImpl(const std::string& owner_extension_id, 149 CastSocketImpl(const std::string& owner_extension_id,
149 const net::IPEndPoint& ip_endpoint, 150 const net::IPEndPoint& ip_endpoint,
150 ChannelAuthType channel_auth, 151 ChannelAuthType channel_auth,
151 net::NetLog* net_log, 152 net::NetLog* net_log,
152 const base::TimeDelta& connect_timeout, 153 const base::TimeDelta& connect_timeout,
153 bool keep_alive, 154 bool keep_alive,
154 const scoped_refptr<Logger>& logger, 155 const scoped_refptr<Logger>& logger,
155 uint64_t device_capabilities); 156 uint64_t device_capabilities);
156 157
158 // For test-only.
159 // This constructor allows for setting a custom AuthContext.
160 CastSocketImpl(const std::string& owner_extension_id,
161 const net::IPEndPoint& ip_endpoint,
162 ChannelAuthType channel_auth,
163 net::NetLog* net_log,
164 const base::TimeDelta& connect_timeout,
165 bool keep_alive,
166 const scoped_refptr<Logger>& logger,
167 uint64_t device_capabilities,
168 std::unique_ptr<AuthContext> auth_context);
mark a. foltz 2017/03/10 00:47:23 const AuthContext&
ryanchung 2017/03/10 02:10:27 Done.
169
157 // Ensures that the socket is closed. 170 // Ensures that the socket is closed.
158 ~CastSocketImpl() override; 171 ~CastSocketImpl() override;
159 172
160 // CastSocket interface. 173 // CastSocket interface.
161 void Connect(std::unique_ptr<CastTransport::Delegate> delegate, 174 void Connect(std::unique_ptr<CastTransport::Delegate> delegate,
162 base::Callback<void(ChannelError)> callback) override; 175 base::Callback<void(ChannelError)> callback) override;
163 CastTransport* transport() const override; 176 CastTransport* transport() const override;
164 void Close(const net::CompletionCallback& callback) override; 177 void Close(const net::CompletionCallback& callback) override;
165 const net::IPEndPoint& ip_endpoint() const override; 178 const net::IPEndPoint& ip_endpoint() const override;
166 int id() const override; 179 int id() const override;
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 // Owned ptr to the underlying TCP socket. 326 // Owned ptr to the underlying TCP socket.
314 std::unique_ptr<net::TCPClientSocket> tcp_socket_; 327 std::unique_ptr<net::TCPClientSocket> tcp_socket_;
315 328
316 // Owned ptr to the underlying SSL socket. 329 // Owned ptr to the underlying SSL socket.
317 std::unique_ptr<net::SSLClientSocket> socket_; 330 std::unique_ptr<net::SSLClientSocket> socket_;
318 331
319 // Certificate of the peer. This field may be empty if the peer 332 // Certificate of the peer. This field may be empty if the peer
320 // certificate is not yet fetched. 333 // certificate is not yet fetched.
321 scoped_refptr<net::X509Certificate> peer_cert_; 334 scoped_refptr<net::X509Certificate> peer_cert_;
322 335
336 // The challenge context for the current connection.
337 std::unique_ptr<AuthContext> auth_context_;
mark a. foltz 2017/03/10 00:47:23 const AuthContext GUID is a short string and not
ryanchung 2017/03/10 02:10:27 Done.
338
323 // Reply received from the receiver to a challenge request. 339 // Reply received from the receiver to a challenge request.
324 std::unique_ptr<CastMessage> challenge_reply_; 340 std::unique_ptr<CastMessage> challenge_reply_;
325 341
326 // Callback invoked when the socket is connected or fails to connect. 342 // Callback invoked when the socket is connected or fails to connect.
327 base::Callback<void(ChannelError)> connect_callback_; 343 base::Callback<void(ChannelError)> connect_callback_;
328 344
329 // Callback invoked by |connect_timeout_timer_| to cancel the connection. 345 // Callback invoked by |connect_timeout_timer_| to cancel the connection.
330 base::CancelableClosure connect_timeout_callback_; 346 base::CancelableClosure connect_timeout_callback_;
331 347
332 // Duration to wait before timing out. 348 // Duration to wait before timing out.
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 // information. 395 // information.
380 AuthTransportDelegate* auth_delegate_; 396 AuthTransportDelegate* auth_delegate_;
381 397
382 DISALLOW_COPY_AND_ASSIGN(CastSocketImpl); 398 DISALLOW_COPY_AND_ASSIGN(CastSocketImpl);
383 }; 399 };
384 } // namespace cast_channel 400 } // namespace cast_channel
385 } // namespace api 401 } // namespace api
386 } // namespace extensions 402 } // namespace extensions
387 403
388 #endif // EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_SOCKET_H_ 404 #endif // EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_SOCKET_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698