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_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_DELEGATE_H_
6 #define CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_DELEGATE_H_
8 #include "content/common/content_export.h"
15 class RenderFrameHost;
17 struct ContextMenuParams;
19 // An interface implemented by an object interested in knowing about the state
20 // of the RenderFrameHost.
21 class CONTENT_EXPORT RenderFrameHostDelegate {
23 // This is used to give the delegate a chance to filter IPC messages.
24 virtual bool OnMessageReceived(RenderFrameHost* render_frame_host,
25 const IPC::Message& message);
27 // Informs the delegate whenever a RenderFrameHost is created.
28 virtual void RenderFrameCreated(RenderFrameHost* render_frame_host) {}
30 // Informs the delegate whenever a RenderFrameHost is deleted.
31 virtual void RenderFrameDeleted(RenderFrameHost* render_frame_host) {}
33 // The top-level RenderFrame began loading a new page. This corresponds to
34 // Blink's notion of the throbber starting.
35 virtual void DidStartLoading(RenderFrameHost* render_frame_host) {}
37 // The top-level RenderFrame stopped loading a page. This corresponds to
38 // Blink's notion of the throbber stopping.
39 virtual void DidStopLoading(RenderFrameHost* render_frame_host) {}
41 // Notification that a worker process has crashed.
42 virtual void WorkerCrashed(RenderFrameHost* render_frame_host) {}
44 // A context menu should be shown, to be built using the context information
45 // provided in the supplied params.
46 virtual void ShowContextMenu(RenderFrameHost* render_frame_host,
47 const ContextMenuParams& params) {}
49 // Return this object cast to a WebContents, if it is one. If the object is
50 // not a WebContents, returns NULL.
51 virtual WebContents* GetAsWebContents();
54 virtual ~RenderFrameHostDelegate() {}
57 } // namespace content
59 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_DELEGATE_H_