Make BrowserMessageFilter not derive from IPC::ChannelProxy::MessageFilter. This allows us to hide the OnMessageReceived which shouldn't be overridden from child classes, and also avoid the pattern of requiring an overridden method to have to call to the base class.

R=scherkus@chromium.org, scherkus

Review URL: https://codereview.chromium.org/24514003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@226251 0039d316-1c4b-4281-b951-d872f2087c98


CrOS-Libchrome-Original-Commit: ba780c1bb6637c1ee4880129aee2e85987a8e2d3
diff --git a/ipc/ipc_channel_proxy.cc b/ipc/ipc_channel_proxy.cc
index 45512f9..acc068d 100644
--- a/ipc/ipc_channel_proxy.cc
+++ b/ipc/ipc_channel_proxy.cc
@@ -36,10 +36,6 @@
   return false;
 }
 
-void ChannelProxy::MessageFilter::OnDestruct() const {
-  delete this;
-}
-
 ChannelProxy::MessageFilter::~MessageFilter() {}
 
 //------------------------------------------------------------------------------
diff --git a/ipc/ipc_channel_proxy.h b/ipc/ipc_channel_proxy.h
index 4d5a7d4..a0de88e 100644
--- a/ipc/ipc_channel_proxy.h
+++ b/ipc/ipc_channel_proxy.h
@@ -54,12 +54,11 @@
 //
 class IPC_EXPORT ChannelProxy : public Sender, public base::NonThreadSafe {
  public:
-  struct MessageFilterTraits;
 
   // A class that receives messages on the thread where the IPC channel is
   // running.  It can choose to prevent the default action for an IPC message.
   class IPC_EXPORT MessageFilter
-      : public base::RefCountedThreadSafe<MessageFilter, MessageFilterTraits> {
+      : public base::RefCountedThreadSafe<MessageFilter> {
    public:
     MessageFilter();
 
@@ -89,26 +88,13 @@
     // the message be handled in the default way.
     virtual bool OnMessageReceived(const Message& message);
 
-    // Called when the message filter is about to be deleted.  This gives
-    // derived classes the option of controlling which thread they're deleted
-    // on etc.
-    virtual void OnDestruct() const;
-
    protected:
     virtual ~MessageFilter();
 
    private:
-    friend class base::RefCountedThreadSafe<MessageFilter,
-                                            MessageFilterTraits>;
+    friend class base::RefCountedThreadSafe<MessageFilter>;
   };
 
-  struct MessageFilterTraits {
-    static void Destruct(const MessageFilter* filter) {
-      filter->OnDestruct();
-    }
-  };
-
-
   // Interface for a filter to be imposed on outgoing messages which can
   // re-write the message.  Used mainly for testing.
   class OutgoingMessageFilter {