OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "chrome/browser/local_discovery/privet_device_resolver.h" | 6 #include "chrome/browser/local_discovery/privet_device_resolver.h" |
7 | 7 |
8 namespace local_discovery { | 8 namespace local_discovery { |
9 | 9 |
10 PrivetDeviceResolver::PrivetDeviceResolver( | 10 PrivetDeviceResolver::PrivetDeviceResolver( |
(...skipping 11 matching lines...) Expand all Loading... |
22 service_resolver_ = service_discovery_client_->CreateServiceResolver( | 22 service_resolver_ = service_discovery_client_->CreateServiceResolver( |
23 service_name_, | 23 service_name_, |
24 base::Bind(&PrivetDeviceResolver::OnServiceResolved, | 24 base::Bind(&PrivetDeviceResolver::OnServiceResolved, |
25 base::Unretained(this))); | 25 base::Unretained(this))); |
26 service_resolver_->StartResolving(); | 26 service_resolver_->StartResolving(); |
27 } | 27 } |
28 | 28 |
29 void PrivetDeviceResolver::OnServiceResolved( | 29 void PrivetDeviceResolver::OnServiceResolved( |
30 ServiceResolver::RequestStatus request_status, | 30 ServiceResolver::RequestStatus request_status, |
31 const ServiceDescription& service_description) { | 31 const ServiceDescription& service_description) { |
32 DeviceDescription device_description; | |
33 if (request_status != ServiceResolver::STATUS_SUCCESS) { | 32 if (request_status != ServiceResolver::STATUS_SUCCESS) { |
34 callback_.Run(false, device_description); | 33 callback_.Run(false, DeviceDescription()); |
35 return; | 34 return; |
36 } | 35 } |
37 | 36 |
38 device_description.FillFromServiceDescription(service_description); | 37 callback_.Run(true, DeviceDescription(service_description)); |
39 callback_.Run(true, device_description); | |
40 } | 38 } |
41 | 39 |
42 } // namespace local_discovery | 40 } // namespace local_discovery |
OLD | NEW |