render_frame_host_delegate.h revision effb81e5f8246d0db0270817048dc992db66e9fb
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 10namespace IPC { 11class Message; 12} 13 14namespace content { 15class RenderFrameHost; 16class WebContents; 17struct ContextMenuParams; 18 19// An interface implemented by an object interested in knowing about the state 20// of the RenderFrameHost. 21class 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 // |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) {} 39 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) {} 43 44 // The RenderFrameHost has been swapped out. 45 virtual void SwappedOut(RenderFrameHost* render_frame_host) {} 46 47 // Notification that a worker process has crashed. 48 virtual void WorkerCrashed(RenderFrameHost* render_frame_host) {} 49 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) {} 54 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(); 58 59 protected: 60 virtual ~RenderFrameHostDelegate() {} 61}; 62 63} // namespace content 64 65#endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_DELEGATE_H_ 66