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

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

Issue 807723004: Cast audio only policy enforcement support. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Code review changes Created 5 years, 11 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 <queue> 8 #include <queue>
9 #include <string> 9 #include <string>
10 10
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 // |channel_auth|: Authentication method used for connecting to a Cast 118 // |channel_auth|: Authentication method used for connecting to a Cast
119 // receiver. 119 // receiver.
120 // |net_log|: Log of socket events. 120 // |net_log|: Log of socket events.
121 // |connect_timeout|: Connection timeout interval. 121 // |connect_timeout|: Connection timeout interval.
122 // |logger|: Log of cast channel events. 122 // |logger|: Log of cast channel events.
123 CastSocketImpl(const std::string& owner_extension_id, 123 CastSocketImpl(const std::string& owner_extension_id,
124 const net::IPEndPoint& ip_endpoint, 124 const net::IPEndPoint& ip_endpoint,
125 ChannelAuthType channel_auth, 125 ChannelAuthType channel_auth,
126 net::NetLog* net_log, 126 net::NetLog* net_log,
127 const base::TimeDelta& connect_timeout, 127 const base::TimeDelta& connect_timeout,
128 const scoped_refptr<Logger>& logger); 128 const scoped_refptr<Logger>& logger,
129 long device_capabilities);
129 130
130 // Ensures that the socket is closed. 131 // Ensures that the socket is closed.
131 ~CastSocketImpl() override; 132 ~CastSocketImpl() override;
132 133
133 // CastSocket interface. 134 // CastSocket interface.
134 void Connect(scoped_ptr<CastTransport::Delegate> delegate, 135 void Connect(scoped_ptr<CastTransport::Delegate> delegate,
135 base::Callback<void(ChannelError)> callback) override; 136 base::Callback<void(ChannelError)> callback) override;
136 CastTransport* transport() const override; 137 CastTransport* transport() const override;
137 void Close(const net::CompletionCallback& callback) override; 138 void Close(const net::CompletionCallback& callback) override;
138 const net::IPEndPoint& ip_endpoint() const override; 139 const net::IPEndPoint& ip_endpoint() const override;
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 // Runs the external connection callback and resets it. 236 // Runs the external connection callback and resets it.
236 void DoConnectCallback(); 237 void DoConnectCallback();
237 238
238 virtual bool CalledOnValidThread() const; 239 virtual bool CalledOnValidThread() const;
239 240
240 virtual base::Timer* GetTimer(); 241 virtual base::Timer* GetTimer();
241 242
242 void SetConnectState(proto::ConnectionState connect_state); 243 void SetConnectState(proto::ConnectionState connect_state);
243 void SetReadyState(ReadyState ready_state); 244 void SetReadyState(ReadyState ready_state);
244 245
246 // Verifies whether the socket complies with cast channel policy.
247 // Audio only channel policy mandates that a device declaring a video out
248 // capability must not have a certificate with audio only policy.
249 bool VerifyChannelPolicy(const AuthResult& result);
250
245 base::ThreadChecker thread_checker_; 251 base::ThreadChecker thread_checker_;
246 252
247 const std::string owner_extension_id_; 253 const std::string owner_extension_id_;
248 // The id of the channel. 254 // The id of the channel.
249 int channel_id_; 255 int channel_id_;
250 // The IP endpoint that the the channel is connected to. 256 // The IP endpoint that the the channel is connected to.
251 net::IPEndPoint ip_endpoint_; 257 net::IPEndPoint ip_endpoint_;
252 // Receiver authentication requested for the channel. 258 // Receiver authentication requested for the channel.
253 ChannelAuthType channel_auth_; 259 ChannelAuthType channel_auth_;
254 // The NetLog for this service. 260 // The NetLog for this service.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 // Duration to wait before timing out. 293 // Duration to wait before timing out.
288 base::TimeDelta connect_timeout_; 294 base::TimeDelta connect_timeout_;
289 295
290 // Timer invoked when the connection has timed out. 296 // Timer invoked when the connection has timed out.
291 scoped_ptr<base::Timer> connect_timeout_timer_; 297 scoped_ptr<base::Timer> connect_timeout_timer_;
292 298
293 // Set when a timeout is triggered and the connection process has 299 // Set when a timeout is triggered and the connection process has
294 // canceled. 300 // canceled.
295 bool is_canceled_; 301 bool is_canceled_;
296 302
303 // Capabilities declared by the cast device.
304 long device_capabilities_;
305
297 // Connection flow state machine state. 306 // Connection flow state machine state.
298 proto::ConnectionState connect_state_; 307 proto::ConnectionState connect_state_;
299 308
300 // Write flow state machine state. 309 // Write flow state machine state.
301 proto::WriteState write_state_; 310 proto::WriteState write_state_;
302 311
303 // Read flow state machine state. 312 // Read flow state machine state.
304 proto::ReadState read_state_; 313 proto::ReadState read_state_;
305 314
306 // The last error encountered by the channel. 315 // The last error encountered by the channel.
(...skipping 16 matching lines...) Expand all
323 // Caller's message read and error handling delegate. 332 // Caller's message read and error handling delegate.
324 scoped_ptr<CastTransport::Delegate> read_delegate_; 333 scoped_ptr<CastTransport::Delegate> read_delegate_;
325 334
326 DISALLOW_COPY_AND_ASSIGN(CastSocketImpl); 335 DISALLOW_COPY_AND_ASSIGN(CastSocketImpl);
327 }; 336 };
328 } // namespace cast_channel 337 } // namespace cast_channel
329 } // namespace core_api 338 } // namespace core_api
330 } // namespace extensions 339 } // namespace extensions
331 340
332 #endif // EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_SOCKET_H_ 341 #endif // EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_SOCKET_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698