| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 package org.chromium.mojo.sensors; |
| 6 |
| 7 import android.content.Context; |
| 8 |
| 9 import org.chromium.mojo.application.ApplicationConnection; |
| 10 import org.chromium.mojo.application.ApplicationDelegate; |
| 11 import org.chromium.mojo.application.ApplicationRunner; |
| 12 import org.chromium.mojo.application.ServiceFactoryBinder; |
| 13 import org.chromium.mojo.system.Core; |
| 14 import org.chromium.mojo.system.MessagePipeHandle; |
| 15 import org.chromium.mojom.mojo.Shell; |
| 16 import org.chromium.mojom.sensors.SensorService; |
| 17 |
| 18 /** |
| 19 * Android service application implementing the SensorService interface. |
| 20 */ |
| 21 public class Sensors implements ApplicationDelegate { |
| 22 private Context mContext; |
| 23 |
| 24 public Sensors(Context context) { |
| 25 mContext = context; |
| 26 } |
| 27 |
| 28 /** |
| 29 * @see ApplicationDelegate#initialize(Shell, String[], String) |
| 30 */ |
| 31 @Override |
| 32 public void initialize(Shell shell, String[] args, String url) {} |
| 33 |
| 34 /** |
| 35 * @see ApplicationDelegate#configureIncomingConnection(String, ApplicationC
onnection) |
| 36 */ |
| 37 @Override |
| 38 public boolean configureIncomingConnection( |
| 39 final String requestorUrl, ApplicationConnection connection) { |
| 40 connection.addService(new ServiceFactoryBinder<SensorService>() { |
| 41 @Override |
| 42 public void bindNewInstanceToMessagePipe(MessagePipeHandle pipe) { |
| 43 SensorService.MANAGER.bind(new SensorServiceImpl(mContext), pipe
); |
| 44 } |
| 45 |
| 46 @Override |
| 47 public String getInterfaceName() { |
| 48 return SensorService.MANAGER.getName(); |
| 49 } |
| 50 }); |
| 51 return true; |
| 52 } |
| 53 |
| 54 /** |
| 55 * @see ApplicationDelegate#quit() |
| 56 */ |
| 57 @Override |
| 58 public void quit() {} |
| 59 |
| 60 public static void mojoMain( |
| 61 Context context, Core core, MessagePipeHandle applicationRequestHand
le) { |
| 62 ApplicationRunner.run(new Sensors(context), core, applicationRequestHand
le); |
| 63 } |
| 64 } |
| OLD | NEW |