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 // |to_different_document| will be true unless the load is a fragment
36 // navigation, or triggered by history.pushState/replaceState.
37 virtual void DidStartLoading(RenderFrameHost
* render_frame_host
,
38 bool to_different_document
) {}
40 // The top-level RenderFrame stopped loading a page. This corresponds to
41 // Blink's notion of the throbber stopping.
42 virtual void DidStopLoading(RenderFrameHost
* render_frame_host
) {}
44 // The RenderFrameHost has been swapped out.
45 virtual void SwappedOut(RenderFrameHost
* render_frame_host
) {}
47 // Notification that a worker process has crashed.
48 virtual void WorkerCrashed(RenderFrameHost
* render_frame_host
) {}
50 // A context menu should be shown, to be built using the context information
51 // provided in the supplied params.
52 virtual void ShowContextMenu(RenderFrameHost
* render_frame_host
,
53 const ContextMenuParams
& params
) {}
55 // Return this object cast to a WebContents, if it is one. If the object is
56 // not a WebContents, returns NULL.
57 virtual WebContents
* GetAsWebContents();
60 virtual ~RenderFrameHostDelegate() {}
63 } // namespace content
65 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_DELEGATE_H_