| Index: ppapi/host/ppapi_host.h
|
| diff --git a/ppapi/host/ppapi_host.h b/ppapi/host/ppapi_host.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..b5e95df39a699d415ee2825dd239b90677133eb2
|
| --- /dev/null
|
| +++ b/ppapi/host/ppapi_host.h
|
| @@ -0,0 +1,75 @@
|
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef PPAPI_HOST_PPAPI_HOST_H_
|
| +#define PPAPI_HOST_PPAPI_HOST_H_
|
| +
|
| +#include <map>
|
| +
|
| +#include "base/memory/linked_ptr.h"
|
| +#include "ipc/ipc_channel.h"
|
| +#include "ipc/ipc_message.h"
|
| +#include "ppapi/c/pp_instance.h"
|
| +#include "ppapi/c/pp_resource.h"
|
| +#include "ppapi/host/ppapi_host_export.h"
|
| +
|
| +namespace ppapi {
|
| +
|
| +namespace proxy {
|
| +class ResourceMessageCallParams;
|
| +class ResourceMessageReplyParams;
|
| +}
|
| +
|
| +namespace host {
|
| +
|
| +class HostFactory;
|
| +class ResourceHost;
|
| +
|
| +class PPAPI_HOST_EXPORT PpapiHost
|
| + : public IPC::Message::Sender,
|
| + public IPC::Channel::Listener {
|
| + public:
|
| + PpapiHost(IPC::Message::Sender* sender,
|
| + HostFactory* host_factory);
|
| + ~PpapiHost();
|
| +
|
| + // Sender implementation
|
| + virtual bool Send(IPC::Message* msg) OVERRIDE;
|
| +
|
| + // Listener implementation
|
| + virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;
|
| +
|
| + void SendReply(const proxy::ResourceMessageReplyParams& params,
|
| + const IPC::Message& msg);
|
| +
|
| + private:
|
| + struct InstanceData;
|
| +
|
| + // Message handlers.
|
| + void OnHostMsgResourceCall(const proxy::ResourceMessageCallParams& params,
|
| + const IPC::Message& nested_msg);
|
| + void OnHostMsgResourceCreated(const proxy::ResourceMessageCallParams& param,
|
| + PP_Instance instance,
|
| + const IPC::Message& nested_msg);
|
| + void OnHostMsgResourceDestroyed(PP_Resource resource);
|
| +
|
| + // Returns null if the resource doesn't exist.
|
| + host::ResourceHost* GetResourceHost(PP_Resource resource);
|
| +
|
| + // Non-owning pointer.
|
| + IPC::Message::Sender* sender_;
|
| +
|
| + // Non-owning pointer.
|
| + HostFactory* host_factory_;
|
| +
|
| + typedef std::map<PP_Resource, linked_ptr<ResourceHost> > ResourceMap;
|
| + ResourceMap resources_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(PpapiHost);
|
| +};
|
| +
|
| +} // namespace host
|
| +} // namespace ppapi
|
| +
|
| +#endif // PPAPI_HOST_PPAPIE_HOST_H_
|
|
|