Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(56)

Side by Side Diff: shell/application_manager/native_runner.h

Issue 961053005: More shell cleanup: Move NativeRunner(Factory) to native_runner.h. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: rebased Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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.
4
5 #ifndef SHELL_APPLICATION_MANAGER_NATIVE_RUNNER_H_
6 #define SHELL_APPLICATION_MANAGER_NATIVE_RUNNER_H_
7
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"
12
13 namespace base {
14 class FilePath;
15 }
16
17 namespace mojo {
18 namespace shell {
19
20 // ApplicationManager requires implementations of NativeRunner and
21 // NativeRunnerFactory to run native applications.
22 class NativeRunner {
23 public:
24 // Parameter for |Start()| to specify its cleanup behavior.
25 enum CleanupBehavior { DeleteAppPath, DontDeleteAppPath };
26
27 virtual ~NativeRunner() {}
28
29 // Loads the app in the file at |app_path| and runs it on some other
30 // thread/process. If |cleanup_behavior| is |true|, takes ownership of the
31 // file. |app_completed_callback| is posted (to the thread on which |Start()|
32 // was called) after |MojoMain()| completes.
33 // TODO(vtl): |app_path| and |cleanup_behavior| should probably be moved to
34 // the factory's Create(). Rationale: The factory may need information from
35 // the file to decide what kind of NativeRunner to make.
36 virtual void Start(const base::FilePath& app_path,
37 CleanupBehavior cleanup_behavior,
38 InterfaceRequest<Application> application_request,
39 const base::Closure& app_completed_callback) = 0;
40 };
41
42 class NativeRunnerFactory {
43 public:
44 // Options for running the native app. (This will contain, e.g., information
45 // about the sandbox profile, etc.)
46 struct Options {
47 // Constructs with default options.
48 Options() : force_in_process(false) {}
49
50 bool force_in_process;
51 };
52
53 virtual ~NativeRunnerFactory() {}
54 virtual scoped_ptr<NativeRunner> Create(const Options& options) = 0;
55 };
56
57 } // namespace shell
58 } // namespace mojo
59
60 #endif // SHELL_APPLICATION_MANAGER_NATIVE_RUNNER_H_
OLDNEW
« no previous file with comments | « shell/application_manager/application_manager.cc ('k') | shell/application_manager/query_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698