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); |
+ } |
+} |