diff options
Diffstat (limited to 'ipc/ipc_channel_proxy.h')
-rw-r--r-- | ipc/ipc_channel_proxy.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/ipc/ipc_channel_proxy.h b/ipc/ipc_channel_proxy.h index 2b1dea8..bcdeaac 100644 --- a/ipc/ipc_channel_proxy.h +++ b/ipc/ipc_channel_proxy.h @@ -98,6 +98,15 @@ class ChannelProxy : public Message::Sender { } }; + // Interface for a filter to be imposed on outgoing messages which can + // re-write the message. Used mainly for testing. + class OutgoingMessageFilter { + public: + // Returns a re-written message, freeing the original, or simply the + // original unchanged if no rewrite indicated. + virtual Message *Rewrite(Message *message) = 0; + }; + // Initializes a channel proxy. The channel_handle and mode parameters are // passed directly to the underlying IPC::Channel. The listener is called on // the thread that creates the ChannelProxy. The filter's OnMessageReceived @@ -139,6 +148,10 @@ class ChannelProxy : public Message::Sender { void AddFilter(MessageFilter* filter); void RemoveFilter(MessageFilter* filter); + void set_outgoing_message_filter(OutgoingMessageFilter* filter) { + outgoing_message_filter_ = filter; + } + // Called to clear the pointer to the IPC message loop when it's going away. void ClearIPCMessageLoop(); @@ -236,6 +249,10 @@ class ChannelProxy : public Message::Sender { Context* context() { return context_; } + OutgoingMessageFilter* outgoing_message_filter() { + return outgoing_message_filter_; + } + private: friend class SendTask; @@ -246,6 +263,8 @@ class ChannelProxy : public Message::Sender { // can safely be destroyed while the background thread continues to do stuff // that involves this data. scoped_refptr<Context> context_; + + OutgoingMessageFilter* outgoing_message_filter_; }; } // namespace IPC |