Chromium Code Reviews| Index: content/public/android/java/src/org/chromium/content/browser/ServiceRegistrar.java |
| diff --git a/content/public/android/java/src/org/chromium/content/browser/ServiceRegistrar.java b/content/public/android/java/src/org/chromium/content/browser/ServiceRegistrar.java |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..c8509b923a6580c28fd299b1b20e4dac6f9a9e31 |
| --- /dev/null |
| +++ b/content/public/android/java/src/org/chromium/content/browser/ServiceRegistrar.java |
| @@ -0,0 +1,31 @@ |
| +// Copyright 2014 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.content.browser; |
| + |
| +import org.chromium.base.CalledByNative; |
| +import org.chromium.base.JNINamespace; |
| +import org.chromium.content.browser.ServiceRegistry.ImplementationFactory; |
| +import org.chromium.device.battery.BatteryMonitorFactory; |
| +import org.chromium.mojom.device.BatteryMonitor; |
| + |
| +/** |
| + * Registers mojo services exposed by the browser in the given registry. |
| + */ |
| +@JNINamespace("content") |
| +class ServiceRegistrar { |
| + |
| + private static class BatteryMonitorImplementationFactory extends BatteryMonitorFactory |
|
qsr
2014/12/12 15:31:57
Hum... You need this class because this is in cont
ppi
2014/12/12 16:02:16
Yes. Commented on that and switched to composition
|
| + implements ImplementationFactory<BatteryMonitor> { |
| + @Override |
| + public BatteryMonitor createImpl() { |
| + return createMonitor(); |
| + } |
| + } |
| + |
| + @CalledByNative |
| + static void registerProcessHostServices(ServiceRegistry registry) { |
| + registry.addService(BatteryMonitor.MANAGER, new BatteryMonitorImplementationFactory()); |
| + } |
| +} |