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

Side by Side Diff: services/authentication/src/org/chromium/mojo/authentication/AuthenticationApp.java

Issue 1116653002: Introduce authentication service. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Follow review Created 5 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.mojo.sensors; 5 package org.chromium.mojo.authentication;
6 6
7 import android.content.Context; 7 import android.content.Context;
8 8
9 import org.chromium.mojo.application.ApplicationConnection; 9 import org.chromium.mojo.application.ApplicationConnection;
10 import org.chromium.mojo.application.ApplicationDelegate; 10 import org.chromium.mojo.application.ApplicationDelegate;
11 import org.chromium.mojo.application.ApplicationRunner; 11 import org.chromium.mojo.application.ApplicationRunner;
12 import org.chromium.mojo.application.ServiceFactoryBinder; 12 import org.chromium.mojo.application.ServiceFactoryBinder;
13 import org.chromium.mojo.system.Core; 13 import org.chromium.mojo.system.Core;
14 import org.chromium.mojo.system.MessagePipeHandle; 14 import org.chromium.mojo.system.MessagePipeHandle;
15 import org.chromium.mojom.mojo.Shell; 15 import org.chromium.mojom.mojo.Shell;
16 import org.chromium.mojom.sensors.SensorService;
17 16
18 /** 17 /**
19 * Android service application implementing the SensorService interface. 18 * Android service application implementing the AuthenticationService interface.
20 */ 19 */
21 public class Sensors implements ApplicationDelegate { 20 public class AuthenticationApp implements ApplicationDelegate {
22 private Context mContext; 21 private final Context mContext;
22 private final Core mCore;
23 private Shell mShell;
23 24
24 public Sensors(Context context) { 25 public AuthenticationApp(Context context, Core core) {
25 mContext = context; 26 mContext = context;
27 mCore = core;
26 } 28 }
27 29
28 /** 30 /**
29 * @see ApplicationDelegate#initialize(Shell, String[], String) 31 * @see ApplicationDelegate#initialize(Shell, String[], String)
30 */ 32 */
31 @Override 33 @Override
32 public void initialize(Shell shell, String[] args, String url) {} 34 public void initialize(Shell shell, String[] args, String url) {
35 mShell = shell;
36 }
33 37
34 /** 38 /**
35 * @see ApplicationDelegate#configureIncomingConnection(String, ApplicationC onnection) 39 * @see ApplicationDelegate#configureIncomingConnection(ApplicationConnectio n)
36 */ 40 */
37 @Override 41 @Override
38 public boolean configureIncomingConnection( 42 public boolean configureIncomingConnection(final ApplicationConnection conne ction) {
39 final String requestorUrl, ApplicationConnection connection) { 43 connection.addService(new ServiceFactoryBinder<AuthenticationService>() {
40 connection.addService(new ServiceFactoryBinder<SensorService>() { 44
41 @Override 45 @Override
42 public void bindNewInstanceToMessagePipe(MessagePipeHandle pipe) { 46 public void bindNewInstanceToMessagePipe(MessagePipeHandle pipe) {
43 SensorService.MANAGER.bind(new SensorServiceImpl(mContext), pipe ); 47 AuthenticationService.MANAGER.bind(new AuthenticationServiceImpl (mContext, mCore,
48 connection.getRequest orUrl(), mShell),
49 pipe);
44 } 50 }
45 51
46 @Override 52 @Override
47 public String getInterfaceName() { 53 public String getInterfaceName() {
48 return SensorService.MANAGER.getName(); 54 return AuthenticationService.MANAGER.getName();
49 } 55 }
50 }); 56 });
51 return true; 57 return true;
52 } 58 }
53 59
54 /** 60 /**
55 * @see ApplicationDelegate#quit() 61 * @see ApplicationDelegate#quit()
56 */ 62 */
57 @Override 63 @Override
58 public void quit() {} 64 public void quit() {}
59 65
60 public static void mojoMain( 66 public static void mojoMain(
61 Context context, Core core, MessagePipeHandle applicationRequestHand le) { 67 Context context, Core core, MessagePipeHandle applicationRequestHand le) {
62 ApplicationRunner.run(new Sensors(context), core, applicationRequestHand le); 68 ApplicationRunner.run(new AuthenticationApp(context, core), core, applic ationRequestHandle);
63 } 69 }
64 } 70 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698