| 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_BROWSER_MOJO_SERVICE_REGISTRY_ANDROID_H_ |
| 6 #define CONTENT_BROWSER_MOJO_SERVICE_REGISTRY_ANDROID_H_ | 6 #define CONTENT_BROWSER_MOJO_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 | 13 |
| 14 namespace content { | 14 namespace content { |
| 15 | 15 |
| 16 class ServiceRegistry; | 16 class ServiceRegistry; |
| 17 | 17 |
| 18 // Android wrapper over a ServiceRegistry, allowing the browser services in | 18 // Android wrapper over a ServiceRegistry, allowing the browser services in |
| 19 // Java to register with ServiceRegistry.java (and abstracting away the JNI | 19 // Java to register with ServiceRegistry.java (and abstracting away the JNI |
| 20 // calls). | 20 // calls). |
| 21 class CONTENT_EXPORT ServiceRegistryAndroid { | 21 class CONTENT_EXPORT ServiceRegistryAndroid { |
| 22 public: | 22 public: |
| 23 static bool Register(JNIEnv* env); | 23 static bool Register(JNIEnv* env); |
| 24 | 24 |
| 25 explicit ServiceRegistryAndroid(ServiceRegistry* service_registry); | 25 explicit ServiceRegistryAndroid(ServiceRegistry* service_registry); |
| 26 virtual ~ServiceRegistryAndroid(); | 26 virtual ~ServiceRegistryAndroid(); |
| 27 | 27 |
| 28 // Methods called from Java. | 28 // Methods called from Java. |
| 29 void AddService(JNIEnv* env, | 29 void AddService( |
| 30 jobject j_service_registry, | 30 JNIEnv* env, |
| 31 jobject j_manager, | 31 const base::android::JavaParamRef<jobject>& j_service_registry, |
| 32 jobject j_factory, | 32 const base::android::JavaParamRef<jobject>& j_manager, |
| 33 jstring j_name); | 33 const base::android::JavaParamRef<jobject>& j_factory, |
| 34 void RemoveService(JNIEnv* env, jobject j_service_registry, jstring j_name); | 34 const base::android::JavaParamRef<jstring>& j_name); |
| 35 void ConnectToRemoteService(JNIEnv* env, | 35 void RemoveService( |
| 36 jobject j_service_registry, | 36 JNIEnv* env, |
| 37 jstring j_name, | 37 const base::android::JavaParamRef<jobject>& j_service_registry, |
| 38 jint handle); | 38 const base::android::JavaParamRef<jstring>& j_name); |
| 39 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); |
| 39 | 44 |
| 40 const base::android::ScopedJavaGlobalRef<jobject>& GetObj() { return obj_; } | 45 const base::android::ScopedJavaGlobalRef<jobject>& GetObj() { return obj_; } |
| 41 | 46 |
| 42 private: | 47 private: |
| 43 ServiceRegistry* service_registry_; | 48 ServiceRegistry* service_registry_; |
| 44 base::android::ScopedJavaGlobalRef<jobject> obj_; | 49 base::android::ScopedJavaGlobalRef<jobject> obj_; |
| 45 | 50 |
| 46 DISALLOW_COPY_AND_ASSIGN(ServiceRegistryAndroid); | 51 DISALLOW_COPY_AND_ASSIGN(ServiceRegistryAndroid); |
| 47 }; | 52 }; |
| 48 | 53 |
| 49 } // namespace content | 54 } // namespace content |
| 50 | 55 |
| 51 #endif // CONTENT_BROWSER_MOJO_SERVICE_REGISTRY_ANDROID_H_ | 56 #endif // CONTENT_BROWSER_MOJO_SERVICE_REGISTRY_ANDROID_H_ |
| OLD | NEW |