1 // Copyright 2015 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.
5 #include "components/kiosk_wm/merged_service_provider.h"
9 MergedServiceProvider::MergedServiceProvider(
10 mojo::ServiceProviderPtr exposed_services
,
11 mojo::InterfaceFactory
<mojo::NavigatorHost
>* factory
)
12 : exposed_services_(exposed_services
.Pass()), factory_(factory
) {
15 MergedServiceProvider::~MergedServiceProvider() {
18 mojo::ServiceProviderPtr
MergedServiceProvider::GetServiceProviderPtr() {
19 mojo::ServiceProviderPtr sp
;
20 binding_
.reset(new mojo::Binding
<mojo::ServiceProvider
>(this, GetProxy(&sp
)));
24 void MergedServiceProvider::ConnectToService(
25 const mojo::String
& interface_name
,
26 mojo::ScopedMessagePipeHandle pipe
) {
27 if (interface_name
== mojo::NavigatorHost::Name_
) {
28 factory_
->Create(nullptr,
29 mojo::MakeRequest
<mojo::NavigatorHost
>(pipe
.Pass()));
30 } else if (exposed_services_
.get()) {
31 exposed_services_
->ConnectToService(interface_name
, pipe
.Pass());
35 } // namespace kiosk_wm