Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(335)

Unified Diff: services/shape_detection/android/java/src/org/chromium/shape_detection/InterfaceRegistrar.java

Issue 2855203003: Shape Detection: move {BarcodeDetectionImpl,TextDetectionImpl}.java to //services/shape_detection (Closed)
Patch Set: Make |java_interface_provider_| a std::unique_ptr<> Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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));
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698