OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "chrome/browser/extensions/api/dial/dial_service.h" | 5 #include "chrome/browser/extensions/api/dial/dial_service.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <set> | 10 #include <set> |
(...skipping 14 matching lines...) Expand all Loading... |
25 #include "components/version_info/version_info.h" | 25 #include "components/version_info/version_info.h" |
26 #include "content/public/browser/browser_thread.h" | 26 #include "content/public/browser/browser_thread.h" |
27 #include "net/base/address_family.h" | 27 #include "net/base/address_family.h" |
28 #include "net/base/completion_callback.h" | 28 #include "net/base/completion_callback.h" |
29 #include "net/base/io_buffer.h" | 29 #include "net/base/io_buffer.h" |
30 #include "net/base/ip_endpoint.h" | 30 #include "net/base/ip_endpoint.h" |
31 #include "net/base/net_errors.h" | 31 #include "net/base/net_errors.h" |
32 #include "net/base/network_interfaces.h" | 32 #include "net/base/network_interfaces.h" |
33 #include "net/http/http_response_headers.h" | 33 #include "net/http/http_response_headers.h" |
34 #include "net/http/http_util.h" | 34 #include "net/http/http_util.h" |
| 35 #include "net/log/net_log.h" |
35 #include "net/log/net_log_source_type.h" | 36 #include "net/log/net_log_source_type.h" |
36 #include "url/gurl.h" | 37 #include "url/gurl.h" |
37 | 38 |
38 #if defined(OS_CHROMEOS) | 39 #if defined(OS_CHROMEOS) |
39 #include "chromeos/network/network_state.h" | 40 #include "chromeos/network/network_state.h" |
40 #include "chromeos/network/network_state_handler.h" | 41 #include "chromeos/network/network_state_handler.h" |
41 #include "third_party/cros_system_api/dbus/service_constants.h" | 42 #include "third_party/cros_system_api/dbus/service_constants.h" |
42 #endif | 43 #endif |
43 | 44 |
44 using base::Time; | 45 using base::Time; |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 158 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
158 } | 159 } |
159 | 160 |
160 DialServiceImpl::DialSocket::~DialSocket() { | 161 DialServiceImpl::DialSocket::~DialSocket() { |
161 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 162 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
162 } | 163 } |
163 | 164 |
164 bool DialServiceImpl::DialSocket::CreateAndBindSocket( | 165 bool DialServiceImpl::DialSocket::CreateAndBindSocket( |
165 const IPAddress& bind_ip_address, | 166 const IPAddress& bind_ip_address, |
166 net::NetLog* net_log, | 167 net::NetLog* net_log, |
167 net::NetLog::Source net_log_source) { | 168 net::NetLogSource net_log_source) { |
168 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 169 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
169 DCHECK(!socket_); | 170 DCHECK(!socket_); |
170 DCHECK(bind_ip_address.IsIPv4()); | 171 DCHECK(bind_ip_address.IsIPv4()); |
171 | 172 |
172 net::RandIntCallback rand_cb = base::Bind(&base::RandInt); | 173 net::RandIntCallback rand_cb = base::Bind(&base::RandInt); |
173 socket_ = base::MakeUnique<UDPSocket>(net::DatagramSocket::RANDOM_BIND, | 174 socket_ = base::MakeUnique<UDPSocket>(net::DatagramSocket::RANDOM_BIND, |
174 rand_cb, net_log, net_log_source); | 175 rand_cb, net_log, net_log_source); |
175 | 176 |
176 // 0 means bind a random port | 177 // 0 means bind a random port |
177 net::IPEndPoint address(bind_ip_address, 0); | 178 net::IPEndPoint address(bind_ip_address, 0); |
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
610 | 611 |
611 bool DialServiceImpl::HasOpenSockets() { | 612 bool DialServiceImpl::HasOpenSockets() { |
612 for (const auto& socket : dial_sockets_) { | 613 for (const auto& socket : dial_sockets_) { |
613 if (!socket->IsClosed()) | 614 if (!socket->IsClosed()) |
614 return true; | 615 return true; |
615 } | 616 } |
616 return false; | 617 return false; |
617 } | 618 } |
618 | 619 |
619 } // namespace extensions | 620 } // namespace extensions |
OLD | NEW |