Add ICU message format support
[chromium-blink-merge.git] / chrome / browser / local_discovery / privet_device_resolver.cc
blob915d42c8f7f51e6ee9a7d5916b2fa1e1258b9590
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
3 // found in the LICENSE file.
5 #include "base/bind.h"
6 #include "chrome/browser/local_discovery/privet_device_resolver.h"
8 namespace local_discovery {
10 PrivetDeviceResolver::PrivetDeviceResolver(
11 ServiceDiscoveryClient* service_discovery_client,
12 const std::string& service_name,
13 const ResultCallback& callback)
14 : service_discovery_client_(service_discovery_client),
15 service_name_(service_name), callback_(callback) {
18 PrivetDeviceResolver::~PrivetDeviceResolver() {
21 void PrivetDeviceResolver::Start() {
22 service_resolver_ = service_discovery_client_->CreateServiceResolver(
23 service_name_,
24 base::Bind(&PrivetDeviceResolver::OnServiceResolved,
25 base::Unretained(this)));
26 service_resolver_->StartResolving();
29 void PrivetDeviceResolver::OnServiceResolved(
30 ServiceResolver::RequestStatus request_status,
31 const ServiceDescription& service_description) {
32 if (request_status != ServiceResolver::STATUS_SUCCESS) {
33 callback_.Run(false, DeviceDescription());
34 return;
37 callback_.Run(true, DeviceDescription(service_description));
40 } // namespace local_discovery