b6ebfa9fd35c34a5df1222edbf529c7d87133ea8
[platform/framework/web/crosswalk.git] / src / content / browser / frame_host / render_frame_host_delegate.h
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.
4
5 #ifndef CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_DELEGATE_H_
6 #define CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_DELEGATE_H_
7
8 #include "content/common/content_export.h"
9
10 namespace IPC {
11 class Message;
12 }
13
14 namespace content {
15 class RenderFrameHost;
16 class WebContents;
17 struct ContextMenuParams;
18
19 // An interface implemented by an object interested in knowing about the state
20 // of the RenderFrameHost.
21 class CONTENT_EXPORT RenderFrameHostDelegate {
22  public:
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);
26
27   // Informs the delegate whenever a RenderFrameHost is created.
28   virtual void RenderFrameCreated(RenderFrameHost* render_frame_host) {}
29
30   // Informs the delegate whenever a RenderFrameHost is deleted.
31   virtual void RenderFrameDeleted(RenderFrameHost* render_frame_host) {}
32
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) {}
36
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) {}
40
41   // Notification that a worker process has crashed.
42   virtual void WorkerCrashed(RenderFrameHost* render_frame_host) {}
43
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) {}
48
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();
52
53  protected:
54   virtual ~RenderFrameHostDelegate() {}
55 };
56
57 }  // namespace content
58
59 #endif  // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_DELEGATE_H_