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_source_type.h" |
35 #include "url/gurl.h" | 36 #include "url/gurl.h" |
36 | 37 |
37 #if defined(OS_CHROMEOS) | 38 #if defined(OS_CHROMEOS) |
38 #include "chromeos/network/network_state.h" | 39 #include "chromeos/network/network_state.h" |
39 #include "chromeos/network/network_state_handler.h" | 40 #include "chromeos/network/network_state_handler.h" |
40 #include "third_party/cros_system_api/dbus/service_constants.h" | 41 #include "third_party/cros_system_api/dbus/service_constants.h" |
41 #endif | 42 #endif |
42 | 43 |
43 using base::Time; | 44 using base::Time; |
44 using base::TimeDelta; | 45 using base::TimeDelta; |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 kDialRequestIntervalMillis) + | 383 kDialRequestIntervalMillis) + |
383 TimeDelta::FromSeconds(kDialResponseTimeoutSecs)), | 384 TimeDelta::FromSeconds(kDialResponseTimeoutSecs)), |
384 request_interval_( | 385 request_interval_( |
385 TimeDelta::FromMilliseconds(kDialRequestIntervalMillis)), | 386 TimeDelta::FromMilliseconds(kDialRequestIntervalMillis)), |
386 weak_factory_(this) { | 387 weak_factory_(this) { |
387 IPAddress address; | 388 IPAddress address; |
388 bool success = address.AssignFromIPLiteral(kDialRequestAddress); | 389 bool success = address.AssignFromIPLiteral(kDialRequestAddress); |
389 DCHECK(success); | 390 DCHECK(success); |
390 send_address_ = net::IPEndPoint(address, kDialRequestPort); | 391 send_address_ = net::IPEndPoint(address, kDialRequestPort); |
391 send_buffer_ = new StringIOBuffer(BuildRequest()); | 392 send_buffer_ = new StringIOBuffer(BuildRequest()); |
392 net_log_source_.type = net::NetLog::SOURCE_UDP_SOCKET; | 393 net_log_source_.type = net::NetLogSourceType::UDP_SOCKET; |
393 net_log_source_.id = net_log_->NextID(); | 394 net_log_source_.id = net_log_->NextID(); |
394 } | 395 } |
395 | 396 |
396 DialServiceImpl::~DialServiceImpl() { | 397 DialServiceImpl::~DialServiceImpl() { |
397 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 398 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
398 } | 399 } |
399 | 400 |
400 void DialServiceImpl::AddObserver(Observer* observer) { | 401 void DialServiceImpl::AddObserver(Observer* observer) { |
401 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 402 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
402 observer_list_.AddObserver(observer); | 403 observer_list_.AddObserver(observer); |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
609 | 610 |
610 bool DialServiceImpl::HasOpenSockets() { | 611 bool DialServiceImpl::HasOpenSockets() { |
611 for (const auto& socket : dial_sockets_) { | 612 for (const auto& socket : dial_sockets_) { |
612 if (!socket->IsClosed()) | 613 if (!socket->IsClosed()) |
613 return true; | 614 return true; |
614 } | 615 } |
615 return false; | 616 return false; |
616 } | 617 } |
617 | 618 |
618 } // namespace extensions | 619 } // namespace extensions |
OLD | NEW |