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 CONTENT_PUBLIC_COMMON_MOJO_SHELL_CONNECTION_H_ | 5 #ifndef CONTENT_PUBLIC_COMMON_MOJO_SHELL_CONNECTION_H_ |
6 #define CONTENT_PUBLIC_COMMON_MOJO_SHELL_CONNECTION_H_ | 6 #define CONTENT_PUBLIC_COMMON_MOJO_SHELL_CONNECTION_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 // Allows the caller to filter inbound connections and/or expose interfaces | 107 // Allows the caller to filter inbound connections and/or expose interfaces |
108 // on them. |filter| may be created on any thread, but will be used and | 108 // on them. |filter| may be created on any thread, but will be used and |
109 // destroyed exclusively on the IO thread (the thread corresponding to | 109 // destroyed exclusively on the IO thread (the thread corresponding to |
110 // |io_task_runner| passed to Create() above.) | 110 // |io_task_runner| passed to Create() above.) |
111 // | 111 // |
112 // Connection filters MUST be added before calling Start() in order to avoid | 112 // Connection filters MUST be added before calling Start() in order to avoid |
113 // races. | 113 // races. |
114 virtual void AddConnectionFilter( | 114 virtual void AddConnectionFilter( |
115 std::unique_ptr<ConnectionFilter> filter) = 0; | 115 std::unique_ptr<ConnectionFilter> filter) = 0; |
116 | 116 |
| 117 // Returns ownership of |filter|, added via AddConnectionFilter(), to the |
| 118 // caller. |
| 119 virtual std::unique_ptr<ConnectionFilter> RemoveConnectionFilter( |
| 120 ConnectionFilter* filter) = 0; |
| 121 |
117 // Adds an embedded service to this connection's ServiceFactory. | 122 // Adds an embedded service to this connection's ServiceFactory. |
118 // |info| provides details on how to construct new instances of the | 123 // |info| provides details on how to construct new instances of the |
119 // service when an incoming connection is made to |name|. | 124 // service when an incoming connection is made to |name|. |
120 virtual void AddEmbeddedService(const std::string& name, | 125 virtual void AddEmbeddedService(const std::string& name, |
121 const MojoApplicationInfo& info) = 0; | 126 const MojoApplicationInfo& info) = 0; |
122 | 127 |
123 // Adds a generic ServiceRequestHandler for a given service name. This | 128 // Adds a generic ServiceRequestHandler for a given service name. This |
124 // will be used to satisfy any incoming calls to CreateService() which | 129 // will be used to satisfy any incoming calls to CreateService() which |
125 // reference the given name. | 130 // reference the given name. |
126 // | 131 // |
127 // For in-process services, it is preferable to use |AddEmbeddedService()| as | 132 // For in-process services, it is preferable to use |AddEmbeddedService()| as |
128 // defined above. | 133 // defined above. |
129 virtual void AddServiceRequestHandler( | 134 virtual void AddServiceRequestHandler( |
130 const std::string& name, | 135 const std::string& name, |
131 const ServiceRequestHandler& handler) = 0; | 136 const ServiceRequestHandler& handler) = 0; |
132 }; | 137 }; |
133 | 138 |
134 } // namespace content | 139 } // namespace content |
135 | 140 |
136 #endif // CONTENT_PUBLIC_COMMON_MOJO_SHELL_CONNECTION_H_ | 141 #endif // CONTENT_PUBLIC_COMMON_MOJO_SHELL_CONNECTION_H_ |
OLD | NEW |