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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/local_discovery/service_discovery_client.cc
diff --git a/chrome/browser/local_discovery/service_discovery_client.cc b/chrome/browser/local_discovery/service_discovery_client.cc
new file mode 100644
index 0000000000000000000000000000000000000000..081df8fafa83f22dcedfa29736d5d29a5bf410b8
--- /dev/null
+++ b/chrome/browser/local_discovery/service_discovery_client.cc
@@ -0,0 +1,43 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/local_discovery/service_discovery_client.h"
+
+#include "chrome/browser/local_discovery/service_discovery_client_impl.h"
+
+namespace local_discovery {
+static ServiceDiscoveryClient* g_instance = NULL;
+
+ServiceDescription::ServiceDescription() {
+}
+
+ServiceDescription::~ServiceDescription() {
+}
+
+std::string ServiceDescription::instance_name() const {
+ // TODO(noamsml): Once we have escaping working, get this to
+ // parse escaped domains.
+ size_t first_period = service_name.find_first_of('.');
+ return service_name.substr(0, first_period);
+}
+
+std::string ServiceDescription::service_type() const {
+ // TODO(noamsml): Once we have escaping working, get this to
+ // parse escaped domains.
+ size_t first_period = service_name.find_first_of('.');
+ if (first_period == std::string::npos)
+ return "";
+ return service_name.substr(first_period+1);
+}
+
+
+ServiceDiscoveryClient* ServiceDiscoveryClient::GetInstance() {
+ return g_instance ? g_instance : ServiceDiscoveryClientImpl::GetInstance();
+}
+
+void ServiceDiscoveryClient::SetInstance(ServiceDiscoveryClient* instance) {
+ g_instance = instance;
+}
+
+} // namespace local_discovery

Powered by Google App Engine
This is Rietveld 408576698