aboutsummaryrefslogtreecommitdiff
path: root/osp/impl/dns_sd_service_publisher_factory.cc
diff options
context:
space:
mode:
Diffstat (limited to 'osp/impl/dns_sd_service_publisher_factory.cc')
-rw-r--r--osp/impl/dns_sd_service_publisher_factory.cc34
1 files changed, 34 insertions, 0 deletions
diff --git a/osp/impl/dns_sd_service_publisher_factory.cc b/osp/impl/dns_sd_service_publisher_factory.cc
new file mode 100644
index 00000000..5c63dc83
--- /dev/null
+++ b/osp/impl/dns_sd_service_publisher_factory.cc
@@ -0,0 +1,34 @@
+// Copyright 2021 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 <algorithm>
+#include <memory>
+
+#include "discovery/dnssd/public/dns_sd_publisher.h"
+#include "osp/impl/dns_sd_publisher_client.h"
+#include "osp/impl/service_publisher_impl.h"
+#include "osp/public/service_publisher.h"
+#include "osp/public/service_publisher_factory.h"
+
+namespace openscreen {
+
+class TaskRunner;
+
+namespace osp {
+
+// static
+std::unique_ptr<ServicePublisher> ServicePublisherFactory::Create(
+ const ServicePublisher::Config& config,
+ ServicePublisher::Observer* observer,
+ TaskRunner* task_runner) {
+ auto dns_sd_client =
+ std::make_unique<DnsSdPublisherClient>(observer, task_runner);
+ auto publisher_impl = std::make_unique<ServicePublisherImpl>(
+ observer, std::move(dns_sd_client));
+ publisher_impl->SetConfig(config);
+ return publisher_impl;
+}
+
+} // namespace osp
+} // namespace openscreen