OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #include "content/browser/android/java_interfaces_impl.h" | 5 #include "content/browser/android/java_interfaces_impl.h" |
6 | 6 |
7 #include <jni.h> | 7 #include <jni.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
11 #include "base/android/context_utils.h" | 11 #include "base/android/context_utils.h" |
12 #include "base/android/jni_android.h" | 12 #include "base/android/jni_android.h" |
13 #include "base/memory/singleton.h" | 13 #include "base/memory/singleton.h" |
14 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
| 15 #include "content/public/browser/render_frame_host.h" |
15 #include "content/public/browser/web_contents.h" | 16 #include "content/public/browser/web_contents.h" |
16 #include "jni/InterfaceRegistrarImpl_jni.h" | 17 #include "jni/InterfaceRegistrarImpl_jni.h" |
17 #include "mojo/public/cpp/system/message_pipe.h" | 18 #include "mojo/public/cpp/system/message_pipe.h" |
18 #include "services/service_manager/public/cpp/interface_provider.h" | 19 #include "services/service_manager/public/cpp/interface_provider.h" |
19 | 20 |
20 namespace content { | 21 namespace content { |
21 | 22 |
22 namespace { | 23 namespace { |
23 | 24 |
24 class JavaInterfaceProviderHolder { | 25 class JavaInterfaceProviderHolder { |
(...skipping 28 matching lines...) Expand all Loading... |
53 | 54 |
54 void BindInterfaceRegistryForWebContents( | 55 void BindInterfaceRegistryForWebContents( |
55 service_manager::mojom::InterfaceProviderRequest request, | 56 service_manager::mojom::InterfaceProviderRequest request, |
56 WebContents* web_contents) { | 57 WebContents* web_contents) { |
57 JNIEnv* env = base::android::AttachCurrentThread(); | 58 JNIEnv* env = base::android::AttachCurrentThread(); |
58 Java_InterfaceRegistrarImpl_createInterfaceRegistryForWebContents( | 59 Java_InterfaceRegistrarImpl_createInterfaceRegistryForWebContents( |
59 env, request.PassMessagePipe().release().value(), | 60 env, request.PassMessagePipe().release().value(), |
60 web_contents->GetJavaWebContents().obj()); | 61 web_contents->GetJavaWebContents().obj()); |
61 } | 62 } |
62 | 63 |
| 64 void BindInterfaceRegistryForRenderFrameHost( |
| 65 service_manager::mojom::InterfaceProviderRequest request, |
| 66 RenderFrameHost* render_frame_host) { |
| 67 JNIEnv* env = base::android::AttachCurrentThread(); |
| 68 Java_InterfaceRegistrarImpl_createInterfaceRegistryForRenderFrameHost( |
| 69 env, request.PassMessagePipe().release().value(), |
| 70 render_frame_host->GetJavaRenderFrameHost().obj()); |
| 71 } |
| 72 |
63 } // namespace content | 73 } // namespace content |
OLD | NEW |