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