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

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

Issue 641703002: Rewrite the Android implementation of BatteryMonitor directly in Java. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@battery-status-api-to-mojo
Patch Set: Address Ben's comments, update GN build, polish. Created 6 years 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: 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());
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698