OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_PUBLIC_BROWSER_ANDROID_SERVICE_REGISTRY_ANDROID_H_ |
| 6 #define CONTENT_PUBLIC_BROWSER_ANDROID_SERVICE_REGISTRY_ANDROID_H_ |
| 7 |
| 8 #include <jni.h> |
| 9 #include <memory> |
| 10 |
| 11 #include "base/android/scoped_java_ref.h" |
| 12 #include "content/common/content_export.h" |
| 13 |
| 14 namespace content { |
| 15 |
| 16 class ServiceRegistry; |
| 17 |
| 18 // Android wrapper over ServiceRegistry, allowing the browser services in Java |
| 19 // to register with ServiceRegistry.java (and abstracting away the JNI calls). |
| 20 class CONTENT_EXPORT ServiceRegistryAndroid { |
| 21 public: |
| 22 virtual ~ServiceRegistryAndroid() {} |
| 23 |
| 24 // The |registry| parameter must outlive |ServiceRegistryAndroid|. |
| 25 static std::unique_ptr<ServiceRegistryAndroid> Create( |
| 26 ServiceRegistry* registry); |
| 27 |
| 28 // Called from Java. |
| 29 virtual void AddService( |
| 30 JNIEnv* env, |
| 31 const base::android::JavaParamRef<jobject>& j_service_registry, |
| 32 const base::android::JavaParamRef<jobject>& j_manager, |
| 33 const base::android::JavaParamRef<jobject>& j_factory, |
| 34 const base::android::JavaParamRef<jstring>& j_name) = 0; |
| 35 virtual void RemoveService( |
| 36 JNIEnv* env, |
| 37 const base::android::JavaParamRef<jobject>& j_service_registry, |
| 38 const base::android::JavaParamRef<jstring>& j_name) = 0; |
| 39 virtual void ConnectToRemoteService( |
| 40 JNIEnv* env, |
| 41 const base::android::JavaParamRef<jobject>& j_service_registry, |
| 42 const base::android::JavaParamRef<jstring>& j_name, |
| 43 jint handle) = 0; |
| 44 |
| 45 // Accessor to the Java object. |
| 46 virtual const base::android::ScopedJavaGlobalRef<jobject>& GetObj() = 0; |
| 47 }; |
| 48 |
| 49 } // namespace content |
| 50 |
| 51 #endif // CONTENT_PUBLIC_BROWSER_ANDROID_SERVICE_REGISTRY_ANDROID_H_ |
OLD | NEW |