Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(64)

Side by Side Diff: services/shell/public/cpp/interface_registry.h

Issue 2402293002: Add a Javascript wrapper for InterfaceRegistry. (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 SERVICES_SHELL_PUBLIC_CPP_INTERFACE_REGISTRY_H_ 5 #ifndef SERVICES_SHELL_PUBLIC_CPP_INTERFACE_REGISTRY_H_
6 #define SERVICES_SHELL_PUBLIC_CPP_INTERFACE_REGISTRY_H_ 6 #define SERVICES_SHELL_PUBLIC_CPP_INTERFACE_REGISTRY_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <queue> 9 #include <queue>
10 #include <set> 10 #include <set>
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 public: 54 public:
55 explicit TestApi(InterfaceRegistry* registry) : registry_(registry) {} 55 explicit TestApi(InterfaceRegistry* registry) : registry_(registry) {}
56 ~TestApi() {} 56 ~TestApi() {}
57 57
58 void SetInterfaceBinderForName(InterfaceBinder* binder, 58 void SetInterfaceBinderForName(InterfaceBinder* binder,
59 const std::string& interface_name) { 59 const std::string& interface_name) {
60 registry_->SetInterfaceBinderForName( 60 registry_->SetInterfaceBinderForName(
61 base::WrapUnique(binder), interface_name); 61 base::WrapUnique(binder), interface_name);
62 } 62 }
63 63
64 template <typename Interface>
65 void GetLocalInterface(mojo::InterfaceRequest<Interface> request) {
66 GetLocalInterface(Interface::Name_, request.PassMessagePipe());
67 }
68
69 void GetLocalInterface(const std::string& name,
70 mojo::ScopedMessagePipeHandle handle) {
71 registry_->GetInterface(name, std::move(handle));
72 }
73
64 private: 74 private:
65 InterfaceRegistry* registry_; 75 InterfaceRegistry* registry_;
66 DISALLOW_COPY_AND_ASSIGN(TestApi); 76 DISALLOW_COPY_AND_ASSIGN(TestApi);
67 }; 77 };
68 78
69 // Construct an InterfaceRegistry with no filtering rules applied. 79 // Construct an InterfaceRegistry with no filtering rules applied.
70 InterfaceRegistry(); 80 InterfaceRegistry();
71 81
72 // Construct an InterfaceRegistry with filtering rules as specified in 82 // Construct an InterfaceRegistry with filtering rules as specified in
73 // |capability_request| applied. 83 // |capability_request| applied.
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 pending_interface_requests_; 177 pending_interface_requests_;
168 178
169 base::WeakPtrFactory<InterfaceRegistry> weak_factory_; 179 base::WeakPtrFactory<InterfaceRegistry> weak_factory_;
170 180
171 DISALLOW_COPY_AND_ASSIGN(InterfaceRegistry); 181 DISALLOW_COPY_AND_ASSIGN(InterfaceRegistry);
172 }; 182 };
173 183
174 } // namespace shell 184 } // namespace shell
175 185
176 #endif // SERVICES_SHELL_PUBLIC_CPP_INTERFACE_REGISTRY_H_ 186 #endif // SERVICES_SHELL_PUBLIC_CPP_INTERFACE_REGISTRY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698