Index: services/device/android/java/src/org/chromium/services/device/InterfaceRegistrar.java |
diff --git a/services/device/android/java/src/org/chromium/services/device/InterfaceRegistrar.java b/services/device/android/java/src/org/chromium/services/device/InterfaceRegistrar.java |
new file mode 100644 |
index 0000000000000000000000000000000000000000..13c072ce0e3f5d007e6d5eb779166bb420b9815e |
--- /dev/null |
+++ b/services/device/android/java/src/org/chromium/services/device/InterfaceRegistrar.java |
@@ -0,0 +1,27 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
Sam McNally
2017/01/25 05:53:06
2017
blundell
2017/01/25 15:00:34
Done.
|
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+package org.chromium.device_service; |
+ |
+import android.content.Context; |
+ |
+import org.chromium.base.annotations.CalledByNative; |
+import org.chromium.base.annotations.JNINamespace; |
+import org.chromium.device.BatteryMonitor; |
+import org.chromium.device.battery.BatteryMonitorFactory; |
+import org.chromium.mojo.system.impl.CoreImpl; |
+import org.chromium.services.service_manager.InterfaceRegistry; |
+ |
+@JNINamespace("device") |
+class InterfaceRegistrar { |
+ @CalledByNative |
+ static InterfaceRegistry createInterfaceRegistryForContext( |
Sam McNally
2017/01/25 05:53:06
Return void.
blundell
2017/01/25 15:00:34
Done.
|
+ int nativeHandle, Context applicationContext) { |
+ InterfaceRegistry registry = InterfaceRegistry.create( |
+ CoreImpl.getInstance().acquireNativeHandle(nativeHandle).toMessagePipeHandle()); |
+ registry.addInterface( |
+ BatteryMonitor.MANAGER, new BatteryMonitorFactory(applicationContext)); |
blundell
2017/01/24 11:35:43
I originally thought I would generalize this code
|
+ return registry; |
+ } |
+} |