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/interface_registry_android_impl.h" | 5 #include "content/browser/android/interface_registry_android_impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
10 #include "base/android/jni_string.h" | 10 #include "base/android/jni_string.h" |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/memory/ptr_util.h" | 12 #include "base/memory/ptr_util.h" |
13 #include "content/public/browser/browser_thread.h" | 13 #include "content/public/browser/browser_thread.h" |
14 #include "jni/InterfaceRegistry_jni.h" | 14 #include "jni/InterfaceRegistry_jni.h" |
15 #include "mojo/public/cpp/system/message_pipe.h" | 15 #include "mojo/public/cpp/system/message_pipe.h" |
16 #include "services/shell/public/cpp/interface_provider.h" | 16 #include "services/shell/public/cpp/interface_provider.h" |
17 #include "services/shell/public/cpp/interface_registry.h" | 17 #include "services/shell/public/cpp/interface_registry.h" |
18 | 18 |
19 using base::android::AttachCurrentThread; | 19 using base::android::AttachCurrentThread; |
20 using base::android::ConvertJavaStringToUTF8; | 20 using base::android::ConvertJavaStringToUTF8; |
| 21 using base::android::JavaParamRef; |
21 using base::android::ScopedJavaGlobalRef; | 22 using base::android::ScopedJavaGlobalRef; |
22 | 23 |
23 namespace content { | 24 namespace content { |
24 | 25 |
25 namespace { | 26 namespace { |
26 | 27 |
27 // Callback passed to the wrapped InterfaceRegistry upon AddInterface(). The | 28 // Callback passed to the wrapped InterfaceRegistry upon AddInterface(). The |
28 // InterfaceRegistry will call it to create a registered Java impl. | 29 // InterfaceRegistry will call it to create a registered Java impl. |
29 void CreateImplAndAttach( | 30 void CreateImplAndAttach( |
30 const ScopedJavaGlobalRef<jobject>& j_scoped_interface_registry, | 31 const ScopedJavaGlobalRef<jobject>& j_scoped_interface_registry, |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 | 101 |
101 void InterfaceRegistryAndroidImpl::RemoveInterface( | 102 void InterfaceRegistryAndroidImpl::RemoveInterface( |
102 JNIEnv* env, | 103 JNIEnv* env, |
103 const JavaParamRef<jobject>& j_interface_registry, | 104 const JavaParamRef<jobject>& j_interface_registry, |
104 const JavaParamRef<jstring>& j_name) { | 105 const JavaParamRef<jstring>& j_name) { |
105 std::string name(ConvertJavaStringToUTF8(env, j_name)); | 106 std::string name(ConvertJavaStringToUTF8(env, j_name)); |
106 interface_registry_->RemoveInterface(name); | 107 interface_registry_->RemoveInterface(name); |
107 } | 108 } |
108 | 109 |
109 } // namespace content | 110 } // namespace content |
OLD | NEW |