1 // Copyright 2021 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 <algorithm> 6 #include <memory> 7 8 #include "discovery/dnssd/public/dns_sd_publisher.h" 9 #include "osp/impl/dns_sd_publisher_client.h" 10 #include "osp/impl/service_publisher_impl.h" 11 #include "osp/public/service_publisher.h" 12 #include "osp/public/service_publisher_factory.h" 13 14 namespace openscreen { 15 16 class TaskRunner; 17 18 namespace osp { 19 20 // static Create(const ServicePublisher::Config & config,ServicePublisher::Observer * observer,TaskRunner * task_runner)21std::unique_ptr<ServicePublisher> ServicePublisherFactory::Create( 22 const ServicePublisher::Config& config, 23 ServicePublisher::Observer* observer, 24 TaskRunner* task_runner) { 25 auto dns_sd_client = 26 std::make_unique<DnsSdPublisherClient>(observer, task_runner); 27 auto publisher_impl = std::make_unique<ServicePublisherImpl>( 28 observer, std::move(dns_sd_client)); 29 publisher_impl->SetConfig(config); 30 return publisher_impl; 31 } 32 33 } // namespace osp 34 } // namespace openscreen 35