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

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: merge. Created 5 years, 2 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/camera/BUILD.gn ('k') | services/camera/src/org/chromium/services/camera/CameraRollApp.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..76fabd52827296d24952af14f3b4a69567e17141
--- /dev/null
+++ b/services/camera/src/org/chromium/services/camera/CameraApp.java
@@ -0,0 +1,61 @@
+// 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.CameraService;
+import org.chromium.mojom.mojo.Shell;
+
+class CameraApp implements ApplicationDelegate {
+ private CameraServiceImpl mCameraServiceImpl;
+
+ public CameraApp(Context context, Core core) {
+ mCameraServiceImpl = new CameraServiceImpl(context, core);
+ }
+
+ public void initialize(Shell shell, String[] args, String url) {
+ }
+
+ @Override
+ public boolean configureIncomingConnection(final ApplicationConnection connection) {
+ connection.addService(new ServiceFactoryBinder<CameraService>() {
+ @Override
+ public void bind(InterfaceRequest<CameraService> request) {
+ if (mCameraServiceImpl.cameraInUse()) {
+ /* another application is using the camera */
+ /* TODO: support multiplexing the camera stream to multiple applications */
+ request.close();
+ return;
+ }
+ mCameraServiceImpl.openCamera();
+ CameraService.MANAGER.bind(mCameraServiceImpl, request);
+ }
+
+ @Override
+ public String getInterfaceName() {
+ return CameraService.MANAGER.getName();
+ }
+ });
+ return true;
+ }
+
+ @Override
+ public void quit() {
+ mCameraServiceImpl.cleanup();
+ }
+
+ public static void mojoMain(Context context, Core core,
+ MessagePipeHandle applicationRequestHandle) {
+ ApplicationRunner.run(new CameraApp(context, core), core, applicationRequestHandle);
+ }
+}
« no previous file with comments | « services/camera/BUILD.gn ('k') | services/camera/src/org/chromium/services/camera/CameraRollApp.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698