Index: services/shape_detection/android/java/src/org/chromium/shape_detection/InterfaceRegistrar.java |
diff --git a/services/shape_detection/android/java/src/org/chromium/shape_detection/InterfaceRegistrar.java b/services/shape_detection/android/java/src/org/chromium/shape_detection/InterfaceRegistrar.java |
new file mode 100644 |
index 0000000000000000000000000000000000000000..6a62aa574d8cb4464d20407b083da3ad37a64cd8 |
--- /dev/null |
+++ b/services/shape_detection/android/java/src/org/chromium/shape_detection/InterfaceRegistrar.java |
@@ -0,0 +1,29 @@ |
+// Copyright 2017 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+package org.chromium.shape_detection; |
+ |
+import android.content.Context; |
+ |
+import org.chromium.base.annotations.CalledByNative; |
+import org.chromium.base.annotations.JNINamespace; |
+import org.chromium.mojo.system.impl.CoreImpl; |
+import org.chromium.services.service_manager.InterfaceRegistry; |
+import org.chromium.shape_detection.mojom.BarcodeDetection; |
+import org.chromium.shape_detection.mojom.TextDetection; |
+ |
+@JNINamespace("shape_detection") |
+class InterfaceRegistrar { |
+ @CalledByNative |
+ static void createInterfaceRegistryForContext(int nativeHandle, Context applicationContext) { |
+ // Note: The bindings code manages the lifetime of this object, so it |
+ // is not necessary to hold on to a reference to it explicitly. |
+ InterfaceRegistry registry = InterfaceRegistry.create( |
+ CoreImpl.getInstance().acquireNativeHandle(nativeHandle).toMessagePipeHandle()); |
+ registry.addInterface( |
+ BarcodeDetection.MANAGER, new BarcodeDetectionImpl.Factory(applicationContext)); |
+ registry.addInterface( |
+ TextDetection.MANAGER, new TextDetectionImpl.Factory(applicationContext)); |
+ } |
+} |