OLD | NEW |
| (Empty) |
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_BROWSER_RENDERER_HOST_JAVA_JAVA_BRIDGE_CHANNEL_HOST_H_ | |
6 #define CONTENT_BROWSER_RENDERER_HOST_JAVA_JAVA_BRIDGE_CHANNEL_HOST_H_ | |
7 | |
8 #include "content/child/npapi/np_channel_base.h" | |
9 | |
10 namespace content { | |
11 | |
12 class JavaBridgeChannelHost : public NPChannelBase { | |
13 public: | |
14 static JavaBridgeChannelHost* GetJavaBridgeChannelHost( | |
15 int renderer_id, | |
16 base::MessageLoopProxy* ipc_message_loop); | |
17 | |
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(); | |
22 | |
23 // NPChannelBase implementation: | |
24 virtual int GenerateRouteID() OVERRIDE; | |
25 | |
26 // NPChannelBase override: | |
27 virtual bool Init(base::MessageLoopProxy* ipc_message_loop, | |
28 bool create_pipe_now, | |
29 base::WaitableEvent* shutdown_event) OVERRIDE; | |
30 | |
31 protected: | |
32 // NPChannelBase override: | |
33 virtual bool OnControlMessageReceived(const IPC::Message& message) OVERRIDE; | |
34 | |
35 private: | |
36 JavaBridgeChannelHost() {} | |
37 friend class base::RefCountedThreadSafe<JavaBridgeChannelHost>; | |
38 virtual ~JavaBridgeChannelHost(); | |
39 | |
40 static NPChannelBase* ClassFactory() { | |
41 return new JavaBridgeChannelHost(); | |
42 } | |
43 | |
44 // Message handlers | |
45 void OnGenerateRouteID(int* route_id); | |
46 | |
47 DISALLOW_COPY_AND_ASSIGN(JavaBridgeChannelHost); | |
48 }; | |
49 | |
50 } // namespace content | |
51 | |
52 #endif // CONTENT_BROWSER_RENDERER_HOST_JAVA_JAVA_BRIDGE_CHANNEL_HOST_H_ | |
OLD | NEW |