Chromium Code Reviews

Side by Side Diff: mojo/public/cpp/application/lib/interface_factory_connector.h

Issue 1975993002: Change InterfaceFactory<I>::Create() to take a ConnectionContext instead of an ApplicationConnectio… (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef MOJO_PUBLIC_CPP_APPLICATION_LIB_INTERFACE_FACTORY_CONNECTOR_H_ 5 #ifndef MOJO_PUBLIC_CPP_APPLICATION_LIB_INTERFACE_FACTORY_CONNECTOR_H_
6 #define MOJO_PUBLIC_CPP_APPLICATION_LIB_INTERFACE_FACTORY_CONNECTOR_H_ 6 #define MOJO_PUBLIC_CPP_APPLICATION_LIB_INTERFACE_FACTORY_CONNECTOR_H_
7 7
8 #include "mojo/public/cpp/application/interface_factory.h" 8 #include "mojo/public/cpp/application/interface_factory.h"
9 #include "mojo/public/cpp/application/service_connector.h" 9 #include "mojo/public/cpp/application/service_connector.h"
10 #include "mojo/public/cpp/bindings/interface_request.h" 10 #include "mojo/public/cpp/bindings/interface_request.h"
11 11
12 namespace mojo { 12 namespace mojo {
13 namespace internal { 13 namespace internal {
14 14
15 template <typename Interface> 15 template <typename Interface>
16 class InterfaceFactoryConnector : public ServiceConnector { 16 class InterfaceFactoryConnector : public ServiceConnector {
17 public: 17 public:
18 explicit InterfaceFactoryConnector(InterfaceFactory<Interface>* factory) 18 explicit InterfaceFactoryConnector(InterfaceFactory<Interface>* factory)
19 : factory_(factory) {} 19 : factory_(factory) {}
20 ~InterfaceFactoryConnector() override {} 20 ~InterfaceFactoryConnector() override {}
21 21
22 void ConnectToService(ApplicationConnection* application_connection, 22 void ConnectToService(const ConnectionContext& connection_context,
23 const std::string& interface_name, 23 const std::string& interface_name,
24 ScopedMessagePipeHandle client_handle) override { 24 ScopedMessagePipeHandle client_handle) override {
25 factory_->Create(application_connection, 25 factory_->Create(connection_context,
26 InterfaceRequest<Interface>(client_handle.Pass())); 26 InterfaceRequest<Interface>(client_handle.Pass()));
27 } 27 }
28 28
29 private: 29 private:
30 InterfaceFactory<Interface>* factory_; 30 InterfaceFactory<Interface>* factory_;
31 MOJO_DISALLOW_COPY_AND_ASSIGN(InterfaceFactoryConnector); 31 MOJO_DISALLOW_COPY_AND_ASSIGN(InterfaceFactoryConnector);
32 }; 32 };
33 33
34 } // namespace internal 34 } // namespace internal
35 } // namespace mojo 35 } // namespace mojo
36 36
37 #endif // MOJO_PUBLIC_CPP_APPLICATION_LIB_INTERFACE_FACTORY_CONNECTOR_H_ 37 #endif // MOJO_PUBLIC_CPP_APPLICATION_LIB_INTERFACE_FACTORY_CONNECTOR_H_
OLDNEW
« no previous file with comments | « mojo/public/cpp/application/interface_factory.h ('k') | mojo/public/cpp/application/lib/service_connector_registry.h » ('j') | no next file with comments »

Powered by Google App Engine