Index: mojo/public/cpp/bindings/associated_binding.h |
diff --git a/mojo/public/cpp/bindings/associated_binding.h b/mojo/public/cpp/bindings/associated_binding.h |
index 1da50090cc1ac15221f33d04abc66608cbfd00fa..66d7f8e61ec8b62ff56dcb9ac9a9fe0bee92821b 100644 |
--- a/mojo/public/cpp/bindings/associated_binding.h |
+++ b/mojo/public/cpp/bindings/associated_binding.h |
@@ -23,6 +23,8 @@ |
namespace mojo { |
+class MessageReceiver; |
+ |
// Represents the implementation side of an associated interface. It is similar |
// to Binding, except that it doesn't own a message pipe handle. |
// |
@@ -110,6 +112,14 @@ class AssociatedBinding { |
endpoint_client_->group_controller(); |
} |
+ // 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(endpoint_client_); |
+ endpoint_client_->AddFilter(std::move(filter)); |
+ } |
+ |
// Closes the associated interface. Puts this object into a state where it can |
// be rebound. |
void Close() { |