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 |
index e8c279eba71fe6d02ad850868bec051be71ac3e7..e370a265b87307c05c20e01b0e71e75e727f767c 100644 |
--- a/content/public/android/java/src/org/chromium/content/browser/ServiceRegistrar.java |
+++ b/content/public/android/java/src/org/chromium/content/browser/ServiceRegistrar.java |
@@ -10,10 +10,13 @@ import org.chromium.base.annotations.CalledByNative; |
import org.chromium.base.annotations.JNINamespace; |
import org.chromium.content.browser.ServiceRegistry.ImplementationFactory; |
import org.chromium.device.battery.BatteryMonitorFactory; |
+import org.chromium.device.sensor.AmbientLightSensorImpl; |
import org.chromium.device.vibration.VibrationManagerImpl; |
+import org.chromium.mojom.device.AmbientLightSensor; |
import org.chromium.mojom.device.BatteryMonitor; |
import org.chromium.mojom.device.VibrationManager; |
+ |
/** |
* Registers mojo services exposed by the browser in the given registry. |
*/ |
@@ -49,6 +52,20 @@ class ServiceRegistrar { |
} |
} |
+ private static class AmbientLightSensorImplementationFactory |
+ implements ImplementationFactory<AmbientLightSensor> { |
+ private final Context mApplicationContext; |
+ |
+ AmbientLightSensorImplementationFactory(Context applicationContext) { |
+ mApplicationContext = applicationContext; |
+ } |
+ |
+ @Override |
+ public AmbientLightSensor createImpl() { |
+ return new AmbientLightSensorImpl(mApplicationContext); |
+ } |
+ } |
+ |
@CalledByNative |
static void registerProcessHostServices(ServiceRegistry registry, Context applicationContext) { |
assert applicationContext != null; |
@@ -56,6 +73,8 @@ class ServiceRegistrar { |
new BatteryMonitorImplementationFactory(applicationContext)); |
registry.addService(VibrationManager.MANAGER, |
new VibrationManagerImplementationFactory(applicationContext)); |
+ registry.addService(AmbientLightSensor.MANAGER, |
+ new AmbientLightSensorImplementationFactory(applicationContext)); |
} |
@CalledByNative |