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

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: Make AuthContext constructor private 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>
11 #include <string> 11 #include <string>
12 12
13 #include "base/cancelable_callback.h" 13 #include "base/cancelable_callback.h"
14 #include "base/gtest_prod_util.h" 14 #include "base/gtest_prod_util.h"
15 #include "base/macros.h" 15 #include "base/macros.h"
16 #include "base/memory/ref_counted.h" 16 #include "base/memory/ref_counted.h"
17 #include "base/threading/thread_checker.h" 17 #include "base/threading/thread_checker.h"
18 #include "base/timer/timer.h" 18 #include "base/timer/timer.h"
19 #include "extensions/browser/api/api_resource.h" 19 #include "extensions/browser/api/api_resource.h"
20 #include "extensions/browser/api/api_resource_manager.h" 20 #include "extensions/browser/api/api_resource_manager.h"
21 #include "extensions/browser/api/cast_channel/cast_auth_util.h"
21 #include "extensions/browser/api/cast_channel/cast_socket.h" 22 #include "extensions/browser/api/cast_channel/cast_socket.h"
22 #include "extensions/browser/api/cast_channel/cast_transport.h" 23 #include "extensions/browser/api/cast_channel/cast_transport.h"
23 #include "extensions/browser/api/cast_channel/logger_util.h" 24 #include "extensions/browser/api/cast_channel/logger_util.h"
24 #include "extensions/common/api/cast_channel.h" 25 #include "extensions/common/api/cast_channel.h"
25 #include "extensions/common/api/cast_channel/logging.pb.h" 26 #include "extensions/common/api/cast_channel/logging.pb.h"
26 #include "net/base/completion_callback.h" 27 #include "net/base/completion_callback.h"
27 #include "net/base/io_buffer.h" 28 #include "net/base/io_buffer.h"
28 #include "net/base/ip_endpoint.h" 29 #include "net/base/ip_endpoint.h"
29 #include "net/log/net_log_source.h" 30 #include "net/log/net_log_source.h"
30 31
(...skipping 116 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 const AuthContext& auth_context);
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 const AuthContext auth_context_;
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