| OLD | NEW |
| (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 |
| OLD | NEW |