summaryrefslogtreecommitdiffstats
path: root/content/public/common/child_process_host_delegate.h
blob: 4418e611a0035dc7793e7415a0cdc95b8c4ef712 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CONTENT_PUBLIC_COMMON_CHILD_PROCESS_HOST_DELEGATE_H_
#define CONTENT_PUBLIC_COMMON_CHILD_PROCESS_HOST_DELEGATE_H_
#pragma once

#include <string>

#include "content/common/content_export.h"
#include "ipc/ipc_channel.h"

namespace content {

// Interface that all users of ChildProcessHost need to provide.
class ChildProcessHostDelegate : public IPC::Channel::Listener {
 public:
  virtual ~ChildProcessHostDelegate() {}

  // Delegates return true if it's ok to shut down the child process (which is
  // the default return value). The exception is if the host is in the middle of
  // sending a request to the process, in which case the other side might think
  // it's ok to shutdown, when really it's not.
  CONTENT_EXPORT virtual bool CanShutdown();

  // Notifies the derived class that we told the child process to kill itself.
  virtual void ShutdownStarted() {}

  // Called when the child process unexpected closes the IPC channel. Delegates
  // would normally delete the object in this case.
  virtual void OnChildDisconnected() {}
};

};  // namespace content

#endif  // CONTENT_PUBLIC_COMMON_CHILD_PROCESS_HOST_DELEGATE_H_