OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef SERVICES_SHELL_RUNNER_HOST_IN_PROCESS_NATIVE_RUNNER_H_ | 5 #ifndef SERVICES_SHELL_RUNNER_HOST_IN_PROCESS_NATIVE_RUNNER_H_ |
6 #define SERVICES_SHELL_RUNNER_HOST_IN_PROCESS_NATIVE_RUNNER_H_ | 6 #define SERVICES_SHELL_RUNNER_HOST_IN_PROCESS_NATIVE_RUNNER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 | 23 |
24 // An implementation of |NativeRunner| that loads/runs the given app (from the | 24 // An implementation of |NativeRunner| that loads/runs the given app (from the |
25 // file system) on a separate thread (in the current process). | 25 // file system) on a separate thread (in the current process). |
26 class InProcessNativeRunner : public NativeRunner, | 26 class InProcessNativeRunner : public NativeRunner, |
27 public base::DelegateSimpleThread::Delegate { | 27 public base::DelegateSimpleThread::Delegate { |
28 public: | 28 public: |
29 InProcessNativeRunner(); | 29 InProcessNativeRunner(); |
30 ~InProcessNativeRunner() override; | 30 ~InProcessNativeRunner() override; |
31 | 31 |
32 // NativeRunner: | 32 // NativeRunner: |
33 mojom::ShellClientPtr Start( | 33 mojom::ServicePtr Start( |
34 const base::FilePath& app_path, | 34 const base::FilePath& app_path, |
35 const Identity& target, | 35 const Identity& target, |
36 bool start_sandboxed, | 36 bool start_sandboxed, |
37 const base::Callback<void(base::ProcessId)>& pid_available_callback, | 37 const base::Callback<void(base::ProcessId)>& pid_available_callback, |
38 const base::Closure& app_completed_callback) override; | 38 const base::Closure& app_completed_callback) override; |
39 | 39 |
40 private: | 40 private: |
41 // |base::DelegateSimpleThread::Delegate| method: | 41 // |base::DelegateSimpleThread::Delegate| method: |
42 void Run() override; | 42 void Run() override; |
43 | 43 |
44 base::FilePath app_path_; | 44 base::FilePath app_path_; |
45 mojom::ShellClientRequest request_; | 45 mojom::ServiceRequest request_; |
46 base::Callback<bool(void)> app_completed_callback_runner_; | 46 base::Callback<bool(void)> app_completed_callback_runner_; |
47 | 47 |
48 base::ScopedNativeLibrary app_library_; | 48 base::ScopedNativeLibrary app_library_; |
49 std::unique_ptr<base::DelegateSimpleThread> thread_; | 49 std::unique_ptr<base::DelegateSimpleThread> thread_; |
50 | 50 |
51 DISALLOW_COPY_AND_ASSIGN(InProcessNativeRunner); | 51 DISALLOW_COPY_AND_ASSIGN(InProcessNativeRunner); |
52 }; | 52 }; |
53 | 53 |
54 class InProcessNativeRunnerFactory : public NativeRunnerFactory { | 54 class InProcessNativeRunnerFactory : public NativeRunnerFactory { |
55 public: | 55 public: |
56 explicit InProcessNativeRunnerFactory(base::TaskRunner* launch_process_runner) | 56 explicit InProcessNativeRunnerFactory(base::TaskRunner* launch_process_runner) |
57 : launch_process_runner_(launch_process_runner) {} | 57 : launch_process_runner_(launch_process_runner) {} |
58 ~InProcessNativeRunnerFactory() override {} | 58 ~InProcessNativeRunnerFactory() override {} |
59 | 59 |
60 std::unique_ptr<NativeRunner> Create(const base::FilePath& app_path) override; | 60 std::unique_ptr<NativeRunner> Create(const base::FilePath& app_path) override; |
61 | 61 |
62 private: | 62 private: |
63 base::TaskRunner* const launch_process_runner_; | 63 base::TaskRunner* const launch_process_runner_; |
64 | 64 |
65 DISALLOW_COPY_AND_ASSIGN(InProcessNativeRunnerFactory); | 65 DISALLOW_COPY_AND_ASSIGN(InProcessNativeRunnerFactory); |
66 }; | 66 }; |
67 | 67 |
68 } // namespace shell | 68 } // namespace shell |
69 | 69 |
70 #endif // SERVICES_SHELL_RUNNER_HOST_IN_PROCESS_NATIVE_RUNNER_H_ | 70 #endif // SERVICES_SHELL_RUNNER_HOST_IN_PROCESS_NATIVE_RUNNER_H_ |
OLD | NEW |