Content settings: remove some plugin-related code/resources when... there are no...
[chromium-blink-merge.git] / content / public / browser / render_process_host_observer.h
blob9f11c7b70b1a48c8a0135d6441037ec6499279ab
1 // Copyright 2013 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_RENDER_PROCESS_HOST_OBSERVER_H_
6 #define CONTENT_PUBLIC_BROWSER_RENDER_PROCESS_HOST_OBSERVER_H_
8 #include "base/process/kill.h"
9 #include "base/process/process_handle.h"
10 #include "content/common/content_export.h"
12 namespace content {
14 class RenderProcessHost;
16 // An observer API implemented by classes which are interested
17 // in RenderProcessHost lifecycle events.
18 class CONTENT_EXPORT RenderProcessHostObserver {
19 public:
20 // This method is invoked when the process is going to exit and should not be
21 // used for further navigations. Note that this is a COURTESY callback, not
22 // guaranteed to be called for any particular process. Because this is the
23 // first step in an orderly shutdown of a render process, do not expect that
24 // a new render process will be hosted with this RenderProcessHost.
25 virtual void RenderProcessWillExit(RenderProcessHost* host) {}
27 // This method is invoked when the process of the observed RenderProcessHost
28 // exits (either normally or with a crash). To determine if the process closed
29 // normally or crashed, examine the |status| parameter.
31 // A new render process may be spawned for this RenderProcessHost, but there
32 // are no guarantees (e.g. if shutdown is occurring, the HostDestroyed
33 // callback will happen soon and that will be it, but if the renderer crashed
34 // and the user clicks 'reload', a new render process will be spawned).
36 // This will cause a call to WebContentsObserver::RenderProcessGone() for the
37 // active renderer process for the top-level frame; for code that needs to be
38 // a WebContentsObserver anyway, consider whether that API might be a better
39 // choice.
40 virtual void RenderProcessExited(RenderProcessHost* host,
41 base::TerminationStatus status,
42 int exit_code) {}
44 // This method is invoked when the observed RenderProcessHost itself is
45 // destroyed. This is guaranteed to be the last call made to the observer, so
46 // if the observer is tied to the observed RenderProcessHost, it is safe to
47 // delete it.
48 virtual void RenderProcessHostDestroyed(RenderProcessHost* host) {}
50 protected:
51 virtual ~RenderProcessHostObserver() {}
54 } // namespace content
56 #endif // CONTENT_PUBLIC_BROWSER_RENDER_PROCESS_HOST_OBSERVER_H_