#ifndef PPAPI_PROXY_EXTENSIONS_COMMON_RESOURCE_H_
#define PPAPI_PROXY_EXTENSIONS_COMMON_RESOURCE_H_
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "ppapi/proxy/connection.h"
#include "ppapi/proxy/plugin_resource.h"
#include "ppapi/thunk/extensions_common_api.h"
namespace base {
class ListValue;
}
namespace ppapi {
namespace proxy {
class ResourceMessageReplyParams;
class ExtensionsCommonResource : public PluginResource,
public thunk::ExtensionsCommon_API {
public:
ExtensionsCommonResource(Connection connection, PP_Instance instance);
virtual ~ExtensionsCommonResource();
virtual thunk::ExtensionsCommon_API* AsExtensionsCommon_API() OVERRIDE;
virtual int32_t CallRenderer(
const std::string& request_name,
const std::vector<PP_Var>& input_args,
const std::vector<PP_Var*>& output_args,
scoped_refptr<TrackedCallback> callback) OVERRIDE;
virtual void PostRenderer(const std::string& request_name,
const std::vector<PP_Var>& args) OVERRIDE;
virtual int32_t CallBrowser(const std::string& request_name,
const std::vector<PP_Var>& input_args,
const std::vector<PP_Var*>& output_args,
scoped_refptr<TrackedCallback> callback) OVERRIDE;
virtual void PostBrowser(const std::string& request_name,
const std::vector<PP_Var>& args) OVERRIDE;
private:
int32_t CommonCall(Destination dest,
const std::string& request_name,
const std::vector<PP_Var>& input_args,
const std::vector<PP_Var*>& output_args,
scoped_refptr<TrackedCallback> callback);
void CommonPost(Destination dest,
const std::string& request_name,
const std::vector<PP_Var>& args);
void OnPluginMsgCallReply(const std::vector<PP_Var*>& output_args,
scoped_refptr<TrackedCallback> callback,
const ResourceMessageReplyParams& params,
const base::ListValue& output);
DISALLOW_COPY_AND_ASSIGN(ExtensionsCommonResource);
};
}
}
#endif