OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/local_discovery/privet_traffic_detector.h" | 5 #include "chrome/browser/local_discovery/privet_traffic_detector.h" |
6 | 6 |
7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
8 #include "base/sys_byteorder.h" | 8 #include "base/sys_byteorder.h" |
9 #include "net/base/dns_util.h" | 9 #include "net/base/dns_util.h" |
10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 net::GetAddressFamily(networks[i].address); | 33 net::GetAddressFamily(networks[i].address); |
34 if (address_family == net::ADDRESS_FAMILY_IPV4 && | 34 if (address_family == net::ADDRESS_FAMILY_IPV4 && |
35 networks[i].network_prefix >= 24) { | 35 networks[i].network_prefix >= 24) { |
36 ip4_networks.push_back(networks[i]); | 36 ip4_networks.push_back(networks[i]); |
37 } | 37 } |
38 } | 38 } |
39 | 39 |
40 net::IPAddressNumber localhost_prefix(4, 0); | 40 net::IPAddressNumber localhost_prefix(4, 0); |
41 localhost_prefix[0] = 127; | 41 localhost_prefix[0] = 127; |
42 ip4_networks.push_back( | 42 ip4_networks.push_back( |
43 net::NetworkInterface("lo", "lo", 0, localhost_prefix, 8)); | 43 net::NetworkInterface("lo", "lo", 0, net::NETWORK_INTERFACE_UNKNOWN, |
| 44 localhost_prefix, 8)); |
44 content::BrowserThread::PostTask(content::BrowserThread::IO, FROM_HERE, | 45 content::BrowserThread::PostTask(content::BrowserThread::IO, FROM_HERE, |
45 base::Bind(callback, ip4_networks)); | 46 base::Bind(callback, ip4_networks)); |
46 } | 47 } |
47 | 48 |
48 } // namespace | 49 } // namespace |
49 | 50 |
50 namespace local_discovery { | 51 namespace local_discovery { |
51 | 52 |
52 PrivetTrafficDetector::PrivetTrafficDetector( | 53 PrivetTrafficDetector::PrivetTrafficDetector( |
53 net::AddressFamily address_family, | 54 net::AddressFamily address_family, |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 base::Unretained(this))); | 184 base::Unretained(this))); |
184 } while (rv > 0); | 185 } while (rv > 0); |
185 | 186 |
186 if (rv != net::ERR_IO_PENDING) | 187 if (rv != net::ERR_IO_PENDING) |
187 return rv; | 188 return rv; |
188 | 189 |
189 return net::OK; | 190 return net::OK; |
190 } | 191 } |
191 | 192 |
192 } // namespace local_discovery | 193 } // namespace local_discovery |
OLD | NEW |