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. 4 5 #ifndef CONTENT_PUBLIC_BROWSER_BROWSER_CHILD_PROCESS_HOST_DELEGATE_H_ 6 #define CONTENT_PUBLIC_BROWSER_BROWSER_CHILD_PROCESS_HOST_DELEGATE_H_ 7 8 #include "content/common/content_export.h" 9 #include "ipc/ipc_listener.h" 10 11 namespace content { 12 13 // Interface that all users of BrowserChildProcessHost need to provide. 14 class CONTENT_EXPORT BrowserChildProcessHostDelegate : public IPC::Listener { 15 public: ~BrowserChildProcessHostDelegate()16 virtual ~BrowserChildProcessHostDelegate() {} 17 18 // Delegates return true if it's ok to shut down the child process (which is 19 // the default return value). The exception is if the host is in the middle of 20 // sending a request to the process, in which case the other side might think 21 // it's ok to shutdown, when really it's not. 22 virtual bool CanShutdown(); 23 24 // Called when the process has been started. OnProcessLaunched()25 virtual void OnProcessLaunched() {} 26 27 // Called if the process crashed. |exit_code| is the status returned when the 28 // process crashed (for posix, as returned from waitpid(), for Windows, as 29 // returned from GetExitCodeProcess()). OnProcessCrashed(int exit_code)30 virtual void OnProcessCrashed(int exit_code) {} 31 }; 32 33 }; // namespace content 34 35 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_CHILD_PROCESS_HOST_DELEGATE_H_ 36