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 MOJO_SHELL_APP_CHILD_PROCESS_HOST_H_ | 5 #ifndef SHELL_APP_CHILD_PROCESS_HOST_H_ |
6 #define MOJO_SHELL_APP_CHILD_PROCESS_HOST_H_ | 6 #define SHELL_APP_CHILD_PROCESS_HOST_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "mojo/edk/embedder/channel_info_forward.h" | 9 #include "mojo/edk/embedder/channel_info_forward.h" |
10 #include "mojo/shell/app_child_process.mojom.h" | 10 #include "shell/app_child_process.mojom.h" |
11 #include "mojo/shell/child_process_host.h" | 11 #include "shell/child_process_host.h" |
12 | 12 |
13 namespace mojo { | 13 namespace mojo { |
14 namespace shell { | 14 namespace shell { |
15 | 15 |
16 // A subclass of |ChildProcessHost| to host a |TYPE_APP| child process, which | 16 // A subclass of |ChildProcessHost| to host a |TYPE_APP| child process, which |
17 // runs a single app (loaded from the file system). | 17 // runs a single app (loaded from the file system). |
18 // | 18 // |
19 // Note: After |Start()|, this object must remain alive until the controller | 19 // Note: After |Start()|, this object must remain alive until the controller |
20 // client's |AppCompleted()| is called. | 20 // client's |AppCompleted()| is called. |
21 class AppChildProcessHost : public ChildProcessHost, | 21 class AppChildProcessHost : public ChildProcessHost, |
22 public ChildProcessHost::Delegate { | 22 public ChildProcessHost::Delegate { |
23 public: | 23 public: |
24 AppChildProcessHost(Context* context, | 24 AppChildProcessHost(Context* context, |
25 AppChildControllerClient* controller_client); | 25 AppChildControllerClient* controller_client); |
26 ~AppChildProcessHost() override; | 26 ~AppChildProcessHost() override; |
27 | 27 |
28 AppChildController* controller() { | 28 AppChildController* controller() { return controller_.get(); } |
29 return controller_.get(); | |
30 } | |
31 | 29 |
32 private: | 30 private: |
33 // |ChildProcessHost::Delegate| methods: | 31 // |ChildProcessHost::Delegate| methods: |
34 void WillStart() override; | 32 void WillStart() override; |
35 void DidStart(bool success) override; | 33 void DidStart(bool success) override; |
36 | 34 |
37 // Callback for |embedder::CreateChannel()|. | 35 // Callback for |embedder::CreateChannel()|. |
38 void DidCreateChannel(embedder::ChannelInfo* channel_info); | 36 void DidCreateChannel(embedder::ChannelInfo* channel_info); |
39 | 37 |
40 AppChildControllerClient* const controller_client_; | 38 AppChildControllerClient* const controller_client_; |
41 | 39 |
42 AppChildControllerPtr controller_; | 40 AppChildControllerPtr controller_; |
43 embedder::ChannelInfo* channel_info_; | 41 embedder::ChannelInfo* channel_info_; |
44 | 42 |
45 DISALLOW_COPY_AND_ASSIGN(AppChildProcessHost); | 43 DISALLOW_COPY_AND_ASSIGN(AppChildProcessHost); |
46 }; | 44 }; |
47 | 45 |
48 } // namespace shell | 46 } // namespace shell |
49 } // namespace mojo | 47 } // namespace mojo |
50 | 48 |
51 #endif // MOJO_SHELL_APP_CHILD_PROCESS_HOST_H_ | 49 #endif // SHELL_APP_CHILD_PROCESS_HOST_H_ |
OLD | NEW |