ChildAccountService: get service flags from AccountTrackerService instead of fetching...
[chromium-blink-merge.git] / mojo / shell / native_runner.h
blobad89f4431e3a38ce2d9da2f086de2a0a26bf3bdb
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/application/public/interfaces/application.mojom.h"
11 #include "third_party/mojo/src/mojo/public/cpp/bindings/interface_request.h"
13 #if defined(OS_WIN)
14 #undef DELETE
15 #endif
17 namespace base {
18 class FilePath;
21 namespace mojo {
22 namespace shell {
24 enum class NativeApplicationCleanup { DELETE, DONT_DELETE };
26 // ApplicationManager requires implementations of NativeRunner and
27 // NativeRunnerFactory to run native applications.
28 class NativeRunner {
29 public:
30 virtual ~NativeRunner() {}
32 // Loads the app in the file at |app_path| and runs it on some other
33 // thread/process. If |cleanup| is |DELETE|, this takes ownership of the file.
34 // |app_completed_callback| is posted (to the thread on which |Start()| was
35 // called) after |MojoMain()| completes.
36 // TODO(vtl): |app_path| and |cleanup| should probably be moved to the
37 // factory's Create(). Rationale: The factory may need information from the
38 // file to decide what kind of NativeRunner to make.
39 virtual void Start(const base::FilePath& app_path,
40 NativeApplicationCleanup cleanup,
41 InterfaceRequest<Application> application_request,
42 const base::Closure& app_completed_callback) = 0;
45 class NativeRunnerFactory {
46 public:
47 // Options for running the native app. (This will contain, e.g., information
48 // about the sandbox profile, etc.)
49 struct Options {
50 // Constructs with default options.
51 Options() : force_in_process(false) {}
53 bool force_in_process;
56 virtual ~NativeRunnerFactory() {}
57 virtual scoped_ptr<NativeRunner> Create(const Options& options) = 0;
60 } // namespace shell
61 } // namespace mojo
63 #endif // MOJO_SHELL_NATIVE_RUNNER_H_