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
3 // found in the LICENSE file.
5 #ifndef SHELL_APP_CHILD_PROCESS_HOST_H_
6 #define SHELL_APP_CHILD_PROCESS_HOST_H_
10 #include "base/macros.h"
11 #include "mojo/edk/embedder/channel_info_forward.h"
12 #include "mojo/shell/app_child_process.mojom.h"
13 #include "mojo/shell/child_process_host.h"
18 // A subclass of |ChildProcessHost| to host an app child process, which runs a
19 // single app (loaded from the file system).
21 // Note: After |Start()|, |StartApp| must be called and this object must
22 // remained alive until the |on_app_complete| callback is called.
23 class AppChildProcessHost
: public ChildProcessHost
{
25 explicit AppChildProcessHost(Context
* context
);
26 ~AppChildProcessHost() override
;
28 // See |AppChildController|:
29 void StartApp(const String
& app_path
,
31 InterfaceRequest
<Application
> application_request
,
32 const AppChildController::StartAppCallback
& on_app_complete
);
33 void ExitNow(int32_t exit_code
);
35 // |ChildProcessHost| methods:
36 void WillStart() override
;
37 void DidStart(bool success
) override
;
40 // Callback for |embedder::CreateChannel()|.
41 void DidCreateChannel(embedder::ChannelInfo
* channel_info
);
43 void AppCompleted(int32_t result
);
45 AppChildControllerPtr controller_
;
46 embedder::ChannelInfo
* channel_info_
;
47 AppChildController::StartAppCallback on_app_complete_
;
49 DISALLOW_COPY_AND_ASSIGN(AppChildProcessHost
);
55 #endif // SHELL_APP_CHILD_PROCESS_HOST_H_