| 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, | 43 net::NetworkInterface("lo", |
| 44 "lo", |
| 45 0, |
| 44 net::NetworkChangeNotifier::CONNECTION_UNKNOWN, | 46 net::NetworkChangeNotifier::CONNECTION_UNKNOWN, |
| 45 localhost_prefix, 8)); | 47 localhost_prefix, |
| 48 8, |
| 49 net::IP_ADDRESS_ATTRIBUTE_NONE)); |
| 46 content::BrowserThread::PostTask(content::BrowserThread::IO, FROM_HERE, | 50 content::BrowserThread::PostTask(content::BrowserThread::IO, FROM_HERE, |
| 47 base::Bind(callback, ip4_networks)); | 51 base::Bind(callback, ip4_networks)); |
| 48 } | 52 } |
| 49 | 53 |
| 50 } // namespace | 54 } // namespace |
| 51 | 55 |
| 52 namespace local_discovery { | 56 namespace local_discovery { |
| 53 | 57 |
| 54 PrivetTrafficDetector::PrivetTrafficDetector( | 58 PrivetTrafficDetector::PrivetTrafficDetector( |
| 55 net::AddressFamily address_family, | 59 net::AddressFamily address_family, |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 base::Unretained(this))); | 189 base::Unretained(this))); |
| 186 } while (rv > 0); | 190 } while (rv > 0); |
| 187 | 191 |
| 188 if (rv != net::ERR_IO_PENDING) | 192 if (rv != net::ERR_IO_PENDING) |
| 189 return rv; | 193 return rv; |
| 190 | 194 |
| 191 return net::OK; | 195 return net::OK; |
| 192 } | 196 } |
| 193 | 197 |
| 194 } // namespace local_discovery | 198 } // namespace local_discovery |
| OLD | NEW |