1 // Copyright 2017 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 #ifndef SERVICES_SERVICE_MANAGER_PUBLIC_CPP_INTERFACE_PROVIDER_BASE_H_
6 #define SERVICES_SERVICE_MANAGER_PUBLIC_CPP_INTERFACE_PROVIDER_BASE_H_
7 
8 #include "base/macros.h"
9 #include "mojo/public/cpp/bindings/pending_receiver.h"
10 #include "mojo/public/cpp/system/message_pipe.h"
11 #include "services/service_manager/public/cpp/export.h"
12 
13 namespace service_manager {
14 
15 class LocalInterfaceProvider {
16  public:
17   virtual ~LocalInterfaceProvider() = default;
18 
19   template <typename Interface>
GetInterface(mojo::PendingReceiver<Interface> receiver)20   void GetInterface(mojo::PendingReceiver<Interface> receiver) {
21     GetInterface(Interface::Name_, std::move(receiver.PassPipe()));
22   }
23   virtual void GetInterface(const std::string& name,
24                             mojo::ScopedMessagePipeHandle request_handle) = 0;
25 };
26 
27 }  // namespace service_manager
28 
29 #endif  // SERVICES_SERVICE_MANAGER_PUBLIC_CPP_INTERFACE_PROVIDER_BASE_H_
30