summaryrefslogtreecommitdiffstats
path: root/ipc/ipc_channel_proxy.h
diff options
context:
space:
mode:
authortsepez@chromium.org <tsepez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-04 17:14:16 +0000
committertsepez@chromium.org <tsepez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-04 17:14:16 +0000
commit894803199a98888bcbf913557e0952ae64cd0bf5 (patch)
tree53de7430f6db15e914e3ec5c965e2f3735cc4f91 /ipc/ipc_channel_proxy.h
parent2ad3f3364a83bf499a43fdc8967f32d34c52ce7c (diff)
downloadchromium_src-894803199a98888bcbf913557e0952ae64cd0bf5.zip
chromium_src-894803199a98888bcbf913557e0952ae64cd0bf5.tar.gz
chromium_src-894803199a98888bcbf913557e0952ae64cd0bf5.tar.bz2
IPC outgoing message filters interpose yourself in a message stream. Minimally invasive baseline for building IPC tests to abuse browser along the lines of a compromised renderer.
Review URL: http://codereview.chromium.org/6711024 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@84076 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ipc/ipc_channel_proxy.h')
-rw-r--r--ipc/ipc_channel_proxy.h19
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