OLD | NEW |
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 #ifndef CONTENT_RENDERER_JAVA_JAVA_BRIDGE_CHANNEL_H_ | 5 #ifndef CONTENT_RENDERER_JAVA_JAVA_BRIDGE_CHANNEL_H_ |
6 #define CONTENT_RENDERER_JAVA_JAVA_BRIDGE_CHANNEL_H_ | 6 #define CONTENT_RENDERER_JAVA_JAVA_BRIDGE_CHANNEL_H_ |
7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" |
8 #include "content/child/np_channel_base.h" | 9 #include "content/child/np_channel_base.h" |
9 #include "ipc/ipc_channel_handle.h" | 10 #include "ipc/ipc_channel_handle.h" |
10 | 11 |
11 namespace content { | 12 namespace content { |
12 | 13 |
13 class JavaBridgeChannel : public content::NPChannelBase { | 14 class JavaBridgeChannel : public content::NPChannelBase { |
14 public: | 15 public: |
15 // The return value may be null. | 16 // The return value may be null. |
16 static JavaBridgeChannel* GetJavaBridgeChannel( | 17 static JavaBridgeChannel* GetJavaBridgeChannel( |
17 const IPC::ChannelHandle& channel_handle, | 18 const IPC::ChannelHandle& channel_handle, |
18 base::MessageLoopProxy* ipc_message_loop); | 19 base::MessageLoopProxy* ipc_message_loop); |
19 | 20 |
20 // NPChannelBase implementation: | 21 // NPChannelBase implementation: |
21 virtual int GenerateRouteID() OVERRIDE; | 22 virtual int GenerateRouteID() OVERRIDE; |
22 | 23 |
23 // NPChannelBase override: | 24 // NPChannelBase override: |
24 virtual bool OnControlMessageReceived(const IPC::Message& msg) OVERRIDE; | 25 virtual bool OnControlMessageReceived(const IPC::Message& msg) OVERRIDE; |
25 | 26 |
26 private: | 27 private: |
27 JavaBridgeChannel(); | 28 JavaBridgeChannel(); |
28 // This class is ref-counted. | 29 // This class is ref-counted. |
29 virtual ~JavaBridgeChannel(); | 30 virtual ~JavaBridgeChannel(); |
30 | 31 |
31 static NPChannelBase* ClassFactory() { return new JavaBridgeChannel(); } | 32 static NPChannelBase* ClassFactory() { return new JavaBridgeChannel(); } |
32 | 33 |
| 34 // Dummy NPObject owner Id used to track objects owned by the JavaBridge |
| 35 // peer in the Browser process. |
| 36 scoped_ptr<struct _NPP> peer_owner_id_; |
| 37 |
33 DISALLOW_COPY_AND_ASSIGN(JavaBridgeChannel); | 38 DISALLOW_COPY_AND_ASSIGN(JavaBridgeChannel); |
34 }; | 39 }; |
35 | 40 |
36 } // namespace content | 41 } // namespace content |
37 | 42 |
38 #endif // CONTENT_RENDERER_JAVA_JAVA_BRIDGE_CHANNEL_H_ | 43 #endif // CONTENT_RENDERER_JAVA_JAVA_BRIDGE_CHANNEL_H_ |
OLD | NEW |