Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(177)

Side by Side Diff: content/renderer/java/java_bridge_channel.cc

Issue 63253002: Rename WebKit namespace to blink (part 3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/java/java_bridge_channel.h" 5 #include "content/renderer/java/java_bridge_channel.h"
6 6
7 #include "content/child/child_process.h" 7 #include "content/child/child_process.h"
8 #include "content/child/plugin_messages.h" 8 #include "content/child/plugin_messages.h"
9 #include "content/common/java_bridge_messages.h" 9 #include "content/common/java_bridge_messages.h"
10 #include "third_party/WebKit/public/web/WebBindings.h" 10 #include "third_party/WebKit/public/web/WebBindings.h"
11 11
12 namespace content { 12 namespace content {
13 13
14 JavaBridgeChannel* JavaBridgeChannel::GetJavaBridgeChannel( 14 JavaBridgeChannel* JavaBridgeChannel::GetJavaBridgeChannel(
15 const IPC::ChannelHandle& channel_handle, 15 const IPC::ChannelHandle& channel_handle,
16 base::MessageLoopProxy* ipc_message_loop) { 16 base::MessageLoopProxy* ipc_message_loop) {
17 return static_cast<JavaBridgeChannel*>(NPChannelBase::GetChannel( 17 return static_cast<JavaBridgeChannel*>(NPChannelBase::GetChannel(
18 channel_handle, 18 channel_handle,
19 IPC::Channel::MODE_CLIENT, 19 IPC::Channel::MODE_CLIENT,
20 ClassFactory, 20 ClassFactory,
21 ipc_message_loop, 21 ipc_message_loop,
22 true, 22 true,
23 ChildProcess::current()->GetShutDownEvent())); 23 ChildProcess::current()->GetShutDownEvent()));
24 } 24 }
25 25
26 JavaBridgeChannel::JavaBridgeChannel() 26 JavaBridgeChannel::JavaBridgeChannel()
27 : peer_owner_id_(new struct _NPP) { 27 : peer_owner_id_(new struct _NPP) {
28 // Register the dummy owner Id for our peer (the Browser process) as an object 28 // Register the dummy owner Id for our peer (the Browser process) as an object
29 // owner, and have all objects received from the peer owned by it. 29 // owner, and have all objects received from the peer owned by it.
30 WebKit::WebBindings::registerObjectOwner(peer_owner_id_.get()); 30 blink::WebBindings::registerObjectOwner(peer_owner_id_.get());
31 SetDefaultNPObjectOwner(peer_owner_id_.get()); 31 SetDefaultNPObjectOwner(peer_owner_id_.get());
32 } 32 }
33 33
34 JavaBridgeChannel::~JavaBridgeChannel() { 34 JavaBridgeChannel::~JavaBridgeChannel() {
35 WebKit::WebBindings::unregisterObjectOwner(peer_owner_id_.get()); 35 blink::WebBindings::unregisterObjectOwner(peer_owner_id_.get());
36 } 36 }
37 37
38 int JavaBridgeChannel::GenerateRouteID() { 38 int JavaBridgeChannel::GenerateRouteID() {
39 // Use a control message as this going to the JavaBridgeChannelHost, not an 39 // Use a control message as this going to the JavaBridgeChannelHost, not an
40 // injected object. 40 // injected object.
41 int route_id = MSG_ROUTING_NONE; 41 int route_id = MSG_ROUTING_NONE;
42 Send(new JavaBridgeMsg_GenerateRouteID(&route_id)); 42 Send(new JavaBridgeMsg_GenerateRouteID(&route_id));
43 // This should never fail, as the JavaBridgeChannelHost should always outlive 43 // This should never fail, as the JavaBridgeChannelHost should always outlive
44 // us. 44 // us.
45 DCHECK_NE(MSG_ROUTING_NONE, route_id); 45 DCHECK_NE(MSG_ROUTING_NONE, route_id);
46 return route_id; 46 return route_id;
47 } 47 }
48 48
49 bool JavaBridgeChannel::OnControlMessageReceived(const IPC::Message& msg) { 49 bool JavaBridgeChannel::OnControlMessageReceived(const IPC::Message& msg) {
50 // We need to intercept these two message types because the default 50 // We need to intercept these two message types because the default
51 // implementation of NPChannelBase::OnControlMessageReceived() is to 51 // implementation of NPChannelBase::OnControlMessageReceived() is to
52 // DCHECK(false). However, we don't need to do anything, as we don't need to 52 // DCHECK(false). However, we don't need to do anything, as we don't need to
53 // worry about the window system hanging when a modal dialog is displayed. 53 // worry about the window system hanging when a modal dialog is displayed.
54 // This is because, unlike in the case of plugins, the host does not need to 54 // This is because, unlike in the case of plugins, the host does not need to
55 // pump the message queue to avoid hangs. 55 // pump the message queue to avoid hangs.
56 if (msg.type() == PluginMsg_SignalModalDialogEvent::ID || 56 if (msg.type() == PluginMsg_SignalModalDialogEvent::ID ||
57 msg.type() == PluginMsg_ResetModalDialogEvent::ID) { 57 msg.type() == PluginMsg_ResetModalDialogEvent::ID) {
58 return true; 58 return true;
59 } 59 }
60 return NPChannelBase::OnControlMessageReceived(msg); 60 return NPChannelBase::OnControlMessageReceived(msg);
61 } 61 }
62 62
63 } // namespace content 63 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/internal_document_state_data.cc ('k') | content/renderer/java/java_bridge_dispatcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698