OLD | NEW |
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 <utility> | 11 #include <utility> |
11 | 12 |
12 #include "base/callback.h" | 13 #include "base/callback.h" |
13 #include "base/memory/ptr_util.h" | 14 #include "base/memory/ptr_util.h" |
14 #include "mojo/public/cpp/bindings/binding.h" | 15 #include "mojo/public/cpp/bindings/binding.h" |
15 #include "services/shell/public/cpp/lib/callback_binder.h" | 16 #include "services/shell/public/cpp/lib/callback_binder.h" |
16 #include "services/shell/public/cpp/lib/interface_factory_binder.h" | 17 #include "services/shell/public/cpp/lib/interface_factory_binder.h" |
17 #include "services/shell/public/interfaces/interface_provider.mojom.h" | 18 #include "services/shell/public/interfaces/interface_provider.mojom.h" |
18 | 19 |
19 namespace shell { | 20 namespace shell { |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 void RemoveInterface(const std::string& name); | 117 void RemoveInterface(const std::string& name); |
117 | 118 |
118 // Temporarily prevent incoming interface requests from being bound. Incoming | 119 // Temporarily prevent incoming interface requests from being bound. Incoming |
119 // requests will be queued internally and dispatched once ResumeBinding() is | 120 // requests will be queued internally and dispatched once ResumeBinding() is |
120 // called. | 121 // called. |
121 void PauseBinding(); | 122 void PauseBinding(); |
122 | 123 |
123 // Resumes incoming interface request binding. | 124 // Resumes incoming interface request binding. |
124 void ResumeBinding(); | 125 void ResumeBinding(); |
125 | 126 |
| 127 // Populates a set with the interface names this registry can bind. |
| 128 void GetInterfaceNames(std::set<std::string>* interface_names); |
| 129 |
126 private: | 130 private: |
127 using NameToInterfaceBinderMap = | 131 using NameToInterfaceBinderMap = |
128 std::map<std::string, std::unique_ptr<InterfaceBinder>>; | 132 std::map<std::string, std::unique_ptr<InterfaceBinder>>; |
129 | 133 |
130 // mojom::InterfaceProvider: | 134 // mojom::InterfaceProvider: |
131 void GetInterface(const mojo::String& interface_name, | 135 void GetInterface(const mojo::String& interface_name, |
132 mojo::ScopedMessagePipeHandle handle) override; | 136 mojo::ScopedMessagePipeHandle handle) override; |
133 | 137 |
134 // Returns true if the binder was set, false if it was not set (e.g. by | 138 // Returns true if the binder was set, false if it was not set (e.g. by |
135 // some filtering policy preventing this interface from being exposed). | 139 // some filtering policy preventing this interface from being exposed). |
(...skipping 17 matching lines...) Expand all Loading... |
153 pending_interface_requests_; | 157 pending_interface_requests_; |
154 | 158 |
155 base::WeakPtrFactory<InterfaceRegistry> weak_factory_; | 159 base::WeakPtrFactory<InterfaceRegistry> weak_factory_; |
156 | 160 |
157 DISALLOW_COPY_AND_ASSIGN(InterfaceRegistry); | 161 DISALLOW_COPY_AND_ASSIGN(InterfaceRegistry); |
158 }; | 162 }; |
159 | 163 |
160 } // namespace shell | 164 } // namespace shell |
161 | 165 |
162 #endif // SERVICES_SHELL_PUBLIC_CPP_INTERFACE_REGISTRY_H_ | 166 #endif // SERVICES_SHELL_PUBLIC_CPP_INTERFACE_REGISTRY_H_ |
OLD | NEW |