blob: ddd83956cefa2730d7a6d4290d0d64f685edd703 (
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
// Copyright 2014 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_RUNNER_HOST_IN_PROCESS_NATIVE_RUNNER_H_
#define MOJO_RUNNER_HOST_IN_PROCESS_NATIVE_RUNNER_H_
#include "base/callback.h"
#include "base/files/file_path.h"
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "base/scoped_native_library.h"
#include "base/threading/simple_thread.h"
#include "mojo/runner/host/native_application_support.h"
#include "mojo/shell/native_runner.h"
namespace base {
class TaskRunner;
}
namespace mojo {
namespace runner {
// An implementation of |NativeRunner| that loads/runs the given app (from the
// file system) on a separate thread (in the current process).
class InProcessNativeRunner : public shell::NativeRunner,
public base::DelegateSimpleThread::Delegate {
public:
InProcessNativeRunner();
~InProcessNativeRunner() override;
// |NativeRunner| method:
void Start(const base::FilePath& app_path,
bool start_sandboxed,
InterfaceRequest<Application> application_request,
const base::Closure& app_completed_callback) override;
private:
// |base::DelegateSimpleThread::Delegate| method:
void Run() override;
base::FilePath app_path_;
InterfaceRequest<Application> application_request_;
base::Callback<bool(void)> app_completed_callback_runner_;
base::ScopedNativeLibrary app_library_;
scoped_ptr<base::DelegateSimpleThread> thread_;
DISALLOW_COPY_AND_ASSIGN(InProcessNativeRunner);
};
class InProcessNativeRunnerFactory : public shell::NativeRunnerFactory {
public:
explicit InProcessNativeRunnerFactory(base::TaskRunner* launch_process_runner)
: launch_process_runner_(launch_process_runner) {}
~InProcessNativeRunnerFactory() override {}
scoped_ptr<shell::NativeRunner> Create(
const base::FilePath& app_path) override;
private:
base::TaskRunner* const launch_process_runner_;
DISALLOW_COPY_AND_ASSIGN(InProcessNativeRunnerFactory);
};
} // namespace runner
} // namespace mojo
#endif // MOJO_RUNNER_HOST_IN_PROCESS_NATIVE_RUNNER_H_
|