1 // Copyright (c) 2012 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 CONTENT_PUBLIC_BROWSER_BROWSER_CHILD_PROCESS_HOST_DELEGATE_H_
6 #define CONTENT_PUBLIC_BROWSER_BROWSER_CHILD_PROCESS_HOST_DELEGATE_H_
8 #include "content/common/content_export.h"
9 #include "ipc/ipc_listener.h"
13 class ServiceRegistry
;
15 // Interface that all users of BrowserChildProcessHost need to provide.
16 class CONTENT_EXPORT BrowserChildProcessHostDelegate
: public IPC::Listener
{
18 ~BrowserChildProcessHostDelegate() override
{}
20 // Delegates return true if it's ok to shut down the child process (which is
21 // the default return value). The exception is if the host is in the middle of
22 // sending a request to the process, in which case the other side might think
23 // it's ok to shutdown, when really it's not.
24 virtual bool CanShutdown();
26 // Called when the process has been started.
27 virtual void OnProcessLaunched() {}
29 // Called if the process failed to launch. In this case the process never
30 // started so there is no available exit code.
31 virtual void OnProcessLaunchFailed() {}
33 // Called if the process crashed. |exit_code| is the status returned when the
34 // process crashed (for posix, as returned from waitpid(), for Windows, as
35 // returned from GetExitCodeProcess()).
36 virtual void OnProcessCrashed(int exit_code
) {}
38 // Returns the ServiceRegistry for this child process.
39 virtual ServiceRegistry
* GetServiceRegistry();
42 }; // namespace content
44 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_CHILD_PROCESS_HOST_DELEGATE_H_