OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_BROWSER_RENDERER_HOST_JAVA_JAVA_BRIDGE_CHANNEL_HOST_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_JAVA_JAVA_BRIDGE_CHANNEL_HOST_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_JAVA_JAVA_BRIDGE_CHANNEL_HOST_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_JAVA_JAVA_BRIDGE_CHANNEL_HOST_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "content/common/np_channel_base.h" | 9 #include "content/common/np_channel_base.h" |
10 | 10 |
11 class JavaBridgeChannelHost : public NPChannelBase { | 11 class JavaBridgeChannelHost : public NPChannelBase { |
12 public: | 12 public: |
13 static JavaBridgeChannelHost* GetJavaBridgeChannelHost( | 13 static JavaBridgeChannelHost* GetJavaBridgeChannelHost( |
14 int renderer_id, | 14 int renderer_id, |
15 base::MessageLoopProxy* ipc_message_loop); | 15 base::MessageLoopProxy* ipc_message_loop); |
16 | 16 |
17 // A threadsafe function to generate a unique route ID. Used by the | 17 // A threadsafe function to generate a unique route ID. Used by the |
18 // JavaBridgeDispatcherHost on the UI thread and this class on the WEBKIT | 18 // JavaBridgeDispatcherHost on the UI thread and this class on the JAVA_BRIDGE |
19 // thread. | 19 // thread. |
20 static int ThreadsafeGenerateRouteID(); | 20 static int ThreadsafeGenerateRouteID(); |
21 | 21 |
22 // NPChannelBase implementation: | 22 // NPChannelBase implementation: |
23 virtual int GenerateRouteID() OVERRIDE; | 23 virtual int GenerateRouteID() OVERRIDE; |
24 | 24 |
25 // NPChannelBase override: | 25 // NPChannelBase override: |
26 virtual bool Init(base::MessageLoopProxy* ipc_message_loop, | 26 virtual bool Init(base::MessageLoopProxy* ipc_message_loop, |
27 bool create_pipe_now, | 27 bool create_pipe_now, |
28 base::WaitableEvent* shutdown_event) OVERRIDE; | 28 base::WaitableEvent* shutdown_event) OVERRIDE; |
29 virtual bool Send(IPC::Message* msg) OVERRIDE; | 29 virtual bool Send(IPC::Message* msg) OVERRIDE; |
30 | 30 |
31 private: | 31 private: |
32 JavaBridgeChannelHost() {} | 32 JavaBridgeChannelHost() {} |
33 friend class base::RefCountedThreadSafe<JavaBridgeChannelHost>; | 33 friend class base::RefCountedThreadSafe<JavaBridgeChannelHost>; |
34 virtual ~JavaBridgeChannelHost() {} | 34 virtual ~JavaBridgeChannelHost() {} |
35 | 35 |
36 static NPChannelBase* ClassFactory() { | 36 static NPChannelBase* ClassFactory() { |
37 return new JavaBridgeChannelHost(); | 37 return new JavaBridgeChannelHost(); |
38 } | 38 } |
39 | 39 |
40 // Message handlers | 40 // Message handlers |
41 void OnGenerateRouteID(int* route_id); | 41 void OnGenerateRouteID(int* route_id); |
42 | 42 |
43 DISALLOW_COPY_AND_ASSIGN(JavaBridgeChannelHost); | 43 DISALLOW_COPY_AND_ASSIGN(JavaBridgeChannelHost); |
44 }; | 44 }; |
45 | 45 |
46 #endif // CONTENT_BROWSER_RENDERER_HOST_JAVA_JAVA_BRIDGE_CHANNEL_HOST_H_ | 46 #endif // CONTENT_BROWSER_RENDERER_HOST_JAVA_JAVA_BRIDGE_CHANNEL_HOST_H_ |
OLD | NEW |