| OLD | NEW | 
|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be | 
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. | 
| 4 | 4 | 
| 5 #ifndef IPC_MESSAGE_FILTER_H_ | 5 #ifndef IPC_MESSAGE_FILTER_H_ | 
| 6 #define IPC_MESSAGE_FILTER_H_ | 6 #define IPC_MESSAGE_FILTER_H_ | 
| 7 | 7 | 
| 8 #include <stdint.h> | 8 #include <stdint.h> | 
| 9 | 9 | 
| 10 #include <vector> | 10 #include <vector> | 
| 11 | 11 | 
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" | 
|  | 13 #include "ipc/ipc_channel.h" | 
| 13 #include "ipc/ipc_export.h" | 14 #include "ipc/ipc_export.h" | 
| 14 | 15 | 
| 15 namespace IPC { | 16 namespace IPC { | 
| 16 | 17 | 
| 17 class Sender; |  | 
| 18 class Message; | 18 class Message; | 
| 19 | 19 | 
| 20 // A class that receives messages on the thread where the IPC channel is | 20 // A class that receives messages on the thread where the IPC channel is | 
| 21 // running.  It can choose to prevent the default action for an IPC message. | 21 // running.  It can choose to prevent the default action for an IPC message. | 
| 22 class IPC_EXPORT MessageFilter | 22 class IPC_EXPORT MessageFilter | 
| 23     : public base::RefCountedThreadSafe<MessageFilter> { | 23     : public base::RefCountedThreadSafe<MessageFilter> { | 
| 24  public: | 24  public: | 
| 25   MessageFilter(); | 25   MessageFilter(); | 
| 26 | 26 | 
| 27   // Called on the background thread to provide the filter with access to the | 27   // Called on the background thread to provide the filter with access to the | 
| 28   // channel.  Called when the IPC channel is initialized or when AddFilter | 28   // channel.  Called when the IPC channel is initialized or when AddFilter | 
| 29   // is called if the channel is already initialized. | 29   // is called if the channel is already initialized. | 
| 30   virtual void OnFilterAdded(Sender* sender); | 30   virtual void OnFilterAdded(Channel* channel); | 
| 31 | 31 | 
| 32   // Called on the background thread when the filter has been removed from | 32   // Called on the background thread when the filter has been removed from | 
| 33   // the ChannelProxy and when the Channel is closing.  After a filter is | 33   // the ChannelProxy and when the Channel is closing.  After a filter is | 
| 34   // removed, it will not be called again. | 34   // removed, it will not be called again. | 
| 35   virtual void OnFilterRemoved(); | 35   virtual void OnFilterRemoved(); | 
| 36 | 36 | 
| 37   // Called to inform the filter that the IPC channel is connected and we | 37   // Called to inform the filter that the IPC channel is connected and we | 
| 38   // have received the internal Hello message from the peer. | 38   // have received the internal Hello message from the peer. | 
| 39   virtual void OnChannelConnected(int32_t peer_pid); | 39   virtual void OnChannelConnected(int32_t peer_pid); | 
| 40 | 40 | 
| (...skipping 19 matching lines...) Expand all  Loading... | 
| 60  protected: | 60  protected: | 
| 61   virtual ~MessageFilter(); | 61   virtual ~MessageFilter(); | 
| 62 | 62 | 
| 63  private: | 63  private: | 
| 64   friend class base::RefCountedThreadSafe<MessageFilter>; | 64   friend class base::RefCountedThreadSafe<MessageFilter>; | 
| 65 }; | 65 }; | 
| 66 | 66 | 
| 67 }  // namespace IPC | 67 }  // namespace IPC | 
| 68 | 68 | 
| 69 #endif  // IPC_MESSAGE_FILTER_H_ | 69 #endif  // IPC_MESSAGE_FILTER_H_ | 
| OLD | NEW | 
|---|