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 #ifndef CONTENT_BROWSER_RENDERER_HOST_JAVA_JAVA_BRIDGE_CHANNEL_HOST_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_JAVA_JAVA_BRIDGE_CHANNEL_HOST_H_
8 #include "content/child/npapi/np_channel_base.h"
12 class JavaBridgeChannelHost
: public NPChannelBase
{
14 static JavaBridgeChannelHost
* GetJavaBridgeChannelHost(
16 base::MessageLoopProxy
* ipc_message_loop
);
18 // A threadsafe function to generate a unique route ID. Used by the
19 // JavaBridgeDispatcherHost on the UI thread and this class on the Java
20 // Bridge's background thread.
21 static int ThreadsafeGenerateRouteID();
23 // NPChannelBase implementation:
24 virtual int GenerateRouteID() OVERRIDE
;
26 // NPChannelBase override:
27 virtual bool Init(base::MessageLoopProxy
* ipc_message_loop
,
29 base::WaitableEvent
* shutdown_event
) OVERRIDE
;
32 // NPChannelBase override:
33 virtual bool OnControlMessageReceived(const IPC::Message
& message
) OVERRIDE
;
36 JavaBridgeChannelHost() {}
37 friend class base::RefCountedThreadSafe
<JavaBridgeChannelHost
>;
38 virtual ~JavaBridgeChannelHost();
40 static NPChannelBase
* ClassFactory() {
41 return new JavaBridgeChannelHost();
45 void OnGenerateRouteID(int* route_id
);
47 DISALLOW_COPY_AND_ASSIGN(JavaBridgeChannelHost
);
50 } // namespace content
52 #endif // CONTENT_BROWSER_RENDERER_HOST_JAVA_JAVA_BRIDGE_CHANNEL_HOST_H_