This source file includes following definitions.
- GetLinkAtPosition
- Transform
- ppp_pdf_
- GetProxyInterface
- OnMessageReceived
- OnPluginMsgRotate
#include "ppapi/proxy/ppp_pdf_proxy.h"
#include "ppapi/proxy/host_dispatcher.h"
#include "ppapi/proxy/ppapi_messages.h"
#include "ppapi/shared_impl/proxy_lock.h"
namespace ppapi {
namespace proxy {
namespace {
#if !defined(OS_NACL)
PP_Var GetLinkAtPosition(PP_Instance instance, PP_Point point) {
return PP_MakeUndefined();
}
void Transform(PP_Instance instance, PP_PrivatePageTransformType type) {
bool clockwise = type == PP_PRIVATEPAGETRANSFORMTYPE_ROTATE_90_CW;
HostDispatcher::GetForInstance(instance)->Send(
new PpapiMsg_PPPPdf_Rotate(API_ID_PPP_PDF, instance, clockwise));
}
const PPP_Pdf ppp_pdf_interface = {
&GetLinkAtPosition,
&Transform,
};
#else
const PPP_Pdf ppp_pdf_interface = {};
#endif
}
PPP_Pdf_Proxy::PPP_Pdf_Proxy(Dispatcher* dispatcher)
: InterfaceProxy(dispatcher),
ppp_pdf_(NULL) {
if (dispatcher->IsPlugin()) {
ppp_pdf_ = static_cast<const PPP_Pdf*>(
dispatcher->local_get_interface()(PPP_PDF_INTERFACE));
}
}
PPP_Pdf_Proxy::~PPP_Pdf_Proxy() {
}
const PPP_Pdf* PPP_Pdf_Proxy::GetProxyInterface() {
return &ppp_pdf_interface;
}
bool PPP_Pdf_Proxy::OnMessageReceived(const IPC::Message& msg) {
if (!dispatcher()->IsPlugin())
return false;
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(PPP_Pdf_Proxy, msg)
IPC_MESSAGE_HANDLER(PpapiMsg_PPPPdf_Rotate, OnPluginMsgRotate)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return handled;
}
void PPP_Pdf_Proxy::OnPluginMsgRotate(PP_Instance instance, bool clockwise) {
PP_PrivatePageTransformType type = clockwise ?
PP_PRIVATEPAGETRANSFORMTYPE_ROTATE_90_CW :
PP_PRIVATEPAGETRANSFORMTYPE_ROTATE_90_CCW;
if (ppp_pdf_)
CallWhileUnlocked(ppp_pdf_->Transform, instance, type);
}
}
}