Make sure webrtc::VideoSourceInterface is released on the main render thread.
[chromium-blink-merge.git] / content / public / renderer / render_frame.h
blob5ecf4306e5f9cc043a3b50c8e5b85a56d752c345
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_RENDERER_RENDER_FRAME_H_
6 #define CONTENT_PUBLIC_RENDERER_RENDER_FRAME_H_
8 #include "base/strings/string16.h"
9 #include "content/common/content_export.h"
10 #include "ipc/ipc_listener.h"
11 #include "ipc/ipc_sender.h"
12 #include "third_party/WebKit/public/web/WebNavigationPolicy.h"
14 struct WebPreferences;
16 namespace blink {
17 class WebFrame;
18 class WebLocalFrame;
19 class WebNode;
20 class WebPlugin;
21 class WebURLRequest;
22 struct WebPluginParams;
25 namespace content {
26 class ContextMenuClient;
27 class RenderView;
28 struct ContextMenuParams;
29 struct WebPluginInfo;
31 // This interface wraps functionality, which is specific to frames, such as
32 // navigation. It provides communication with a corresponding RenderFrameHost
33 // in the browser process.
34 class CONTENT_EXPORT RenderFrame : public IPC::Listener,
35 public IPC::Sender {
36 public:
37 // Returns the RenderFrame given a WebFrame.
38 static RenderFrame* FromWebFrame(blink::WebFrame* web_frame);
40 // Returns the RenderView associated with this frame.
41 virtual RenderView* GetRenderView() = 0;
43 // Get the routing ID of the frame.
44 virtual int GetRoutingID() = 0;
46 // Returns the associated WebFrame.
47 virtual blink::WebFrame* GetWebFrame() = 0;
49 // Gets WebKit related preferences associated with this frame.
50 virtual WebPreferences& GetWebkitPreferences() = 0;
52 // Shows a context menu with the given information. The given client will
53 // be called with the result.
55 // The request ID will be returned by this function. This is passed to the
56 // client functions for identification.
58 // If the client is destroyed, CancelContextMenu() should be called with the
59 // request ID returned by this function.
61 // Note: if you end up having clients outliving the RenderFrame, we should add
62 // a CancelContextMenuCallback function that takes a request id.
63 virtual int ShowContextMenu(ContextMenuClient* client,
64 const ContextMenuParams& params) = 0;
66 // Cancels a context menu in the event that the client is destroyed before the
67 // menu is closed.
68 virtual void CancelContextMenu(int request_id) = 0;
70 // Gets the node that the context menu was pressed over.
71 virtual blink::WebNode GetContextMenuNode() const = 0;
73 // Create a new NPAPI/Pepper plugin depending on |info|. Returns NULL if no
74 // plugin was found.
75 virtual blink::WebPlugin* CreatePlugin(
76 blink::WebFrame* frame,
77 const WebPluginInfo& info,
78 const blink::WebPluginParams& params) = 0;
80 // The client should handle the navigation externally.
81 virtual void LoadURLExternally(blink::WebLocalFrame* frame,
82 const blink::WebURLRequest& request,
83 blink::WebNavigationPolicy policy) = 0;
85 // Execute a string of JavaScript in this frame's context.
86 virtual void ExecuteJavaScript(const base::string16& javascript) = 0;
88 protected:
89 virtual ~RenderFrame() {}
91 private:
92 // This interface should only be implemented inside content.
93 friend class RenderFrameImpl;
94 RenderFrame() {}
97 } // namespace content
99 #endif // CONTENT_PUBLIC_RENDERER_RENDER_FRAME_H_