Upstream version 9.37.197.0
[platform/framework/web/crosswalk.git] / src / content / renderer / java / java_bridge_channel.h
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.
4
5 #ifndef CONTENT_RENDERER_JAVA_JAVA_BRIDGE_CHANNEL_H_
6 #define CONTENT_RENDERER_JAVA_JAVA_BRIDGE_CHANNEL_H_
7
8 #include "base/memory/scoped_ptr.h"
9 #include "content/child/npapi/np_channel_base.h"
10 #include "ipc/ipc_channel_handle.h"
11
12 namespace content {
13
14 class JavaBridgeChannel : public content::NPChannelBase {
15  public:
16   // The return value may be null.
17   static JavaBridgeChannel* GetJavaBridgeChannel(
18       const IPC::ChannelHandle& channel_handle,
19       base::MessageLoopProxy* ipc_message_loop);
20
21   // NPChannelBase implementation:
22   virtual int GenerateRouteID() OVERRIDE;
23
24   // NPChannelBase override:
25   virtual bool OnControlMessageReceived(const IPC::Message& msg) OVERRIDE;
26
27  private:
28   JavaBridgeChannel();
29   // This class is ref-counted.
30   virtual ~JavaBridgeChannel();
31
32   static NPChannelBase* ClassFactory() { return new JavaBridgeChannel(); }
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
38   DISALLOW_COPY_AND_ASSIGN(JavaBridgeChannel);
39 };
40
41 }  // namespace content
42
43 #endif  // CONTENT_RENDERER_JAVA_JAVA_BRIDGE_CHANNEL_H_