Port Android relocation packer to chromium build
[chromium-blink-merge.git] / ppapi / proxy / interface_proxy.h
blob099d58b5fe7f7bce21183a9b7f35e050e3e48263
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_INTERFACE_PROXY_H_
6 #define PPAPI_PROXY_INTERFACE_PROXY_H_
8 #include "base/basictypes.h"
9 #include "ipc/ipc_listener.h"
10 #include "ipc/ipc_sender.h"
11 #include "ppapi/c/pp_completion_callback.h"
12 #include "ppapi/c/pp_resource.h"
13 #include "ppapi/c/pp_var.h"
14 #include "ppapi/shared_impl/api_id.h"
16 namespace ppapi {
17 namespace proxy {
19 class Dispatcher;
21 class InterfaceProxy : public IPC::Listener, public IPC::Sender {
22 public:
23 // Factory function type for interfaces. Ownership of the returned pointer
24 // is transferred to the caller.
25 typedef InterfaceProxy* (*Factory)(Dispatcher* dispatcher);
27 virtual ~InterfaceProxy();
29 Dispatcher* dispatcher() const { return dispatcher_; }
31 // IPC::Sender implementation.
32 virtual bool Send(IPC::Message* msg);
34 // Sub-classes must implement IPC::Listener which contains this:
35 //virtual bool OnMessageReceived(const IPC::Message& msg);
37 protected:
38 // Creates the given interface associated with the given dispatcher. The
39 // dispatcher manages our lifetime.
40 InterfaceProxy(Dispatcher* dispatcher);
42 private:
43 Dispatcher* dispatcher_;
46 } // namespace proxy
47 } // namespace ppapi
49 #endif // PPAPI_PROXY_INTERFACE_PROXY_H_