| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_COMMON_CHILD_PROCESS_HOST_DELEGATE_H_ | 5 #ifndef CONTENT_PUBLIC_COMMON_CHILD_PROCESS_HOST_DELEGATE_H_ |
| 6 #define CONTENT_PUBLIC_COMMON_CHILD_PROCESS_HOST_DELEGATE_H_ | 6 #define CONTENT_PUBLIC_COMMON_CHILD_PROCESS_HOST_DELEGATE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "content/common/content_export.h" | 11 #include "content/common/content_export.h" |
| 12 #include "ipc/ipc_channel.h" | 12 #include "ipc/ipc_channel.h" |
| 13 | 13 |
| 14 namespace content { | 14 namespace content { |
| 15 | 15 |
| 16 // Interface that all users of ChildProcessHost need to provide. | 16 // Interface that all users of ChildProcessHost need to provide. |
| 17 class ChildProcessHostDelegate : public IPC::Channel::Listener { | 17 class CONTENT_EXPORT ChildProcessHostDelegate : public IPC::Channel::Listener { |
| 18 public: | 18 public: |
| 19 virtual ~ChildProcessHostDelegate() {} | 19 virtual ~ChildProcessHostDelegate() {} |
| 20 | 20 |
| 21 // Delegates return true if it's ok to shut down the child process (which is | 21 // Delegates return true if it's ok to shut down the child process (which is |
| 22 // the default return value). The exception is if the host is in the middle of | 22 // the default return value). The exception is if the host is in the middle of |
| 23 // sending a request to the process, in which case the other side might think | 23 // sending a request to the process, in which case the other side might think |
| 24 // it's ok to shutdown, when really it's not. | 24 // it's ok to shutdown, when really it's not. |
| 25 CONTENT_EXPORT virtual bool CanShutdown(); | 25 virtual bool CanShutdown(); |
| 26 | 26 |
| 27 // Notifies the derived class that we told the child process to kill itself. | 27 // Notifies the derived class that we told the child process to kill itself. |
| 28 virtual void ShutdownStarted() {} | 28 virtual void ShutdownStarted() {} |
| 29 | 29 |
| 30 // Called when the child process unexpected closes the IPC channel. Delegates | 30 // Called when the child process unexpected closes the IPC channel. Delegates |
| 31 // would normally delete the object in this case. | 31 // would normally delete the object in this case. |
| 32 virtual void OnChildDisconnected() {} | 32 virtual void OnChildDisconnected() {} |
| 33 }; | 33 }; |
| 34 | 34 |
| 35 }; // namespace content | 35 }; // namespace content |
| 36 | 36 |
| 37 #endif // CONTENT_PUBLIC_COMMON_CHILD_PROCESS_HOST_DELEGATE_H_ | 37 #endif // CONTENT_PUBLIC_COMMON_CHILD_PROCESS_HOST_DELEGATE_H_ |
| OLD | NEW |