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/service_registry_android_impl.h" | 5 #include "content/browser/android/service_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" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 j_scoped_service_registry.Reset(env, j_service_registry); | 80 j_scoped_service_registry.Reset(env, j_service_registry); |
81 | 81 |
82 ScopedJavaGlobalRef<jobject> j_scoped_manager; | 82 ScopedJavaGlobalRef<jobject> j_scoped_manager; |
83 j_scoped_manager.Reset(env, j_manager); | 83 j_scoped_manager.Reset(env, j_manager); |
84 | 84 |
85 ScopedJavaGlobalRef<jobject> j_scoped_factory; | 85 ScopedJavaGlobalRef<jobject> j_scoped_factory; |
86 j_scoped_factory.Reset(env, j_factory); | 86 j_scoped_factory.Reset(env, j_factory); |
87 | 87 |
88 service_registry_->AddService( | 88 service_registry_->AddService( |
89 name, base::Bind(&CreateImplAndAttach, j_scoped_service_registry, | 89 name, base::Bind(&CreateImplAndAttach, j_scoped_service_registry, |
90 j_scoped_manager, j_scoped_factory)); | 90 j_scoped_manager, j_scoped_factory), |
| 91 nullptr); |
91 } | 92 } |
92 | 93 |
93 void ServiceRegistryAndroidImpl::RemoveService( | 94 void ServiceRegistryAndroidImpl::RemoveService( |
94 JNIEnv* env, | 95 JNIEnv* env, |
95 const JavaParamRef<jobject>& j_service_registry, | 96 const JavaParamRef<jobject>& j_service_registry, |
96 const JavaParamRef<jstring>& j_name) { | 97 const JavaParamRef<jstring>& j_name) { |
97 std::string name(ConvertJavaStringToUTF8(env, j_name)); | 98 std::string name(ConvertJavaStringToUTF8(env, j_name)); |
98 service_registry_->RemoveService(name); | 99 service_registry_->RemoveService(name); |
99 } | 100 } |
100 | 101 |
101 void ServiceRegistryAndroidImpl::ConnectToRemoteService( | 102 void ServiceRegistryAndroidImpl::ConnectToRemoteService( |
102 JNIEnv* env, | 103 JNIEnv* env, |
103 const JavaParamRef<jobject>& j_service_registry, | 104 const JavaParamRef<jobject>& j_service_registry, |
104 const JavaParamRef<jstring>& j_name, | 105 const JavaParamRef<jstring>& j_name, |
105 jint j_handle) { | 106 jint j_handle) { |
106 std::string name(ConvertJavaStringToUTF8(env, j_name)); | 107 std::string name(ConvertJavaStringToUTF8(env, j_name)); |
107 mojo::ScopedMessagePipeHandle handle((mojo::MessagePipeHandle(j_handle))); | 108 mojo::ScopedMessagePipeHandle handle((mojo::MessagePipeHandle(j_handle))); |
108 service_registry_->ConnectToRemoteService(name, std::move(handle)); | 109 service_registry_->ConnectToRemoteService(name, std::move(handle)); |
109 } | 110 } |
110 | 111 |
111 } // namespace content | 112 } // namespace content |
OLD | NEW |