{{+bindTo:partials.standard_nacl_api}}
<h1>pp::MessageHandler Class Reference</h1>
<div id="doxygen-ref">
{{- dummy div to appease doxygen -}}
<div>
<!-- Generated by Doxygen 1.7.6.1 -->
</div>
<!--header-->
<div class="contents">
<!-- doxytag: class="pp::MessageHandler" -->
<p><a href="classpp_1_1_message_handler-members.html">List of all members.</a></p>
<h2>
Public Member Functions</h2><table class="memberdecls">
<tr><td class="memItemLeft" align="right" valign="top">virtual </td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_message_handler.html#a7dca8d4b899382782aaa163fb2654b83">~MessageHandler</a> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_message_handler.html#a1040f95297420067a69000612bbe6c06">HandleMessage</a> (<a class="el" href="classpp_1_1_instance_handle.html">pp::InstanceHandle</a> instance, const <a class="el" href="classpp_1_1_var.html">Var</a> &message_data)=0</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual <a class="el" href="classpp_1_1_var.html">pp::Var</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_message_handler.html#a37212226dba86f1bf900016116fabdfe">HandleBlockingMessage</a> (<a class="el" href="classpp_1_1_instance_handle.html">pp::InstanceHandle</a> instance, const <a class="el" href="classpp_1_1_var.html">Var</a> &message_data)=0</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_message_handler.html#ac19edb6318796c337865e39d764ed322">WasUnregistered</a> (<a class="el" href="classpp_1_1_instance_handle.html">pp::InstanceHandle</a> instance)=0</td></tr>
</table>
<hr /><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p><code><a class="el" href="classpp_1_1_message_handler.html" title="MessageHandler is an abstract base class that the plugin may implement if it wants to receive message...">MessageHandler</a></code> is an abstract base class that the plugin may implement if it wants to receive messages from JavaScript on a background thread when JavaScript invokes postMessage() or postMessageAndAwaitResponse(). </p>
<p>See <a class="el" href="classpp_1_1_instance.html#a5b5b1a66eda2d0e6884de8f7e25e2346" title="Dev-Channel Only.">pp::Instance::RegisterMessageHandler()</a> for usage. </p>
</div><hr /><h2>Constructor & Destructor Documentation</h2>
<a class="anchor" id="a7dca8d4b899382782aaa163fb2654b83"></a><!-- doxytag: member="pp::MessageHandler::~MessageHandler" ref="a7dca8d4b899382782aaa163fb2654b83" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">virtual <a class="el" href="classpp_1_1_message_handler.html#a7dca8d4b899382782aaa163fb2654b83">pp::MessageHandler::~MessageHandler</a> </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td><code> [inline, virtual]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
</div>
</div>
<hr /><h2>Member Function Documentation</h2>
<a class="anchor" id="a37212226dba86f1bf900016116fabdfe"></a><!-- doxytag: member="pp::MessageHandler::HandleBlockingMessage" ref="a37212226dba86f1bf900016116fabdfe" args="(pp::InstanceHandle instance, const Var &message_data)=0" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">virtual <a class="el" href="classpp_1_1_var.html">pp::Var</a> <a class="el" href="classpp_1_1_message_handler.html#a37212226dba86f1bf900016116fabdfe">pp::MessageHandler::HandleBlockingMessage</a> </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classpp_1_1_instance_handle.html">pp::InstanceHandle</a> </td>
<td class="paramname"><em>instance</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const <a class="el" href="classpp_1_1_var.html">Var</a> & </td>
<td class="paramname"><em>message_data</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td><code> [pure virtual]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Invoked as a result of JavaScript invoking postMessageAndAwaitResponse() on the plugin's DOM element. </p>
<p>NOTE: JavaScript execution is blocked during the duration of this call. Hence, the plugin should respond as quickly as possible. For this reason, blocking completion callbacks are disallowed while handling a blocking message.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">instance</td><td>An <code><a class="el" href="classpp_1_1_instance_handle.html" title="An instance handle identifies an instance in a constructor for a resource.">InstanceHandle</a></code> identifying one instance of a module. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">message_data</td><td>A copy of the parameter that JavaScript provided to postMessage(). </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>Returns a <a class="el" href="classpp_1_1_var.html" title="A generic type used for passing data types between the module and the page.">pp::Var</a> that is then copied to a JavaScript object which is returned as the result of JavaScript's call of postMessageAndAwaitResponse(). </dd></dl>
</div>
</div>
<a class="anchor" id="a1040f95297420067a69000612bbe6c06"></a><!-- doxytag: member="pp::MessageHandler::HandleMessage" ref="a1040f95297420067a69000612bbe6c06" args="(pp::InstanceHandle instance, const Var &message_data)=0" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">virtual void <a class="el" href="classpp_1_1_message_handler.html#a1040f95297420067a69000612bbe6c06">pp::MessageHandler::HandleMessage</a> </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classpp_1_1_instance_handle.html">pp::InstanceHandle</a> </td>
<td class="paramname"><em>instance</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const <a class="el" href="classpp_1_1_var.html">Var</a> & </td>
<td class="paramname"><em>message_data</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td><code> [pure virtual]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Invoked as a result of JavaScript invoking postMessage() on the plugin's DOM element. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">instance</td><td>An <code><a class="el" href="classpp_1_1_instance_handle.html" title="An instance handle identifies an instance in a constructor for a resource.">InstanceHandle</a></code> identifying one instance of a module. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">message_data</td><td>A copy of the parameter that JavaScript provided to postMessage(). </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="ac19edb6318796c337865e39d764ed322"></a><!-- doxytag: member="pp::MessageHandler::WasUnregistered" ref="ac19edb6318796c337865e39d764ed322" args="(pp::InstanceHandle instance)=0" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">virtual void <a class="el" href="classpp_1_1_message_handler.html#ac19edb6318796c337865e39d764ed322">pp::MessageHandler::WasUnregistered</a> </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classpp_1_1_instance_handle.html">pp::InstanceHandle</a> </td>
<td class="paramname"><em>instance</em></td><td>)</td>
<td><code> [pure virtual]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Invoked when this <a class="el" href="classpp_1_1_message_handler.html" title="MessageHandler is an abstract base class that the plugin may implement if it wants to receive message...">MessageHandler</a> is no longer needed. </p>
<p>After this, no more calls will be made to this object.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">instance</td><td>An <code><a class="el" href="classpp_1_1_instance_handle.html" title="An instance handle identifies an instance in a constructor for a resource.">InstanceHandle</a></code> identifying one instance of a module. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<hr />The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="message__handler_8h.html">message_handler.h</a></li>
</ul>
</div><!-- contents -->
</div>
{{/partials.standard_nacl_api}}