OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 CONTENT_COMMON_MESSAGE_ROUTER_H_ | 5 #ifndef CONTENT_COMMON_MESSAGE_ROUTER_H_ |
6 #define CONTENT_COMMON_MESSAGE_ROUTER_H_ | 6 #define CONTENT_COMMON_MESSAGE_ROUTER_H_ |
7 | 7 |
8 #include "base/id_map.h" | 8 #include "base/id_map.h" |
9 #include "ipc/ipc_listener.h" | 9 #include "ipc/ipc_listener.h" |
10 #include "ipc/ipc_sender.h" | 10 #include "ipc/ipc_sender.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 | 31 |
32 class MessageRouter : public IPC::Listener, public IPC::Sender { | 32 class MessageRouter : public IPC::Listener, public IPC::Sender { |
33 public: | 33 public: |
34 MessageRouter(); | 34 MessageRouter(); |
35 virtual ~MessageRouter(); | 35 virtual ~MessageRouter(); |
36 | 36 |
37 // Implemented by subclasses to handle control messages | 37 // Implemented by subclasses to handle control messages |
38 virtual bool OnControlMessageReceived(const IPC::Message& msg); | 38 virtual bool OnControlMessageReceived(const IPC::Message& msg); |
39 | 39 |
40 // IPC::Listener implementation: | 40 // IPC::Listener implementation: |
41 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; | 41 virtual bool OnMessageReceived(const IPC::Message& msg) override; |
42 | 42 |
43 // Like OnMessageReceived, except it only handles routed messages. Returns | 43 // Like OnMessageReceived, except it only handles routed messages. Returns |
44 // true if the message was dispatched, or false if there was no listener for | 44 // true if the message was dispatched, or false if there was no listener for |
45 // that route id. | 45 // that route id. |
46 virtual bool RouteMessage(const IPC::Message& msg); | 46 virtual bool RouteMessage(const IPC::Message& msg); |
47 | 47 |
48 // IPC::Sender implementation: | 48 // IPC::Sender implementation: |
49 virtual bool Send(IPC::Message* msg) OVERRIDE; | 49 virtual bool Send(IPC::Message* msg) override; |
50 | 50 |
51 // Called to add a listener for a particular message routing ID. | 51 // Called to add a listener for a particular message routing ID. |
52 // Returns true if succeeded. | 52 // Returns true if succeeded. |
53 bool AddRoute(int32 routing_id, IPC::Listener* listener); | 53 bool AddRoute(int32 routing_id, IPC::Listener* listener); |
54 | 54 |
55 // Called to remove a listener for a particular message routing ID. | 55 // Called to remove a listener for a particular message routing ID. |
56 void RemoveRoute(int32 routing_id); | 56 void RemoveRoute(int32 routing_id); |
57 | 57 |
58 private: | 58 private: |
59 // A list of all listeners with assigned routing IDs. | 59 // A list of all listeners with assigned routing IDs. |
60 IDMap<IPC::Listener> routes_; | 60 IDMap<IPC::Listener> routes_; |
61 | 61 |
62 DISALLOW_COPY_AND_ASSIGN(MessageRouter); | 62 DISALLOW_COPY_AND_ASSIGN(MessageRouter); |
63 }; | 63 }; |
64 | 64 |
65 } // namespace content | 65 } // namespace content |
66 | 66 |
67 #endif // CONTENT_COMMON_MESSAGE_ROUTER_H_ | 67 #endif // CONTENT_COMMON_MESSAGE_ROUTER_H_ |
OLD | NEW |