OLD | NEW |
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.shell; | 5 package org.chromium.mojo.shell; |
6 | 6 |
7 import android.os.HandlerThread; | 7 import android.os.HandlerThread; |
8 | 8 |
9 import org.chromium.base.ApplicationStatus; | 9 import org.chromium.base.ApplicationStatus; |
10 import org.chromium.base.CalledByNative; | 10 import org.chromium.base.CalledByNative; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 new Thread(new ApplicationRunnable(applicationDelegate, messagePipeH
andle)).start(); | 78 new Thread(new ApplicationRunnable(applicationDelegate, messagePipeH
andle)).start(); |
79 } else { | 79 } else { |
80 messagePipeHandle.close(); | 80 messagePipeHandle.close(); |
81 } | 81 } |
82 } | 82 } |
83 | 83 |
84 @CalledByNative | 84 @CalledByNative |
85 private static JavaApplicationRegistry create() { | 85 private static JavaApplicationRegistry create() { |
86 JavaApplicationRegistry registry = new JavaApplicationRegistry(); | 86 JavaApplicationRegistry registry = new JavaApplicationRegistry(); |
87 // Register services. | 87 // Register services. |
| 88 registry.registerApplicationDelegate("mojo:android", |
| 89 new ServiceProviderFactoryApplicationDelegate(new AndroidFactory
())); |
88 registry.registerApplicationDelegate("mojo:authentication", | 90 registry.registerApplicationDelegate("mojo:authentication", |
89 new AuthenticationApplicationDelegate(ApplicationStatus.getAppli
cationContext(), | 91 new AuthenticationApplicationDelegate(ApplicationStatus.getAppli
cationContext(), |
90 CoreImpl.getInstance())); | 92 CoreImpl.getInstance())); |
| 93 registry.registerApplicationDelegate("mojo:keyboard", |
| 94 new ServiceProviderFactoryApplicationDelegate(new KeyboardFactor
y())); |
91 registry.registerApplicationDelegate( | 95 registry.registerApplicationDelegate( |
92 "mojo:input", new ServiceProviderFactoryApplicationDelegate(new
InputFactory())); | 96 "mojo:input", new ServiceProviderFactoryApplicationDelegate(new
InputFactory())); |
93 registry.registerApplicationDelegate("mojo:keyboard", | |
94 new ServiceProviderFactoryApplicationDelegate(new KeyboardFactor
y())); | |
95 registry.registerApplicationDelegate( | 97 registry.registerApplicationDelegate( |
96 "mojo:intent_receiver", new ServiceProviderFactoryApplicationDel
egate( | 98 "mojo:intent_receiver", new ServiceProviderFactoryApplicationDel
egate( |
97 IntentReceiverRegistry.getInstan
ce())); | 99 IntentReceiverRegistry.getInstan
ce())); |
98 registry.registerApplicationDelegate("mojo:location_service", | 100 registry.registerApplicationDelegate("mojo:location_service", |
99 new LocationApplicationDelegate(ApplicationStatus.getApplication
Context(), | 101 new LocationApplicationDelegate(ApplicationStatus.getApplication
Context(), |
100 CoreImpl.getInstance())); | 102 CoreImpl.getInstance())); |
101 | 103 |
| 104 registry.registerApplicationDelegate( |
| 105 "mojo:native_viewport_support", new NativeViewportSupportApplica
tionDelegate()); |
102 registry.registerApplicationDelegate("mojo:nfc", new NfcApplicationDeleg
ate()); | 106 registry.registerApplicationDelegate("mojo:nfc", new NfcApplicationDeleg
ate()); |
103 registry.registerApplicationDelegate("mojo:sharing", new SharingApplicat
ionDelegate()); | 107 registry.registerApplicationDelegate("mojo:sharing", new SharingApplicat
ionDelegate()); |
104 registry.registerApplicationDelegate( | 108 registry.registerApplicationDelegate( |
105 "mojo:native_viewport_support", new NativeViewportSupportApplica
tionDelegate()); | |
106 registry.registerApplicationDelegate( | |
107 "mojo:vsync", new ServiceProviderFactoryApplicationDelegate( | 109 "mojo:vsync", new ServiceProviderFactoryApplicationDelegate( |
108 new VsyncFactory(registry.mHandlerThread.g
etLooper()))); | 110 new VsyncFactory(registry.mHandlerThread.g
etLooper()))); |
109 return registry; | 111 return registry; |
110 } | 112 } |
111 | 113 |
112 static class ServiceProviderFactoryApplicationDelegate implements Applicatio
nDelegate { | 114 static class ServiceProviderFactoryApplicationDelegate implements Applicatio
nDelegate { |
113 private final ServiceFactoryBinder<?> mBinder; | 115 private final ServiceFactoryBinder<?> mBinder; |
114 | 116 |
115 ServiceProviderFactoryApplicationDelegate(ServiceFactoryBinder<?> binder
) { | 117 ServiceProviderFactoryApplicationDelegate(ServiceFactoryBinder<?> binder
) { |
116 mBinder = binder; | 118 mBinder = binder; |
(...skipping 14 matching lines...) Expand all Loading... |
131 return true; | 133 return true; |
132 } | 134 } |
133 | 135 |
134 /** | 136 /** |
135 * @see ApplicationDelegate#quit() | 137 * @see ApplicationDelegate#quit() |
136 */ | 138 */ |
137 @Override | 139 @Override |
138 public void quit() {} | 140 public void quit() {} |
139 } | 141 } |
140 } | 142 } |
OLD | NEW |