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

Side by Side Diff: mojo/public/java/application/src/org/chromium/mojo/application/ShellHelper.java

Issue 2250183003: Make the fuchsia mojo/public repo the source of truth. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 4 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
(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.application;
6
7 import org.chromium.mojo.bindings.Interface;
8 import org.chromium.mojo.bindings.Interface.Proxy;
9 import org.chromium.mojo.bindings.InterfaceRequest;
10 import org.chromium.mojo.system.Core;
11 import org.chromium.mojo.system.Pair;
12 import org.chromium.mojom.mojo.ServiceProvider;
13 import org.chromium.mojom.mojo.Shell;
14
15 /**
16 * Helper class to help connecting to other application through the shell.
17 */
18 public class ShellHelper {
19 /**
20 * Connects to a service in another application.
21 *
22 * @param core Implementation of the {@link Core} api.
23 * @param shell Instance of the shell.
24 * @param application URL to the application to use.
25 * @param manager {@link org.chromium.mojo.bindings.Interface.NamedManager} for the service to
26 * connect to.
27 * @return a proxy to the service.
28 */
29 public static <I extends Interface, P extends Proxy> P connectToService(
30 Core core, Shell shell, String application, Interface.NamedManager<I , P> manager) {
31 Pair<ServiceProvider.Proxy, InterfaceRequest<ServiceProvider>> providerR equest =
32 ServiceProvider.MANAGER.getInterfaceRequest(core);
33 try (ServiceProvider.Proxy provider = providerRequest.first) {
34 shell.connectToApplication(application, providerRequest.second);
35 Pair<P, InterfaceRequest<I>> serviceRequest = manager.getInterfaceRe quest(core);
36 provider.connectToService(manager.getName(), serviceRequest.second.p assHandle());
37 return serviceRequest.first;
38 }
39 }
40 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698