| 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/printing/cloud_print/privet_traffic_detector.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
| 12 #include "base/single_thread_task_runner.h" | 12 #include "base/single_thread_task_runner.h" |
| 13 #include "base/sys_byteorder.h" | 13 #include "base/sys_byteorder.h" |
| 14 #include "net/base/net_errors.h" | 14 #include "net/base/net_errors.h" |
| 15 #include "net/base/network_interfaces.h" | 15 #include "net/base/network_interfaces.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 net::NetworkChangeNotifier::CONNECTION_UNKNOWN, | 51 net::NetworkChangeNotifier::CONNECTION_UNKNOWN, |
| 52 localhost_prefix, | 52 localhost_prefix, |
| 53 8, | 53 8, |
| 54 net::IP_ADDRESS_ATTRIBUTE_NONE)); | 54 net::IP_ADDRESS_ATTRIBUTE_NONE)); |
| 55 content::BrowserThread::PostTask(content::BrowserThread::IO, FROM_HERE, | 55 content::BrowserThread::PostTask(content::BrowserThread::IO, FROM_HERE, |
| 56 base::Bind(callback, ip4_networks)); | 56 base::Bind(callback, ip4_networks)); |
| 57 } | 57 } |
| 58 | 58 |
| 59 } // namespace | 59 } // namespace |
| 60 | 60 |
| 61 namespace local_discovery { | 61 namespace cloud_print { |
| 62 | 62 |
| 63 PrivetTrafficDetector::PrivetTrafficDetector( | 63 PrivetTrafficDetector::PrivetTrafficDetector( |
| 64 net::AddressFamily address_family, | 64 net::AddressFamily address_family, |
| 65 const base::Closure& on_traffic_detected) | 65 const base::Closure& on_traffic_detected) |
| 66 : on_traffic_detected_(on_traffic_detected), | 66 : on_traffic_detected_(on_traffic_detected), |
| 67 callback_runner_(base::MessageLoop::current()->task_runner()), | 67 callback_runner_(base::MessageLoop::current()->task_runner()), |
| 68 address_family_(address_family), | 68 address_family_(address_family), |
| 69 io_buffer_( | 69 io_buffer_( |
| 70 new net::IOBufferWithSize(net::dns_protocol::kMaxMulticastSize)), | 70 new net::IOBufferWithSize(net::dns_protocol::kMaxMulticastSize)), |
| 71 restart_attempts_(kMaxRestartAttempts), | 71 restart_attempts_(kMaxRestartAttempts), |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 base::Bind(base::IgnoreResult(&PrivetTrafficDetector::DoLoop), | 193 base::Bind(base::IgnoreResult(&PrivetTrafficDetector::DoLoop), |
| 194 base::Unretained(this))); | 194 base::Unretained(this))); |
| 195 } while (rv > 0); | 195 } while (rv > 0); |
| 196 | 196 |
| 197 if (rv != net::ERR_IO_PENDING) | 197 if (rv != net::ERR_IO_PENDING) |
| 198 return rv; | 198 return rv; |
| 199 | 199 |
| 200 return net::OK; | 200 return net::OK; |
| 201 } | 201 } |
| 202 | 202 |
| 203 } // namespace local_discovery | 203 } // namespace cloud_print |
| OLD | NEW |