| 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_INTERFACE_REGISTRY_ANDROID_H_ | |
| 6 #define CONTENT_PUBLIC_BROWSER_ANDROID_INTERFACE_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 shell { | |
| 15 class InterfaceRegistry; | |
| 16 } | |
| 17 | |
| 18 namespace content { | |
| 19 | |
| 20 // Android wrapper around shell::InterfaceRegistry, allowing interfaces | |
| 21 // implemented in Java to bind requests from other environments. | |
| 22 // Abstracts away all the JNI calls. | |
| 23 class CONTENT_EXPORT InterfaceRegistryAndroid { | |
| 24 public: | |
| 25 virtual ~InterfaceRegistryAndroid() {} | |
| 26 | |
| 27 // The |interface_registry| parameter must outlive |InterfaceRegistryAndroid|. | |
| 28 static std::unique_ptr<InterfaceRegistryAndroid> Create( | |
| 29 shell::InterfaceRegistry* interface_registry); | |
| 30 | |
| 31 // Called from Java. | |
| 32 virtual void AddInterface( | |
| 33 JNIEnv* env, | |
| 34 const base::android::JavaParamRef<jobject>& j_interface_registry, | |
| 35 const base::android::JavaParamRef<jobject>& j_manager, | |
| 36 const base::android::JavaParamRef<jobject>& j_factory, | |
| 37 const base::android::JavaParamRef<jstring>& j_name) = 0; | |
| 38 virtual void RemoveInterface( | |
| 39 JNIEnv* env, | |
| 40 const base::android::JavaParamRef<jobject>& j_interface_registry, | |
| 41 const base::android::JavaParamRef<jstring>& j_name) = 0; | |
| 42 | |
| 43 // Accessor to the Java object. | |
| 44 virtual const base::android::ScopedJavaGlobalRef<jobject>& GetObj() = 0; | |
| 45 }; | |
| 46 | |
| 47 } // namespace content | |
| 48 | |
| 49 #endif // CONTENT_PUBLIC_BROWSER_ANDROID_INTERFACE_REGISTRY_ANDROID_H_ | |
| OLD | NEW |