Index: ipc/ipc_channel_proxy.h |
=================================================================== |
--- ipc/ipc_channel_proxy.h (revision 83739) |
+++ ipc/ipc_channel_proxy.h (working copy) |
@@ -99,6 +99,15 @@ |
} |
}; |
+ // 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 |
@@ -140,6 +149,10 @@ |
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(); |
@@ -235,6 +248,10 @@ |
Context* context() { return context_; } |
+ OutgoingMessageFilter* outgoing_message_filter() { |
+ return outgoing_message_filter_; |
+ } |
+ |
private: |
friend class SendTask; |
@@ -245,6 +262,8 @@ |
// 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 |