This source file includes following definitions.
- GetJavaBridgeChannel
- GenerateRouteID
- OnControlMessageReceived
#include "content/renderer/java/java_bridge_channel.h"
#include "content/child/child_process.h"
#include "content/child/plugin_messages.h"
#include "content/common/java_bridge_messages.h"
#include "third_party/WebKit/public/web/WebBindings.h"
namespace content {
JavaBridgeChannel* JavaBridgeChannel::GetJavaBridgeChannel(
const IPC::ChannelHandle& channel_handle,
base::MessageLoopProxy* ipc_message_loop) {
return static_cast<JavaBridgeChannel*>(NPChannelBase::GetChannel(
channel_handle,
IPC::Channel::MODE_CLIENT,
ClassFactory,
ipc_message_loop,
true,
ChildProcess::current()->GetShutDownEvent()));
}
JavaBridgeChannel::JavaBridgeChannel()
: peer_owner_id_(new struct _NPP) {
blink::WebBindings::registerObjectOwner(peer_owner_id_.get());
SetDefaultNPObjectOwner(peer_owner_id_.get());
}
JavaBridgeChannel::~JavaBridgeChannel() {
blink::WebBindings::unregisterObjectOwner(peer_owner_id_.get());
}
int JavaBridgeChannel::GenerateRouteID() {
int route_id = MSG_ROUTING_NONE;
Send(new JavaBridgeMsg_GenerateRouteID(&route_id));
DCHECK_NE(MSG_ROUTING_NONE, route_id);
return route_id;
}
bool JavaBridgeChannel::OnControlMessageReceived(const IPC::Message& msg) {
if (msg.type() == PluginMsg_SignalModalDialogEvent::ID ||
msg.type() == PluginMsg_ResetModalDialogEvent::ID) {
return true;
}
return NPChannelBase::OnControlMessageReceived(msg);
}
}