Reland: Plugin Placeholders: Refactor for platforms that don't support plugins
[chromium-blink-merge.git] / ipc / message_filter_router.h
blob183b8ebc8a90141a75b45adc764fc85425f54883
1 // Copyright 2014 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_MESSAGE_FILTER_ROUTER_H_
6 #define IPC_MESSAGE_FILTER_ROUTER_H_
8 #include <vector>
10 #include "ipc/ipc_message_start.h"
12 namespace IPC {
14 class Message;
15 class MessageFilter;
17 class MessageFilterRouter {
18 public:
19 typedef std::vector<MessageFilter*> MessageFilters;
21 MessageFilterRouter();
22 ~MessageFilterRouter();
24 void AddFilter(MessageFilter* filter);
25 void RemoveFilter(MessageFilter* filter);
26 bool TryFilters(const Message& message);
27 void Clear();
29 private:
30 // List of global and selective filters; a given filter will exist in either
31 // |message_global_filters_| OR |message_class_filters_|, but not both.
32 // Note that |message_global_filters_| will be given first offering of any
33 // given message. It's the filter implementer and installer's
34 // responsibility to ensure that a filter is either global or selective to
35 // ensure proper message filtering order.
36 MessageFilters global_filters_;
37 MessageFilters message_class_filters_[LastIPCMsgStart];
40 } // namespace IPC
42 #endif // IPC_MESSAGE_FILTER_ROUTER_H_