summaryrefslogtreecommitdiffstats
path: root/mojo/shell/native_runner.h
blob: ff312d2559420b212671d83c817d2dcc012ff442 (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
45
46
47
48
49
50
51
52
53
54
// 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 MOJO_SHELL_NATIVE_RUNNER_H_
#define MOJO_SHELL_NATIVE_RUNNER_H_

#include "base/callback_forward.h"
#include "base/memory/scoped_ptr.h"
#include "base/process/process_handle.h"
#include "mojo/public/cpp/bindings/interface_request.h"
#include "mojo/shell/public/interfaces/shell_client.mojom.h"

namespace base {
class FilePath;
}

namespace mojo {
namespace shell {

class Identity;

// ApplicationManager requires implementations of NativeRunner and
// NativeRunnerFactory to run native applications.
class NativeRunner {
 public:
  virtual ~NativeRunner() {}

  // Loads the app in the file at |app_path| and runs it on some other
  // thread/process.
  virtual void Start(
      const base::FilePath& app_path,
      const Identity& target,
      bool start_sandboxed,
      InterfaceRequest<mojom::ShellClient> request,
      const base::Callback<void(base::ProcessId)>& pid_available_callback,
      const base::Closure& app_completed_callback) = 0;

  // Like Start(), but used to initialize the host for a child process started
  // by someone else. Provides |request| via |channel|.
  virtual void InitHost(ScopedHandle channel,
                        InterfaceRequest<mojom::ShellClient> request) = 0;
};

class NativeRunnerFactory {
 public:
  virtual ~NativeRunnerFactory() {}
  virtual scoped_ptr<NativeRunner> Create(const base::FilePath& app_path) = 0;
};

}  // namespace shell
}  // namespace mojo

#endif  // MOJO_SHELL_NATIVE_RUNNER_H_