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_CONNECTION_FILTER_H_ | 5 #ifndef CONTENT_PUBLIC_COMMON_CONNECTION_FILTER_H_ |
6 #define CONTENT_PUBLIC_COMMON_CONNECTION_FILTER_H_ | 6 #define CONTENT_PUBLIC_COMMON_CONNECTION_FILTER_H_ |
7 | 7 |
8 #include "content/common/content_export.h" | 8 #include "content/common/content_export.h" |
9 | 9 |
10 namespace shell { | 10 namespace shell { |
11 class Connection; | |
12 class Connector; | 11 class Connector; |
| 12 class Identity; |
| 13 class InterfaceRegistry; |
13 } | 14 } |
14 | 15 |
15 namespace content { | 16 namespace content { |
16 | 17 |
17 // A ConnectionFilter may be used to conditionally expose interfaces on inbound | 18 // A ConnectionFilter may be used to conditionally expose interfaces on inbound |
18 // connections accepted by MojoShellConnection. ConnectionFilters are used | 19 // connections accepted by MojoShellConnection. ConnectionFilters are used |
19 // exclusively on the IO thread. See MojoShellConnection::AddConnectionFilter | 20 // exclusively on the IO thread. See MojoShellConnection::AddConnectionFilter |
20 // for details. | 21 // for details. |
21 class CONTENT_EXPORT ConnectionFilter { | 22 class CONTENT_EXPORT ConnectionFilter { |
22 public: | 23 public: |
23 virtual ~ConnectionFilter() {} | 24 virtual ~ConnectionFilter() {} |
24 | 25 |
25 // Called for every new connection accepted. Implementations may add | 26 // Called for every new connection accepted. Implementations may add |
26 // interfaces to |connection|, in which case they should return |true|. | 27 // interfaces to |registry|, in which case they should return |true|. |
27 // |connector| is a corresponding outgoing Connector that may be used by any | 28 // |connector| is a corresponding outgoing Connector that may be used by any |
28 // interfaces added to the connection. Note that references to |connector| | 29 // interfaces added to the connection. Note that references to |connector| |
29 // must not be retained, but an owned copy may be obtained by calling | 30 // must not be retained, but an owned copy may be obtained by calling |
30 // |connector->Clone()|. | 31 // |connector->Clone()|. |
31 // | 32 // |
32 // If a ConnectionFilter is not interested in an incoming connection, it | 33 // If a ConnectionFilter is not interested in an incoming connection, it |
33 // should return |false|. | 34 // should return |false|. |
34 virtual bool OnConnect(shell::Connection* connection, | 35 virtual bool OnConnect(const shell::Identity& remote_identity, |
| 36 shell::InterfaceRegistry* registry, |
35 shell::Connector* connector) = 0; | 37 shell::Connector* connector) = 0; |
36 }; | 38 }; |
37 | 39 |
38 } // namespace content | 40 } // namespace content |
39 | 41 |
40 #endif // CONTENT_PUBLIC_COMMON_CONNECTION_FILTER_H_ | 42 #endif // CONTENT_PUBLIC_COMMON_CONNECTION_FILTER_H_ |
OLD | NEW |