OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_IPC_CHANNEL_H_ | 5 #ifndef IPC_IPC_CHANNEL_H_ |
6 #define IPC_IPC_CHANNEL_H_ | 6 #define IPC_IPC_CHANNEL_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "ipc/ipc_channel_handle.h" | 10 #include "ipc/ipc_channel_handle.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 class Channel : public Message::Sender { | 32 class Channel : public Message::Sender { |
33 // Security tests need access to the pipe handle. | 33 // Security tests need access to the pipe handle. |
34 friend class ChannelTest; | 34 friend class ChannelTest; |
35 | 35 |
36 public: | 36 public: |
37 // Implemented by consumers of a Channel to receive messages. | 37 // Implemented by consumers of a Channel to receive messages. |
38 class Listener { | 38 class Listener { |
39 public: | 39 public: |
40 virtual ~Listener() {} | 40 virtual ~Listener() {} |
41 | 41 |
42 // Called when a message is received. | 42 // Called when a message is received. Returns true iff the message was |
43 virtual void OnMessageReceived(const Message& message) = 0; | 43 // handled. |
| 44 virtual bool OnMessageReceived(const Message& message) = 0; |
44 | 45 |
45 // Called when the channel is connected and we have received the internal | 46 // Called when the channel is connected and we have received the internal |
46 // Hello message from the peer. | 47 // Hello message from the peer. |
47 virtual void OnChannelConnected(int32 peer_pid) {} | 48 virtual void OnChannelConnected(int32 peer_pid) {} |
48 | 49 |
49 // Called when an error is detected that causes the channel to close. | 50 // Called when an error is detected that causes the channel to close. |
50 // This method is not called when a channel is closed normally. | 51 // This method is not called when a channel is closed normally. |
51 virtual void OnChannelError() {} | 52 virtual void OnChannelError() {} |
52 | 53 |
53 #if defined(OS_POSIX) | 54 #if defined(OS_POSIX) |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 HELLO_MESSAGE_TYPE = kuint16max // Maximum value of message type (uint16), | 168 HELLO_MESSAGE_TYPE = kuint16max // Maximum value of message type (uint16), |
168 // to avoid conflicting with normal | 169 // to avoid conflicting with normal |
169 // message types, which are enumeration | 170 // message types, which are enumeration |
170 // constants starting from 0. | 171 // constants starting from 0. |
171 }; | 172 }; |
172 }; | 173 }; |
173 | 174 |
174 } // namespace IPC | 175 } // namespace IPC |
175 | 176 |
176 #endif // IPC_IPC_CHANNEL_H_ | 177 #endif // IPC_IPC_CHANNEL_H_ |
OLD | NEW |