Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef CONTENT_BROWSER_MOJO_SERVICE_REGISTRY_ANDROID_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_ANDROID_SERVICE_REGISTRY_ANDROID_H_ |
| 6 #define CONTENT_BROWSER_MOJO_SERVICE_REGISTRY_ANDROID_H_ | 6 #define CONTENT_PUBLIC_BROWSER_ANDROID_SERVICE_REGISTRY_ANDROID_H_ |
| 7 | 7 |
| 8 #include <jni.h> | 8 #include <jni.h> |
| 9 | 9 |
| 10 #include "base/android/scoped_java_ref.h" | 10 #include "base/android/scoped_java_ref.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "content/common/content_export.h" | 12 #include "content/common/content_export.h" |
| 13 #include "content/public/common/service_registry.h" | |
| 13 | 14 |
| 14 namespace content { | 15 namespace content { |
| 15 | 16 |
| 16 class ServiceRegistryImpl; | 17 // Android wrapper over ServiceRegistry, allowing the browser services in Java |
| 17 | 18 // to register with ServiceRegistry.java (and abstracting away the JNI calls). |
| 18 // Android wrapper over ServiceRegistryImpl, allowing the browser services in | 19 class CONTENT_EXPORT ServiceRegistryAndroid : private ServiceRegistry::Data { |
|
ncarter (slow)
2016/04/05 18:22:40
content/public contains only interfaces & structs,
| |
| 19 // Java to register with ServiceRegistry.java (and abstracting away the JNI | |
| 20 // calls). | |
| 21 class CONTENT_EXPORT ServiceRegistryAndroid { | |
| 22 public: | 20 public: |
| 23 static bool Register(JNIEnv* env); | 21 static bool Register(JNIEnv* env); |
| 22 static ServiceRegistryAndroid* From(ServiceRegistry* registry); | |
| 24 | 23 |
| 25 explicit ServiceRegistryAndroid(ServiceRegistryImpl* service_registry); | 24 ~ServiceRegistryAndroid() override; |
| 26 virtual ~ServiceRegistryAndroid(); | |
| 27 | 25 |
| 28 // Methods called from Java. | 26 // Methods called from Java. |
| 29 void AddService( | 27 void AddService( |
| 30 JNIEnv* env, | 28 JNIEnv* env, |
| 31 const base::android::JavaParamRef<jobject>& j_service_registry, | 29 const base::android::JavaParamRef<jobject>& j_service_registry, |
| 32 const base::android::JavaParamRef<jobject>& j_manager, | 30 const base::android::JavaParamRef<jobject>& j_manager, |
| 33 const base::android::JavaParamRef<jobject>& j_factory, | 31 const base::android::JavaParamRef<jobject>& j_factory, |
| 34 const base::android::JavaParamRef<jstring>& j_name); | 32 const base::android::JavaParamRef<jstring>& j_name); |
| 35 void RemoveService( | 33 void RemoveService( |
| 36 JNIEnv* env, | 34 JNIEnv* env, |
| 37 const base::android::JavaParamRef<jobject>& j_service_registry, | 35 const base::android::JavaParamRef<jobject>& j_service_registry, |
| 38 const base::android::JavaParamRef<jstring>& j_name); | 36 const base::android::JavaParamRef<jstring>& j_name); |
| 39 void ConnectToRemoteService( | 37 void ConnectToRemoteService( |
| 40 JNIEnv* env, | 38 JNIEnv* env, |
| 41 const base::android::JavaParamRef<jobject>& j_service_registry, | 39 const base::android::JavaParamRef<jobject>& j_service_registry, |
| 42 const base::android::JavaParamRef<jstring>& j_name, | 40 const base::android::JavaParamRef<jstring>& j_name, |
| 43 jint handle); | 41 jint handle); |
| 44 | 42 |
| 45 const base::android::ScopedJavaGlobalRef<jobject>& GetObj() { return obj_; } | 43 const base::android::ScopedJavaGlobalRef<jobject>& GetObj() { return obj_; } |
| 46 | 44 |
| 47 private: | 45 private: |
| 48 ServiceRegistryImpl* service_registry_; | 46 explicit ServiceRegistryAndroid(ServiceRegistry* service_registry); |
| 47 | |
| 48 ServiceRegistry* service_registry_; | |
| 49 base::android::ScopedJavaGlobalRef<jobject> obj_; | 49 base::android::ScopedJavaGlobalRef<jobject> obj_; |
| 50 | 50 |
| 51 DISALLOW_COPY_AND_ASSIGN(ServiceRegistryAndroid); | 51 DISALLOW_COPY_AND_ASSIGN(ServiceRegistryAndroid); |
| 52 }; | 52 }; |
| 53 | 53 |
| 54 } // namespace content | 54 } // namespace content |
| 55 | 55 |
| 56 #endif // CONTENT_BROWSER_MOJO_SERVICE_REGISTRY_ANDROID_H_ | 56 #endif // CONTENT_PUBLIC_BROWSER_ANDROID_SERVICE_REGISTRY_ANDROID_H_ |
| OLD | NEW |