OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_RENDERER_RENDER_FRAME_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_RENDER_FRAME_IMPL_H_ |
6 #define CONTENT_RENDERER_RENDER_FRAME_IMPL_H_ | 6 #define CONTENT_RENDERER_RENDER_FRAME_IMPL_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 class CONTENT_EXPORT RenderFrameImpl | 43 class CONTENT_EXPORT RenderFrameImpl |
44 : public RenderFrame, | 44 : public RenderFrame, |
45 NON_EXPORTED_BASE(public blink::WebFrameClient) { | 45 NON_EXPORTED_BASE(public blink::WebFrameClient) { |
46 public: | 46 public: |
47 // Creates a new RenderFrame. |render_view| is the RenderView object that this | 47 // Creates a new RenderFrame. |render_view| is the RenderView object that this |
48 // frame belongs to. | 48 // frame belongs to. |
49 // Callers *must* call |SetWebFrame| immediately after creation. | 49 // Callers *must* call |SetWebFrame| immediately after creation. |
50 // TODO(creis): We should structure this so that |SetWebFrame| isn't needed. | 50 // TODO(creis): We should structure this so that |SetWebFrame| isn't needed. |
51 static RenderFrameImpl* Create(RenderViewImpl* render_view, int32 routing_id); | 51 static RenderFrameImpl* Create(RenderViewImpl* render_view, int32 routing_id); |
52 | 52 |
53 // For subframes, look up the RenderFrameImpl for the given WebFrame. Returns | 53 // Just like RenderFrame::FromWebFrame but returns the implementation. |
54 // NULL for main frames. | 54 static RenderFrameImpl* FromWebFrame(blink::WebFrame* web_frame); |
55 // This only works when using --site-per-process, and returns NULL otherwise. | |
56 // TODO(creis): Remove this when the RenderView methods dealing with frames | |
57 // have moved to RenderFrame. | |
58 static RenderFrameImpl* FindByWebFrame(blink::WebFrame* web_frame); | |
59 | 55 |
60 // Used by content_layouttest_support to hook into the creation of | 56 // Used by content_layouttest_support to hook into the creation of |
61 // RenderFrameImpls. | 57 // RenderFrameImpls. |
62 static void InstallCreateHook( | 58 static void InstallCreateHook( |
63 RenderFrameImpl* (*create_render_frame_impl)(RenderViewImpl*, int32)); | 59 RenderFrameImpl* (*create_render_frame_impl)(RenderViewImpl*, int32)); |
64 | 60 |
65 virtual ~RenderFrameImpl(); | 61 virtual ~RenderFrameImpl(); |
66 // TODO(nasko): Remove when no longer needed. | 62 // TODO(nasko): Remove when no longer needed. |
67 // See comment on the implementation of this method for more details. | 63 // See comment on the implementation of this method for more details. |
68 void operator delete(void*); | 64 void operator delete(void*); |
69 | 65 |
70 bool is_swapped_out() const { | 66 bool is_swapped_out() const { |
71 return is_swapped_out_; | 67 return is_swapped_out_; |
72 } | 68 } |
73 | 69 |
74 // TODO(jam): this is a temporary getter until all the code is transitioned | 70 // TODO(jam): this is a temporary getter until all the code is transitioned |
75 // to using RenderFrame instead of RenderView. | 71 // to using RenderFrame instead of RenderView. |
76 RenderViewImpl* render_view() { return render_view_; } | 72 RenderViewImpl* render_view() { return render_view_; } |
77 | 73 |
78 RendererWebCookieJarImpl* cookie_jar() { return &cookie_jar_; } | 74 RendererWebCookieJarImpl* cookie_jar() { return &cookie_jar_; } |
79 | 75 |
80 // Returns the RenderWidget associated with this frame. | 76 // Returns the RenderWidget associated with this frame. |
81 RenderWidget* GetRenderWidget(); | 77 RenderWidget* GetRenderWidget(); |
82 | 78 |
83 // Called by RenderView right after creating this object when the | 79 // This is called right after creation with the WebFrame for this RenderFrame. |
84 // blink::WebFrame has been created. | |
85 void MainWebFrameCreated(blink::WebFrame* frame); | |
86 | |
87 // In --site-per-process mode, we keep track of which WebFrame this | |
88 // RenderFrameImpl is for. | |
89 void SetWebFrame(blink::WebFrame* web_frame); | 80 void SetWebFrame(blink::WebFrame* web_frame); |
90 | 81 |
91 #if defined(ENABLE_PLUGINS) | 82 #if defined(ENABLE_PLUGINS) |
92 // Notification that a PPAPI plugin has been created. | 83 // Notification that a PPAPI plugin has been created. |
93 void PepperPluginCreated(RendererPpapiHost* host); | 84 void PepperPluginCreated(RendererPpapiHost* host); |
94 | 85 |
95 // Notifies that |instance| has changed the cursor. | 86 // Notifies that |instance| has changed the cursor. |
96 // This will update the cursor appearance if it is currently over the plugin | 87 // This will update the cursor appearance if it is currently over the plugin |
97 // instance. | 88 // instance. |
98 void PepperDidChangeCursor(PepperPluginInstanceImpl* instance, | 89 void PepperDidChangeCursor(PepperPluginInstanceImpl* instance, |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 | 136 |
146 // IPC::Sender | 137 // IPC::Sender |
147 virtual bool Send(IPC::Message* msg) OVERRIDE; | 138 virtual bool Send(IPC::Message* msg) OVERRIDE; |
148 | 139 |
149 // IPC::Listener | 140 // IPC::Listener |
150 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; | 141 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; |
151 | 142 |
152 // RenderFrame implementation: | 143 // RenderFrame implementation: |
153 virtual RenderView* GetRenderView() OVERRIDE; | 144 virtual RenderView* GetRenderView() OVERRIDE; |
154 virtual int GetRoutingID() OVERRIDE; | 145 virtual int GetRoutingID() OVERRIDE; |
| 146 virtual blink::WebFrame* GetWebFrame() OVERRIDE; |
155 virtual WebPreferences& GetWebkitPreferences() OVERRIDE; | 147 virtual WebPreferences& GetWebkitPreferences() OVERRIDE; |
156 virtual int ShowContextMenu(ContextMenuClient* client, | 148 virtual int ShowContextMenu(ContextMenuClient* client, |
157 const ContextMenuParams& params) OVERRIDE; | 149 const ContextMenuParams& params) OVERRIDE; |
158 virtual void CancelContextMenu(int request_id) OVERRIDE; | 150 virtual void CancelContextMenu(int request_id) OVERRIDE; |
159 virtual blink::WebPlugin* CreatePlugin( | 151 virtual blink::WebPlugin* CreatePlugin( |
160 blink::WebFrame* frame, | 152 blink::WebFrame* frame, |
161 const WebPluginInfo& info, | 153 const WebPluginInfo& info, |
162 const blink::WebPluginParams& params) OVERRIDE; | 154 const blink::WebPluginParams& params) OVERRIDE; |
163 virtual void LoadURLExternally( | 155 virtual void LoadURLExternally( |
164 blink::WebFrame* frame, | 156 blink::WebFrame* frame, |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 // Functions to add and remove observers for this object. | 312 // Functions to add and remove observers for this object. |
321 void AddObserver(RenderFrameObserver* observer); | 313 void AddObserver(RenderFrameObserver* observer); |
322 void RemoveObserver(RenderFrameObserver* observer); | 314 void RemoveObserver(RenderFrameObserver* observer); |
323 | 315 |
324 // IPC message handlers ------------------------------------------------------ | 316 // IPC message handlers ------------------------------------------------------ |
325 // | 317 // |
326 // The documentation for these functions should be in | 318 // The documentation for these functions should be in |
327 // content/common/*_messages.h for the message that the function is handling. | 319 // content/common/*_messages.h for the message that the function is handling. |
328 void OnSwapOut(); | 320 void OnSwapOut(); |
329 | 321 |
330 // In --site-per-process mode, stores the WebFrame we are associated with. | 322 // Stores the WebFrame we are associated with. |
331 // NULL otherwise. | |
332 blink::WebFrame* frame_; | 323 blink::WebFrame* frame_; |
333 | 324 |
334 RenderViewImpl* render_view_; | 325 RenderViewImpl* render_view_; |
335 int routing_id_; | 326 int routing_id_; |
336 bool is_swapped_out_; | 327 bool is_swapped_out_; |
337 bool is_detaching_; | 328 bool is_detaching_; |
338 | 329 |
339 #if defined(ENABLE_PLUGINS) | 330 #if defined(ENABLE_PLUGINS) |
340 // Current text input composition text. Empty if no composition is in | 331 // Current text input composition text. Empty if no composition is in |
341 // progress. | 332 // progress. |
342 base::string16 pepper_composition_text_; | 333 base::string16 pepper_composition_text_; |
343 #endif | 334 #endif |
344 | 335 |
345 RendererWebCookieJarImpl cookie_jar_; | 336 RendererWebCookieJarImpl cookie_jar_; |
346 | 337 |
347 // All the registered observers. | 338 // All the registered observers. |
348 ObserverList<RenderFrameObserver> observers_; | 339 ObserverList<RenderFrameObserver> observers_; |
349 | 340 |
350 DISALLOW_COPY_AND_ASSIGN(RenderFrameImpl); | 341 DISALLOW_COPY_AND_ASSIGN(RenderFrameImpl); |
351 }; | 342 }; |
352 | 343 |
353 } // namespace content | 344 } // namespace content |
354 | 345 |
355 #endif // CONTENT_RENDERER_RENDER_FRAME_IMPL_H_ | 346 #endif // CONTENT_RENDERER_RENDER_FRAME_IMPL_H_ |
OLD | NEW |