Supervised user import: Listen for profile creation/deletion
[chromium-blink-merge.git] / mojo / shell / native_runner.h
blobb98cb82e2d462c48b9c563350237b6d574a9f129
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.
5 #ifndef MOJO_SHELL_NATIVE_RUNNER_H_
6 #define MOJO_SHELL_NATIVE_RUNNER_H_
8 #include "base/callback_forward.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "mojo/public/cpp/bindings/interface_request.h"
11 #include "mojo/public/interfaces/application/application.mojom.h"
13 namespace base {
14 class FilePath;
17 namespace mojo {
18 namespace shell {
20 enum class NativeApplicationCleanup { DELETE, DONT_DELETE };
22 // ApplicationManager requires implementations of NativeRunner and
23 // NativeRunnerFactory to run native applications.
24 class NativeRunner {
25 public:
26 virtual ~NativeRunner() {}
28 // Loads the app in the file at |app_path| and runs it on some other
29 // thread/process. If |cleanup| is |DELETE|, this takes ownership of the file.
30 // |app_completed_callback| is posted (to the thread on which |Start()| was
31 // called) after |MojoMain()| completes.
32 // TODO(vtl): |app_path| and |cleanup| should probably be moved to the
33 // factory's Create(). Rationale: The factory may need information from the
34 // file to decide what kind of NativeRunner to make.
35 virtual void Start(const base::FilePath& app_path,
36 NativeApplicationCleanup cleanup,
37 InterfaceRequest<Application> application_request,
38 const base::Closure& app_completed_callback) = 0;
41 class NativeRunnerFactory {
42 public:
43 // Options for running the native app. (This will contain, e.g., information
44 // about the sandbox profile, etc.)
45 struct Options {
46 // Constructs with default options.
47 Options() : force_in_process(false) {}
49 bool force_in_process;
52 virtual ~NativeRunnerFactory() {}
53 virtual scoped_ptr<NativeRunner> Create(const Options& options) = 0;
56 } // namespace shell
57 } // namespace mojo
59 #endif // MOJO_SHELL_NATIVE_RUNNER_H_