Add ICU message format support
[chromium-blink-merge.git] / mojo / runner / in_process_native_runner.h
blobf5275a9c07c9dc77810e4f3762eba724eb25cc0d
1 // Copyright 2014 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.
5 #ifndef MOJO_RUNNER_IN_PROCESS_NATIVE_RUNNER_H_
6 #define MOJO_RUNNER_IN_PROCESS_NATIVE_RUNNER_H_
8 #include "base/callback.h"
9 #include "base/files/file_path.h"
10 #include "base/macros.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "base/scoped_native_library.h"
13 #include "base/threading/simple_thread.h"
14 #include "mojo/runner/native_application_support.h"
15 #include "mojo/shell/native_runner.h"
17 namespace mojo {
18 namespace runner {
20 class Context;
22 // An implementation of |NativeRunner| that loads/runs the given app (from the
23 // file system) on a separate thread (in the current process).
24 class InProcessNativeRunner : public shell::NativeRunner,
25 public base::DelegateSimpleThread::Delegate {
26 public:
27 explicit InProcessNativeRunner(Context* context);
28 ~InProcessNativeRunner() override;
30 // |NativeRunner| method:
31 void Start(const base::FilePath& app_path,
32 bool start_sandboxed,
33 shell::NativeApplicationCleanup cleanup,
34 InterfaceRequest<Application> application_request,
35 const base::Closure& app_completed_callback) override;
37 private:
38 // |base::DelegateSimpleThread::Delegate| method:
39 void Run() override;
41 base::FilePath app_path_;
42 shell::NativeApplicationCleanup cleanup_;
43 InterfaceRequest<Application> application_request_;
44 base::Callback<bool(void)> app_completed_callback_runner_;
46 base::ScopedNativeLibrary app_library_;
47 scoped_ptr<base::DelegateSimpleThread> thread_;
49 DISALLOW_COPY_AND_ASSIGN(InProcessNativeRunner);
52 class InProcessNativeRunnerFactory : public shell::NativeRunnerFactory {
53 public:
54 explicit InProcessNativeRunnerFactory(Context* context) : context_(context) {}
55 ~InProcessNativeRunnerFactory() override {}
57 scoped_ptr<shell::NativeRunner> Create(const Options& options) override;
59 private:
60 Context* const context_;
62 DISALLOW_COPY_AND_ASSIGN(InProcessNativeRunnerFactory);
65 } // namespace runner
66 } // namespace mojo
68 #endif // MOJO_RUNNER_IN_PROCESS_NATIVE_RUNNER_H_