Fix location of supervised user token file on non-chromeos.
[chromium-blink-merge.git] / ppapi / proxy / plugin_message_filter.h
blob5701a96a09acc52e40d99f8bd4645a05ea8956d2
1 // Copyright (c) 2011 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 PPAPI_PROXY_PLUGIN_MESSAGE_FILTER_H_
6 #define PPAPI_PROXY_PLUGIN_MESSAGE_FILTER_H_
8 #include <set>
10 #include "base/compiler_specific.h"
11 #include "ipc/ipc_channel_proxy.h"
12 #include "ipc/ipc_sender.h"
13 #include "ppapi/c/pp_instance.h"
15 namespace ppapi {
16 namespace proxy {
18 // Listens for messages on the I/O thread of the plugin and handles some of
19 // them to avoid needing to block on the plugin.
21 // There is one instance of this class for each renderer channel (same as for
22 // the PluginDispatchers).
23 class PluginMessageFilter : public IPC::ChannelProxy::MessageFilter,
24 public IPC::Sender {
25 public:
26 // The input is a pointer to a set that will be used to uniquify PP_Instances
27 // across all renderer channels. The same pointer should be passed to each
28 // MessageFilter to ensure uniqueness, and the value should outlive this
29 // class.
30 PluginMessageFilter(std::set<PP_Instance>* seen_instance_ids);
31 virtual ~PluginMessageFilter();
33 // MessageFilter implementation.
34 virtual void OnFilterAdded(IPC::Channel* channel) OVERRIDE;
35 virtual void OnFilterRemoved() OVERRIDE;
36 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
38 // IPC::Sender implementation.
39 virtual bool Send(IPC::Message* msg) OVERRIDE;
41 private:
42 void OnMsgReserveInstanceId(PP_Instance instance, bool* usable);
44 // All instance IDs every queried by any renderer on this plugin. This is
45 // used to make sure that new instance IDs are unique. This is a non-owning
46 // pointer, it will be managed by the later that creates this class.
47 std::set<PP_Instance>* seen_instance_ids_;
49 // The IPC channel to the renderer. May be NULL if we're not currently
50 // attached as a filter.
51 IPC::Channel* channel_;
54 } // namespace proxy
55 } // namespace ppapi
57 #endif // PPAPI_PROXY_PLUGIN_MESSAGE_FILTER_H_