| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 CONTENT_PUBLIC_BROWSER_BROWSER_CHILD_PROCESS_HOST_DELEGATE_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_BROWSER_CHILD_PROCESS_HOST_DELEGATE_H_ |
| 6 #define CONTENT_PUBLIC_BROWSER_BROWSER_CHILD_PROCESS_HOST_DELEGATE_H_ | 6 #define CONTENT_PUBLIC_BROWSER_BROWSER_CHILD_PROCESS_HOST_DELEGATE_H_ |
| 7 | 7 |
| 8 #include "content/common/content_export.h" | 8 #include "content/common/content_export.h" |
| 9 #include "ipc/ipc_listener.h" | 9 #include "ipc/ipc_listener.h" |
| 10 | 10 |
| 11 namespace shell { |
| 12 class InterfaceProvider; |
| 13 class InterfaceRegistry; |
| 14 } |
| 15 |
| 11 namespace content { | 16 namespace content { |
| 12 | 17 |
| 13 class ServiceRegistry; | |
| 14 | |
| 15 // Interface that all users of BrowserChildProcessHost need to provide. | 18 // Interface that all users of BrowserChildProcessHost need to provide. |
| 16 class CONTENT_EXPORT BrowserChildProcessHostDelegate : public IPC::Listener { | 19 class CONTENT_EXPORT BrowserChildProcessHostDelegate : public IPC::Listener { |
| 17 public: | 20 public: |
| 18 ~BrowserChildProcessHostDelegate() override {} | 21 ~BrowserChildProcessHostDelegate() override {} |
| 19 | 22 |
| 20 // Delegates return true if it's ok to shut down the child process (which is | 23 // 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 | 24 // 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 | 25 // 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. | 26 // it's ok to shutdown, when really it's not. |
| 24 virtual bool CanShutdown(); | 27 virtual bool CanShutdown(); |
| 25 | 28 |
| 26 // Called when the process has been started. | 29 // Called when the process has been started. |
| 27 virtual void OnProcessLaunched() {} | 30 virtual void OnProcessLaunched() {} |
| 28 | 31 |
| 29 // Called if the process failed to launch. In this case the process never | 32 // Called if the process failed to launch. In this case the process never |
| 30 // started so the code here is a platform specific error code. | 33 // started so the code here is a platform specific error code. |
| 31 virtual void OnProcessLaunchFailed(int error_code) {} | 34 virtual void OnProcessLaunchFailed(int error_code) {} |
| 32 | 35 |
| 33 // Called if the process crashed. |exit_code| is the status returned when the | 36 // 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 | 37 // process crashed (for posix, as returned from waitpid(), for Windows, as |
| 35 // returned from GetExitCodeProcess()). | 38 // returned from GetExitCodeProcess()). |
| 36 virtual void OnProcessCrashed(int exit_code) {} | 39 virtual void OnProcessCrashed(int exit_code) {} |
| 37 | 40 |
| 38 // Returns the ServiceRegistry for this child process. | 41 // Returns the shell::InterfaceRegistry the browser process uses to expose |
| 39 virtual ServiceRegistry* GetServiceRegistry(); | 42 // interfaces to the child. |
| 43 virtual shell::InterfaceRegistry* GetInterfaceRegistry(); |
| 44 |
| 45 // Returns the shell::InterfaceProvider the browser process can use to bind |
| 46 // interfaces exposed to it from the child. |
| 47 virtual shell::InterfaceProvider* GetRemoteInterfaces(); |
| 40 }; | 48 }; |
| 41 | 49 |
| 42 }; // namespace content | 50 }; // namespace content |
| 43 | 51 |
| 44 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_CHILD_PROCESS_HOST_DELEGATE_H_ | 52 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_CHILD_PROCESS_HOST_DELEGATE_H_ |
| OLD | NEW |