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 SHELL_IN_PROCESS_NATIVE_RUNNER_H_ | 5 #ifndef SHELL_IN_PROCESS_NATIVE_RUNNER_H_ |
6 #define SHELL_IN_PROCESS_NATIVE_RUNNER_H_ | 6 #define SHELL_IN_PROCESS_NATIVE_RUNNER_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/scoped_native_library.h" | 12 #include "base/scoped_native_library.h" |
13 #include "base/threading/simple_thread.h" | 13 #include "base/threading/simple_thread.h" |
14 #include "shell/application_manager/native_runner.h" | 14 #include "shell/application_manager/native_runner.h" |
15 #include "shell/native_application_support.h" | 15 #include "shell/native_application_support.h" |
16 | 16 |
17 namespace mojo { | |
18 namespace shell { | 17 namespace shell { |
19 | 18 |
20 class Context; | 19 class Context; |
21 | 20 |
22 // An implementation of |NativeRunner| that loads/runs the given app (from the | 21 // An implementation of |NativeRunner| that loads/runs the given app (from the |
23 // file system) on a separate thread (in the current process). | 22 // file system) on a separate thread (in the current process). |
24 class InProcessNativeRunner : public NativeRunner, | 23 class InProcessNativeRunner : public NativeRunner, |
25 public base::DelegateSimpleThread::Delegate { | 24 public base::DelegateSimpleThread::Delegate { |
26 public: | 25 public: |
27 explicit InProcessNativeRunner(Context* context); | 26 explicit InProcessNativeRunner(Context* context); |
28 ~InProcessNativeRunner() override; | 27 ~InProcessNativeRunner() override; |
29 | 28 |
30 // |NativeRunner| method: | 29 // |NativeRunner| method: |
31 void Start(const base::FilePath& app_path, | 30 void Start(const base::FilePath& app_path, |
32 NativeApplicationCleanup cleanup, | 31 NativeApplicationCleanup cleanup, |
33 InterfaceRequest<Application> application_request, | 32 mojo::InterfaceRequest<mojo::Application> application_request, |
34 const base::Closure& app_completed_callback) override; | 33 const base::Closure& app_completed_callback) override; |
35 | 34 |
36 private: | 35 private: |
37 // |base::DelegateSimpleThread::Delegate| method: | 36 // |base::DelegateSimpleThread::Delegate| method: |
38 void Run() override; | 37 void Run() override; |
39 | 38 |
40 base::FilePath app_path_; | 39 base::FilePath app_path_; |
41 NativeApplicationCleanup cleanup_; | 40 NativeApplicationCleanup cleanup_; |
42 InterfaceRequest<Application> application_request_; | 41 mojo::InterfaceRequest<mojo::Application> application_request_; |
43 base::Callback<bool(void)> app_completed_callback_runner_; | 42 base::Callback<bool(void)> app_completed_callback_runner_; |
44 | 43 |
45 base::ScopedNativeLibrary app_library_; | 44 base::ScopedNativeLibrary app_library_; |
46 scoped_ptr<base::DelegateSimpleThread> thread_; | 45 scoped_ptr<base::DelegateSimpleThread> thread_; |
47 | 46 |
48 DISALLOW_COPY_AND_ASSIGN(InProcessNativeRunner); | 47 DISALLOW_COPY_AND_ASSIGN(InProcessNativeRunner); |
49 }; | 48 }; |
50 | 49 |
51 class InProcessNativeRunnerFactory : public NativeRunnerFactory { | 50 class InProcessNativeRunnerFactory : public NativeRunnerFactory { |
52 public: | 51 public: |
53 explicit InProcessNativeRunnerFactory(Context* context) : context_(context) {} | 52 explicit InProcessNativeRunnerFactory(Context* context) : context_(context) {} |
54 ~InProcessNativeRunnerFactory() override {} | 53 ~InProcessNativeRunnerFactory() override {} |
55 | 54 |
56 scoped_ptr<NativeRunner> Create(const Options& options) override; | 55 scoped_ptr<NativeRunner> Create(const Options& options) override; |
57 | 56 |
58 private: | 57 private: |
59 Context* const context_; | 58 Context* const context_; |
60 | 59 |
61 DISALLOW_COPY_AND_ASSIGN(InProcessNativeRunnerFactory); | 60 DISALLOW_COPY_AND_ASSIGN(InProcessNativeRunnerFactory); |
62 }; | 61 }; |
63 | 62 |
64 } // namespace shell | 63 } // namespace shell |
65 } // namespace mojo | |
66 | 64 |
67 #endif // SHELL_IN_PROCESS_NATIVE_RUNNER_H_ | 65 #endif // SHELL_IN_PROCESS_NATIVE_RUNNER_H_ |
OLD | NEW |