Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1277)

Side by Side Diff: chrome/common/message_router.cc

Issue 1625015: Refactor ChildProcess and related classes to create a framework outside of br... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 10 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/common/message_router.h ('k') | chrome/common/plugin_messages_internal.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/common/message_router.h"
6
7 void MessageRouter::OnControlMessageReceived(const IPC::Message& msg) {
8 NOTREACHED() <<
9 "should override in subclass if you care about control messages";
10 }
11
12 bool MessageRouter::Send(IPC::Message* msg) {
13 NOTREACHED() <<
14 "should override in subclass if you care about sending messages";
15 return false;
16 }
17
18 void MessageRouter::AddRoute(int32 routing_id,
19 IPC::Channel::Listener* listener) {
20 routes_.AddWithID(listener, routing_id);
21 }
22
23 void MessageRouter::RemoveRoute(int32 routing_id) {
24 routes_.Remove(routing_id);
25 }
26
27 void MessageRouter::OnMessageReceived(const IPC::Message& msg) {
28 if (msg.routing_id() == MSG_ROUTING_CONTROL) {
29 OnControlMessageReceived(msg);
30 } else {
31 RouteMessage(msg);
32 }
33 }
34
35 bool MessageRouter::RouteMessage(const IPC::Message& msg) {
36 IPC::Channel::Listener* listener = ResolveRoute(msg.routing_id());
37 if (!listener)
38 return false;
39
40 listener->OnMessageReceived(msg);
41 return true;
42 }
43
44 IPC::Channel::Listener* MessageRouter::ResolveRoute(int32 routing_id) {
45 return routes_.Lookup(routing_id);
46 }
OLDNEW
« no previous file with comments | « chrome/common/message_router.h ('k') | chrome/common/plugin_messages_internal.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698