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

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

Issue 16272006: In-browser DNS-based service discovery system (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mdns_implementation
Patch Set: Created 7 years, 6 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
OLDNEW
(Empty)
1 // Copyright (c) 2013 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 "chrome/browser/local_discovery/service_discovery_client.h"
6
7 #include "chrome/browser/local_discovery/service_discovery_client_impl.h"
8
9 namespace local_discovery {
10 static ServiceDiscoveryClient* g_instance = NULL;
11
12 ServiceDescription::ServiceDescription() {
13 }
14
15 ServiceDescription::~ServiceDescription() {
16 }
17
18 std::string ServiceDescription::instance_name() const {
19 // TODO(noamsml): Once we have escaping working, get this to
20 // parse escaped domains.
21 size_t first_period = service_name.find_first_of('.');
22 return service_name.substr(0, first_period);
23 }
24
25 std::string ServiceDescription::service_type() const {
26 // TODO(noamsml): Once we have escaping working, get this to
27 // parse escaped domains.
28 size_t first_period = service_name.find_first_of('.');
29 if (first_period == std::string::npos)
30 return "";
31 return service_name.substr(first_period+1);
32 }
33
34
35 ServiceDiscoveryClient* ServiceDiscoveryClient::GetInstance() {
36 return g_instance ? g_instance : ServiceDiscoveryClientImpl::GetInstance();
37 }
38
39 void ServiceDiscoveryClient::SetInstance(ServiceDiscoveryClient* instance) {
40 g_instance = instance;
41 }
42
43 } // namespace local_discovery
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698