summaryrefslogtreecommitdiffstats
path: root/content/browser/mojo/mojo_shell_client_host.h
blob: 25539a375390a1bac5aa7833884b42128cd9bea4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// 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.

#ifndef CONTENT_BROWSER_MOJO_MOJO_SHELL_CLIENT_HOST_H_
#define CONTENT_BROWSER_MOJO_MOJO_SHELL_CLIENT_HOST_H_

#include <string>

#include "base/process/process_handle.h"
#include "mojo/shell/public/interfaces/shell.mojom.h"
#include "third_party/mojo/src/mojo/edk/embedder/scoped_platform_handle.h"

namespace content {

class RenderProcessHost;

// Creates a communication channel between the external Mojo shell and the
// child. The server handle of this channel is shared with the external shell
// via Mojo IPC. |child_process_id| is used to uniquify the child in the
// external shell's instance map.
void RegisterChildWithExternalShell(int child_process_id,
                                    RenderProcessHost* render_process_host);

// Returns the URL associated with an instance corresponding to the renderer
// process in the external shell. This URL can be passed to
// ConnectToApplication() to open a new connection to this renderer.
std::string GetMojoApplicationInstanceURL(
    RenderProcessHost* render_process_host);

// Shares a client handle to the Mojo Shell with the child via Chrome IPC.
void SendExternalMojoShellHandleToChild(base::ProcessHandle process_handle,
                                        RenderProcessHost* render_process_host);

// Constructs a Capability Filter for the renderer's application instance in the
// external shell. This contains the restrictions imposed on what applications
// and interfaces the renderer can see. The implementation lives in
// renderer_capability_filter.cc so that it can be subject to specific security
// review.
mojo::shell::mojom::CapabilityFilterPtr CreateCapabilityFilterForRenderer();

}  // namespace content

#endif  // CONTENT_BROWSER_MOJO_MOJO_SHELL_CLIENT_HOST_H_