Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(587)

Side by Side Diff: chrome/browser/local_discovery/privet_device_resolver.cc

Issue 131503013: Added PrivetDeviceResolver to resolve a device and parse it as a privet device (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/local_discovery/privet_device_resolver.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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.
4
5 #include "base/bind.h"
6 #include "chrome/browser/local_discovery/privet_device_resolver.h"
7
8 namespace local_discovery {
9
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) {
16 }
17
18 PrivetDeviceResolver::~PrivetDeviceResolver() {
19 }
20
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();
27 }
28
29 void PrivetDeviceResolver::OnServiceResolved(
30 ServiceResolver::RequestStatus request_status,
31 const ServiceDescription& service_description) {
32 DeviceDescription device_description;
33 if (request_status != ServiceResolver::STATUS_SUCCESS) {
34 callback_.Run(false, device_description);
35 return;
36 }
37
38 device_description.FillFromServiceDescription(service_description);
39 callback_.Run(true, device_description);
40 }
41
42 } // namespace local_discovery
OLDNEW
« no previous file with comments | « chrome/browser/local_discovery/privet_device_resolver.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698