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

Unified Diff: services/sensors/org/chromium/mojo/sensors/Sensors.java

Issue 1093033002: Add sensors application to mojo (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Remove extra constructor Created 5 years, 8 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 | « services/sensors/org/chromium/mojo/sensors/SensorServiceImpl.java ('k') | sky/apk/demo/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/sensors/org/chromium/mojo/sensors/Sensors.java
diff --git a/services/sensors/org/chromium/mojo/sensors/Sensors.java b/services/sensors/org/chromium/mojo/sensors/Sensors.java
new file mode 100644
index 0000000000000000000000000000000000000000..345326a7d96c7611c4960164a570b4b71ca5fda0
--- /dev/null
+++ b/services/sensors/org/chromium/mojo/sensors/Sensors.java
@@ -0,0 +1,64 @@
+// Copyright 2015 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.mojo.sensors;
+
+import android.content.Context;
+
+import org.chromium.mojo.application.ApplicationConnection;
+import org.chromium.mojo.application.ApplicationDelegate;
+import org.chromium.mojo.application.ApplicationRunner;
+import org.chromium.mojo.application.ServiceFactoryBinder;
+import org.chromium.mojo.system.Core;
+import org.chromium.mojo.system.MessagePipeHandle;
+import org.chromium.mojom.mojo.Shell;
+import org.chromium.mojom.sensors.SensorService;
+
+/**
+ * Android service application implementing the SensorService interface.
+ */
+public class Sensors implements ApplicationDelegate {
+ private Context mContext;
+
+ public Sensors(Context context) {
+ mContext = context;
+ }
+
+ /**
+ * @see ApplicationDelegate#initialize(Shell, String[], String)
+ */
+ @Override
+ public void initialize(Shell shell, String[] args, String url) {}
+
+ /**
+ * @see ApplicationDelegate#configureIncomingConnection(String, ApplicationConnection)
+ */
+ @Override
+ public boolean configureIncomingConnection(
+ final String requestorUrl, ApplicationConnection connection) {
+ connection.addService(new ServiceFactoryBinder<SensorService>() {
+ @Override
+ public void bindNewInstanceToMessagePipe(MessagePipeHandle pipe) {
+ new SensorServiceImpl(mContext, pipe);
+ }
+
+ @Override
+ public String getInterfaceName() {
+ return SensorService.MANAGER.getName();
+ }
+ });
+ return true;
+ }
+
+ /**
+ * @see ApplicationDelegate#quit()
+ */
+ @Override
+ public void quit() {}
+
+ public static void mojoMain(
+ Context context, Core core, MessagePipeHandle applicationRequestHandle) {
+ ApplicationRunner.run(new Sensors(context), core, applicationRequestHandle);
+ }
+}
« no previous file with comments | « services/sensors/org/chromium/mojo/sensors/SensorServiceImpl.java ('k') | sky/apk/demo/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698