blob: 099d58b5fe7f7bce21183a9b7f35e050e3e48263 [file] [log] [blame]
[email protected]84396dbc2011-04-14 06:33:421// Copyright (c) 2011 The Chromium Authors. All rights reserved.
[email protected]c2932f5e2010-11-03 03:22:332// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef PPAPI_PROXY_INTERFACE_PROXY_H_
6#define PPAPI_PROXY_INTERFACE_PROXY_H_
7
8#include "base/basictypes.h"
[email protected]c47317e2012-06-20 22:35:319#include "ipc/ipc_listener.h"
10#include "ipc/ipc_sender.h"
[email protected]c2932f5e2010-11-03 03:22:3311#include "ppapi/c/pp_completion_callback.h"
12#include "ppapi/c/pp_resource.h"
13#include "ppapi/c/pp_var.h"
[email protected]ac4b54d2011-10-20 23:09:2814#include "ppapi/shared_impl/api_id.h"
[email protected]c2932f5e2010-11-03 03:22:3315
[email protected]4d2efd22011-08-18 21:58:0216namespace ppapi {
[email protected]c2932f5e2010-11-03 03:22:3317namespace proxy {
18
19class Dispatcher;
20
[email protected]c47317e2012-06-20 22:35:3121class InterfaceProxy : public IPC::Listener, public IPC::Sender {
[email protected]c2932f5e2010-11-03 03:22:3322 public:
[email protected]465faa22011-02-08 16:31:4623 // Factory function type for interfaces. Ownership of the returned pointer
24 // is transferred to the caller.
[email protected]5c966022011-09-13 18:09:3725 typedef InterfaceProxy* (*Factory)(Dispatcher* dispatcher);
[email protected]465faa22011-02-08 16:31:4626
[email protected]c2932f5e2010-11-03 03:22:3327 virtual ~InterfaceProxy();
28
[email protected]f56279c2011-02-02 18:12:3129 Dispatcher* dispatcher() const { return dispatcher_; }
[email protected]c2932f5e2010-11-03 03:22:3330
[email protected]c47317e2012-06-20 22:35:3131 // IPC::Sender implementation.
[email protected]c2932f5e2010-11-03 03:22:3332 virtual bool Send(IPC::Message* msg);
33
[email protected]c47317e2012-06-20 22:35:3134 // Sub-classes must implement IPC::Listener which contains this:
[email protected]a95986a82010-12-24 06:19:2835 //virtual bool OnMessageReceived(const IPC::Message& msg);
[email protected]c2932f5e2010-11-03 03:22:3336
37 protected:
[email protected]465faa22011-02-08 16:31:4638 // Creates the given interface associated with the given dispatcher. The
39 // dispatcher manages our lifetime.
[email protected]5c966022011-09-13 18:09:3740 InterfaceProxy(Dispatcher* dispatcher);
[email protected]465faa22011-02-08 16:31:4641
[email protected]c2932f5e2010-11-03 03:22:3342 private:
43 Dispatcher* dispatcher_;
[email protected]c2932f5e2010-11-03 03:22:3344};
45
[email protected]c2932f5e2010-11-03 03:22:3346} // namespace proxy
[email protected]4d2efd22011-08-18 21:58:0247} // namespace ppapi
[email protected]c2932f5e2010-11-03 03:22:3348
49#endif // PPAPI_PROXY_INTERFACE_PROXY_H_
50