Disable ContentSettingBubbleModelTest.RPHAllow which is flaky.
[chromium-blink-merge.git] / content / renderer / java / java_bridge_channel.cc
blob6663d552c346415fabf59855bdfc798b230d2eea
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "content/renderer/java/java_bridge_channel.h"
7 #include "content/common/child_process.h"
8 #include "content/common/java_bridge_messages.h"
9 #include "content/common/plugin_messages.h"
11 namespace content {
13 JavaBridgeChannel* JavaBridgeChannel::GetJavaBridgeChannel(
14 const IPC::ChannelHandle& channel_handle,
15 base::MessageLoopProxy* ipc_message_loop) {
16 return static_cast<JavaBridgeChannel*>(NPChannelBase::GetChannel(
17 channel_handle,
18 IPC::Channel::MODE_CLIENT,
19 ClassFactory,
20 ipc_message_loop,
21 true,
22 ChildProcess::current()->GetShutDownEvent()));
25 JavaBridgeChannel::JavaBridgeChannel() {
28 JavaBridgeChannel::~JavaBridgeChannel() {
31 int JavaBridgeChannel::GenerateRouteID() {
32 // Use a control message as this going to the JavaBridgeChannelHost, not an
33 // injected object.
34 int route_id = MSG_ROUTING_NONE;
35 Send(new JavaBridgeMsg_GenerateRouteID(&route_id));
36 // This should never fail, as the JavaBridgeChannelHost should always outlive
37 // us.
38 DCHECK_NE(MSG_ROUTING_NONE, route_id);
39 return route_id;
42 bool JavaBridgeChannel::OnControlMessageReceived(const IPC::Message& msg) {
43 // We need to intercept these two message types because the default
44 // implementation of NPChannelBase::OnControlMessageReceived() is to
45 // DCHECK(false). However, we don't need to do anything, as we don't need to
46 // worry about the window system hanging when a modal dialog is displayed.
47 // This is because, unlike in the case of plugins, the host does not need to
48 // pump the message queue to avoid hangs.
49 if (msg.type() == PluginMsg_SignalModalDialogEvent::ID ||
50 msg.type() == PluginMsg_ResetModalDialogEvent::ID) {
51 return true;
53 return NPChannelBase::OnControlMessageReceived(msg);
56 } // namespace content