| 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/service_discovery_host_client.h" | 5 #include "chrome/browser/local_discovery/service_discovery_host_client.h" |
| 6 | 6 |
| 7 #include "base/location.h" | 7 #include "base/location.h" |
| 8 #include "base/single_thread_task_runner.h" | 8 #include "base/single_thread_task_runner.h" |
| 9 #include "base/thread_task_runner_handle.h" | 9 #include "base/thread_task_runner_handle.h" |
| 10 #include "chrome/common/local_discovery/local_discovery_messages.h" | 10 #include "chrome/common/local_discovery/local_discovery_messages.h" |
| (...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 408 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 409 callback_runner_->PostTask( | 409 callback_runner_->PostTask( |
| 410 FROM_HERE, | 410 FROM_HERE, |
| 411 base::Bind(&ServiceDiscoveryHostClient::RunResolverCallback, this, id, | 411 base::Bind(&ServiceDiscoveryHostClient::RunResolverCallback, this, id, |
| 412 status, description)); | 412 status, description)); |
| 413 } | 413 } |
| 414 | 414 |
| 415 void ServiceDiscoveryHostClient::OnLocalDomainResolverCallback( | 415 void ServiceDiscoveryHostClient::OnLocalDomainResolverCallback( |
| 416 uint64 id, | 416 uint64 id, |
| 417 bool success, | 417 bool success, |
| 418 const net::IPAddressNumber& ip_address_ipv4, | 418 const net::IPAddress& ip_address_ipv4, |
| 419 const net::IPAddressNumber& ip_address_ipv6) { | 419 const net::IPAddress& ip_address_ipv6) { |
| 420 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 420 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 421 callback_runner_->PostTask( | 421 callback_runner_->PostTask( |
| 422 FROM_HERE, | 422 FROM_HERE, |
| 423 base::Bind(&ServiceDiscoveryHostClient::RunLocalDomainResolverCallback, | 423 base::Bind(&ServiceDiscoveryHostClient::RunLocalDomainResolverCallback, |
| 424 this, id, success, ip_address_ipv4, ip_address_ipv6)); | 424 this, id, success, ip_address_ipv4, ip_address_ipv6)); |
| 425 } | 425 } |
| 426 | 426 |
| 427 void ServiceDiscoveryHostClient::RunWatcherCallback( | 427 void ServiceDiscoveryHostClient::RunWatcherCallback( |
| 428 uint64 id, | 428 uint64 id, |
| 429 ServiceWatcher::UpdateType update, | 429 ServiceWatcher::UpdateType update, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 440 const ServiceDescription& description) { | 440 const ServiceDescription& description) { |
| 441 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 441 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 442 ResolverCallbacks::iterator it = service_resolver_callbacks_.find(id); | 442 ResolverCallbacks::iterator it = service_resolver_callbacks_.find(id); |
| 443 if (it != service_resolver_callbacks_.end() && !it->second.is_null()) | 443 if (it != service_resolver_callbacks_.end() && !it->second.is_null()) |
| 444 it->second.Run(status, description); | 444 it->second.Run(status, description); |
| 445 } | 445 } |
| 446 | 446 |
| 447 void ServiceDiscoveryHostClient::RunLocalDomainResolverCallback( | 447 void ServiceDiscoveryHostClient::RunLocalDomainResolverCallback( |
| 448 uint64 id, | 448 uint64 id, |
| 449 bool success, | 449 bool success, |
| 450 const net::IPAddressNumber& ip_address_ipv4, | 450 const net::IPAddress& ip_address_ipv4, |
| 451 const net::IPAddressNumber& ip_address_ipv6) { | 451 const net::IPAddress& ip_address_ipv6) { |
| 452 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 452 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 453 DomainResolverCallbacks::iterator it = domain_resolver_callbacks_.find(id); | 453 DomainResolverCallbacks::iterator it = domain_resolver_callbacks_.find(id); |
| 454 if (it != domain_resolver_callbacks_.end() && !it->second.is_null()) | 454 if (it != domain_resolver_callbacks_.end() && !it->second.is_null()) |
| 455 it->second.Run(success, ip_address_ipv4, ip_address_ipv6); | 455 it->second.Run(success, ip_address_ipv4, ip_address_ipv6); |
| 456 } | 456 } |
| 457 | 457 |
| 458 } // namespace local_discovery | 458 } // namespace local_discovery |
| OLD | NEW |