Record error when CreateDir fails.
[chromium-blink-merge.git] / ipc / ipc_listener.h
blob9189eec7d1100146feb82b435b79b1a28d888311
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef IPC_IPC_LISTENER_H_
6 #define IPC_IPC_LISTENER_H_
8 #include "base/basictypes.h"
9 #include "build/build_config.h"
10 #include "ipc/ipc_export.h"
12 namespace IPC {
14 class Message;
16 // Implemented by consumers of a Channel to receive messages.
17 class IPC_EXPORT Listener {
18 public:
19 // Called when a message is received. Returns true iff the message was
20 // handled.
21 virtual bool OnMessageReceived(const Message& message) = 0;
23 // Called when the channel is connected and we have received the internal
24 // Hello message from the peer.
25 virtual void OnChannelConnected(int32 peer_pid) {}
27 // Called when an error is detected that causes the channel to close.
28 // This method is not called when a channel is closed normally.
29 virtual void OnChannelError() {}
31 #if defined(OS_POSIX)
32 // Called on the server side when a channel that listens for connections
33 // denies an attempt to connect.
34 virtual void OnChannelDenied() {}
36 // Called on the server side when a channel that listens for connections
37 // has an error that causes the listening channel to close.
38 virtual void OnChannelListenError() {}
39 #endif // OS_POSIX
41 protected:
42 virtual ~Listener() {}
45 } // namespace IPC
47 #endif // IPC_IPC_LISTENER_H_