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

Unified Diff: content/public/android/java/src/org/chromium/content/browser/ServiceRegistrar.java

Issue 1892083002: Generic Sensor API : Ambient Light Sensor API. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: re entrancy fix Created 4 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
« no previous file with comments | « content/public/android/BUILD.gn ('k') | content/renderer/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 a9d7f8f9d8cd64e7457dd7b6371028a611217c61..f5ca94639e946a3d429be065adfa554aaf4f046d 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,11 +52,27 @@ 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;
registry.addService(BatteryMonitor.MANAGER,
new BatteryMonitorImplementationFactory(applicationContext));
+ registry.addService(AmbientLightSensor.MANAGER,
+ new AmbientLightSensorImplementationFactory(applicationContext));
}
@CalledByNative
« no previous file with comments | « content/public/android/BUILD.gn ('k') | content/renderer/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698