Index: mojo/public/cpp/bindings/binding.h |
diff --git a/mojo/public/cpp/bindings/binding.h b/mojo/public/cpp/bindings/binding.h |
index 8c9ee2f0c5292c9eaa0d5f534cc3352d0eed9aee..ab1cab30819778c9f40266dc76f95a5d398e2c8b 100644 |
--- a/mojo/public/cpp/bindings/binding.h |
+++ b/mojo/public/cpp/bindings/binding.h |
@@ -21,6 +21,7 @@ |
namespace mojo { |
class AssociatedGroup; |
+class MessageReceiver; |
// Represents the binding of an interface implementation to a message pipe. |
// When the |Binding| object is destroyed, the binding between the message pipe |
@@ -152,6 +153,14 @@ class Binding { |
Bind(request.PassMessagePipe(), std::move(runner)); |
} |
+ // Adds a message filter to be notified of each incoming message before |
+ // dispatch. If a filter returns |false| from Accept(), the message is not |
+ // dispatched and the pipe is closed. Filters cannot be removed. |
+ void AddFilter(std::unique_ptr<MessageReceiver> filter) { |
+ DCHECK(is_bound()); |
+ internal_state_.AddFilter(std::move(filter)); |
+ } |
+ |
// Whether there are any associated interfaces running on the pipe currently. |
bool HasAssociatedInterfaces() const { |
return internal_state_.HasAssociatedInterfaces(); |