OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 CHROME_COMMON_IPC_CHANNEL_H__ | 5 #ifndef CHROME_COMMON_IPC_CHANNEL_H__ |
6 #define CHROME_COMMON_IPC_CHANNEL_H__ | 6 #define CHROME_COMMON_IPC_CHANNEL_H__ |
7 | 7 |
8 #include <queue> | 8 #include <queue> |
9 | 9 |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
11 #include "chrome/common/ipc_message.h" | 11 #include "chrome/common/ipc_message.h" |
12 | 12 |
13 namespace IPC { | 13 namespace IPC { |
14 | 14 |
15 //------------------------------------------------------------------------------ | 15 //------------------------------------------------------------------------------ |
16 | 16 |
17 class Channel : public MessageLoopForIO::Watcher, | 17 class Channel : public MessageLoopForIO::Watcher, |
18 public Message::Sender { | 18 public Message::Sender { |
19 // Security tests need access to the pipe handle. | 19 // Security tests need access to the pipe handle. |
20 friend class ChannelTest; | 20 friend class ChannelTest; |
21 | 21 |
22 public: | 22 public: |
23 // Implemented by consumers of a Channel to receive messages. | 23 // Implemented by consumers of a Channel to receive messages. |
24 class Listener { | 24 class Listener { |
25 public: | 25 public: |
| 26 virtual ~Listener() {} |
| 27 |
26 // Called when a message is received. | 28 // Called when a message is received. |
27 virtual void OnMessageReceived(const Message& message) = 0; | 29 virtual void OnMessageReceived(const Message& message) = 0; |
28 | 30 |
29 // Called when the channel is connected and we have received the internal | 31 // Called when the channel is connected and we have received the internal |
30 // Hello message from the peer. | 32 // Hello message from the peer. |
31 virtual void OnChannelConnected(int32 peer_pid) {} | 33 virtual void OnChannelConnected(int32 peer_pid) {} |
32 | 34 |
33 // Called when an error is detected that causes the channel to close. | 35 // Called when an error is detected that causes the channel to close. |
34 // This method is not called when a channel is closed normally. | 36 // This method is not called when a channel is closed normally. |
35 virtual void OnChannelError() {} | 37 virtual void OnChannelError() {} |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 // to avoid conflicting with normal | 156 // to avoid conflicting with normal |
155 // message types, which are enumeration | 157 // message types, which are enumeration |
156 // constants starting from 0. | 158 // constants starting from 0. |
157 }; | 159 }; |
158 }; | 160 }; |
159 | 161 |
160 } | 162 } |
161 | 163 |
162 #endif // CHROME_COMMON_IPC_CHANNEL_H__ | 164 #endif // CHROME_COMMON_IPC_CHANNEL_H__ |
163 | 165 |
OLD | NEW |