OLD | NEW |
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> |
| 9 |
8 #include <queue> | 10 #include <queue> |
9 #include <string> | 11 #include <string> |
10 | 12 |
11 #include "base/basictypes.h" | |
12 #include "base/cancelable_callback.h" | 13 #include "base/cancelable_callback.h" |
13 #include "base/gtest_prod_util.h" | 14 #include "base/gtest_prod_util.h" |
| 15 #include "base/macros.h" |
14 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
15 #include "base/threading/thread_checker.h" | 17 #include "base/threading/thread_checker.h" |
16 #include "base/timer/timer.h" | 18 #include "base/timer/timer.h" |
17 #include "extensions/browser/api/api_resource.h" | 19 #include "extensions/browser/api/api_resource.h" |
18 #include "extensions/browser/api/api_resource_manager.h" | 20 #include "extensions/browser/api/api_resource_manager.h" |
19 #include "extensions/browser/api/cast_channel/cast_socket.h" | 21 #include "extensions/browser/api/cast_channel/cast_socket.h" |
20 #include "extensions/browser/api/cast_channel/cast_transport.h" | 22 #include "extensions/browser/api/cast_channel/cast_transport.h" |
21 #include "extensions/browser/api/cast_channel/logger_util.h" | 23 #include "extensions/browser/api/cast_channel/logger_util.h" |
22 #include "extensions/common/api/cast_channel.h" | 24 #include "extensions/common/api/cast_channel.h" |
23 #include "extensions/common/api/cast_channel/logging.pb.h" | 25 #include "extensions/common/api/cast_channel/logging.pb.h" |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 // |net_log|: Log of socket events. | 144 // |net_log|: Log of socket events. |
143 // |connect_timeout|: Connection timeout interval. | 145 // |connect_timeout|: Connection timeout interval. |
144 // |logger|: Log of cast channel events. | 146 // |logger|: Log of cast channel events. |
145 CastSocketImpl(const std::string& owner_extension_id, | 147 CastSocketImpl(const std::string& owner_extension_id, |
146 const net::IPEndPoint& ip_endpoint, | 148 const net::IPEndPoint& ip_endpoint, |
147 ChannelAuthType channel_auth, | 149 ChannelAuthType channel_auth, |
148 net::NetLog* net_log, | 150 net::NetLog* net_log, |
149 const base::TimeDelta& connect_timeout, | 151 const base::TimeDelta& connect_timeout, |
150 bool keep_alive, | 152 bool keep_alive, |
151 const scoped_refptr<Logger>& logger, | 153 const scoped_refptr<Logger>& logger, |
152 uint64 device_capabilities); | 154 uint64_t device_capabilities); |
153 | 155 |
154 // Ensures that the socket is closed. | 156 // Ensures that the socket is closed. |
155 ~CastSocketImpl() override; | 157 ~CastSocketImpl() override; |
156 | 158 |
157 // CastSocket interface. | 159 // CastSocket interface. |
158 void Connect(scoped_ptr<CastTransport::Delegate> delegate, | 160 void Connect(scoped_ptr<CastTransport::Delegate> delegate, |
159 base::Callback<void(ChannelError)> callback) override; | 161 base::Callback<void(ChannelError)> callback) override; |
160 CastTransport* transport() const override; | 162 CastTransport* transport() const override; |
161 void Close(const net::CompletionCallback& callback) override; | 163 void Close(const net::CompletionCallback& callback) override; |
162 const net::IPEndPoint& ip_endpoint() const override; | 164 const net::IPEndPoint& ip_endpoint() const override; |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 base::TimeDelta connect_timeout_; | 330 base::TimeDelta connect_timeout_; |
329 | 331 |
330 // Timer invoked when the connection has timed out. | 332 // Timer invoked when the connection has timed out. |
331 scoped_ptr<base::Timer> connect_timeout_timer_; | 333 scoped_ptr<base::Timer> connect_timeout_timer_; |
332 | 334 |
333 // Set when a timeout is triggered and the connection process has | 335 // Set when a timeout is triggered and the connection process has |
334 // canceled. | 336 // canceled. |
335 bool is_canceled_; | 337 bool is_canceled_; |
336 | 338 |
337 // Capabilities declared by the cast device. | 339 // Capabilities declared by the cast device. |
338 uint64 device_capabilities_; | 340 uint64_t device_capabilities_; |
339 | 341 |
340 // Whether the channel is audio only as identified by the device | 342 // Whether the channel is audio only as identified by the device |
341 // certificate during channel authentication. | 343 // certificate during channel authentication. |
342 bool audio_only_; | 344 bool audio_only_; |
343 | 345 |
344 // Connection flow state machine state. | 346 // Connection flow state machine state. |
345 proto::ConnectionState connect_state_; | 347 proto::ConnectionState connect_state_; |
346 | 348 |
347 // Write flow state machine state. | 349 // Write flow state machine state. |
348 proto::WriteState write_state_; | 350 proto::WriteState write_state_; |
(...skipping 25 matching lines...) Expand all Loading... |
374 // information. | 376 // information. |
375 AuthTransportDelegate* auth_delegate_; | 377 AuthTransportDelegate* auth_delegate_; |
376 | 378 |
377 DISALLOW_COPY_AND_ASSIGN(CastSocketImpl); | 379 DISALLOW_COPY_AND_ASSIGN(CastSocketImpl); |
378 }; | 380 }; |
379 } // namespace cast_channel | 381 } // namespace cast_channel |
380 } // namespace api | 382 } // namespace api |
381 } // namespace extensions | 383 } // namespace extensions |
382 | 384 |
383 #endif // EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_SOCKET_H_ | 385 #endif // EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_SOCKET_H_ |
OLD | NEW |