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

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: Rebase-only 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/common/api/cast_channel.h" 24 #include "extensions/common/api/cast_channel.h"
24 #include "extensions/common/api/cast_channel/logging.pb.h" 25 #include "extensions/common/api/cast_channel/logging.pb.h"
25 #include "net/base/completion_callback.h" 26 #include "net/base/completion_callback.h"
26 #include "net/base/io_buffer.h" 27 #include "net/base/io_buffer.h"
27 #include "net/base/ip_endpoint.h" 28 #include "net/base/ip_endpoint.h"
28 #include "net/log/net_log_source.h" 29 #include "net/log/net_log_source.h"
29 30
30 namespace net { 31 namespace net {
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 // |logger|: Log of cast channel events. 150 // |logger|: Log of cast channel events.
150 CastSocketImpl(const std::string& owner_extension_id, 151 CastSocketImpl(const std::string& owner_extension_id,
151 const net::IPEndPoint& ip_endpoint, 152 const net::IPEndPoint& ip_endpoint,
152 ChannelAuthType channel_auth, 153 ChannelAuthType channel_auth,
153 net::NetLog* net_log, 154 net::NetLog* net_log,
154 const base::TimeDelta& connect_timeout, 155 const base::TimeDelta& connect_timeout,
155 bool keep_alive, 156 bool keep_alive,
156 const scoped_refptr<Logger>& logger, 157 const scoped_refptr<Logger>& logger,
157 uint64_t device_capabilities); 158 uint64_t device_capabilities);
158 159
160 // For test-only.
161 // This constructor allows for setting a custom AuthContext.
162 CastSocketImpl(const std::string& owner_extension_id,
163 const net::IPEndPoint& ip_endpoint,
164 ChannelAuthType channel_auth,
165 net::NetLog* net_log,
166 const base::TimeDelta& connect_timeout,
167 bool keep_alive,
168 const scoped_refptr<Logger>& logger,
169 uint64_t device_capabilities,
170 const AuthContext& auth_context);
171
159 // Ensures that the socket is closed. 172 // Ensures that the socket is closed.
160 ~CastSocketImpl() override; 173 ~CastSocketImpl() override;
161 174
162 // CastSocket interface. 175 // CastSocket interface.
163 void Connect(std::unique_ptr<CastTransport::Delegate> delegate, 176 void Connect(std::unique_ptr<CastTransport::Delegate> delegate,
164 base::Callback<void(ChannelError)> callback) override; 177 base::Callback<void(ChannelError)> callback) override;
165 CastTransport* transport() const override; 178 CastTransport* transport() const override;
166 void Close(const net::CompletionCallback& callback) override; 179 void Close(const net::CompletionCallback& callback) override;
167 const net::IPEndPoint& ip_endpoint() const override; 180 const net::IPEndPoint& ip_endpoint() const override;
168 int id() const override; 181 int id() const override;
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 // Owned ptr to the underlying TCP socket. 328 // Owned ptr to the underlying TCP socket.
316 std::unique_ptr<net::TCPClientSocket> tcp_socket_; 329 std::unique_ptr<net::TCPClientSocket> tcp_socket_;
317 330
318 // Owned ptr to the underlying SSL socket. 331 // Owned ptr to the underlying SSL socket.
319 std::unique_ptr<net::SSLClientSocket> socket_; 332 std::unique_ptr<net::SSLClientSocket> socket_;
320 333
321 // Certificate of the peer. This field may be empty if the peer 334 // Certificate of the peer. This field may be empty if the peer
322 // certificate is not yet fetched. 335 // certificate is not yet fetched.
323 scoped_refptr<net::X509Certificate> peer_cert_; 336 scoped_refptr<net::X509Certificate> peer_cert_;
324 337
338 // The challenge context for the current connection.
339 const AuthContext auth_context_;
340
325 // Reply received from the receiver to a challenge request. 341 // Reply received from the receiver to a challenge request.
326 std::unique_ptr<CastMessage> challenge_reply_; 342 std::unique_ptr<CastMessage> challenge_reply_;
327 343
328 // Callback invoked when the socket is connected or fails to connect. 344 // Callback invoked when the socket is connected or fails to connect.
329 base::Callback<void(ChannelError)> connect_callback_; 345 base::Callback<void(ChannelError)> connect_callback_;
330 346
331 // Callback invoked by |connect_timeout_timer_| to cancel the connection. 347 // Callback invoked by |connect_timeout_timer_| to cancel the connection.
332 base::CancelableClosure connect_timeout_callback_; 348 base::CancelableClosure connect_timeout_callback_;
333 349
334 // Duration to wait before timing out. 350 // Duration to wait before timing out.
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 // information. 397 // information.
382 AuthTransportDelegate* auth_delegate_; 398 AuthTransportDelegate* auth_delegate_;
383 399
384 DISALLOW_COPY_AND_ASSIGN(CastSocketImpl); 400 DISALLOW_COPY_AND_ASSIGN(CastSocketImpl);
385 }; 401 };
386 } // namespace cast_channel 402 } // namespace cast_channel
387 } // namespace api 403 } // namespace api
388 } // namespace extensions 404 } // namespace extensions
389 405
390 #endif // EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_SOCKET_H_ 406 #endif // EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_SOCKET_H_
OLDNEW
« no previous file with comments | « extensions/browser/api/cast_channel/cast_message_util.cc ('k') | extensions/browser/api/cast_channel/cast_socket.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698