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

Unified Diff: services/camera/src/org/chromium/services/camera/CameraApp.java

Issue 1375733004: -Add a mojo service to get video frames from the camera through an android service (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: remove stale files. Created 5 years, 3 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
Index: services/camera/src/org/chromium/services/camera/CameraApp.java
diff --git a/services/camera/src/org/chromium/services/camera/CameraApp.java b/services/camera/src/org/chromium/services/camera/CameraApp.java
new file mode 100644
index 0000000000000000000000000000000000000000..6f359a30f5c98871d44e7588cc1821814c73cafe
--- /dev/null
+++ b/services/camera/src/org/chromium/services/camera/CameraApp.java
@@ -0,0 +1,58 @@
+// 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.services.camera;
+
+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.bindings.InterfaceRequest;
+import org.chromium.mojo.system.Core;
+import org.chromium.mojo.system.MessagePipeHandle;
+import org.chromium.mojom.mojo.CameraVideoService;
+import org.chromium.mojom.mojo.Shell;
+
+class CameraApp implements ApplicationDelegate {
+ private final Context mCtx;
+ private final Core mCore;
+ private Shell mShell;
+
+ public CameraApp(Context context, Core core) {
+ mCtx = context;
+ mCore = core;
+ }
+
+ @Override
+ public void initialize(Shell shell, String[] args, String url) {
+ mShell = shell;
+ }
+
+ @Override
+ public boolean configureIncomingConnection(final ApplicationConnection connection) {
+ connection.addService(new ServiceFactoryBinder<CameraVideoService>() {
+ @Override
+ public void bind(InterfaceRequest<CameraVideoService> req) {
+ CameraVideoService.MANAGER.bind(new CameraServiceImpl(mCtx, mCore, mShell), req);
alhaad1 2015/10/02 06:33:27 We are creating a new instance of CameraServiceImp
gautham 2015/10/02 22:29:12 I thought the shell already only opened one instan
+ }
+
+ @Override
+ public String getInterfaceName() {
+ return CameraVideoService.MANAGER.getName();
+ }
+ });
+ return true;
+ }
+
+ @Override
+ public void quit() {
+ }
+
+ public static void mojoMain(Context context, Core core,
+ MessagePipeHandle applicationRequestHandle) {
+ ApplicationRunner.run(new CameraApp(context, core), core, applicationRequestHandle);
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698