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 <set> | 8 #include <set> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 28 matching lines...) Expand all Loading... |
39 class RenderViewImpl; | 39 class RenderViewImpl; |
40 class RenderWidget; | 40 class RenderWidget; |
41 class RenderWidgetFullscreenPepper; | 41 class RenderWidgetFullscreenPepper; |
42 | 42 |
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 set_web_frame immediately after creation. |
| 50 // TODO(creis): We should structure this so that set_web_frame isn't needed. |
49 static RenderFrameImpl* Create(RenderViewImpl* render_view, int32 routing_id); | 51 static RenderFrameImpl* Create(RenderViewImpl* render_view, int32 routing_id); |
50 | 52 |
| 53 // Look up the RenderFrameImpl for the given WebFrame. |
| 54 // TODO(creis): I don't think we need this long term. |
| 55 static RenderFrameImpl* FindByWebFrame(blink::WebFrame* web_frame); |
| 56 |
51 // Used by content_layouttest_support to hook into the creation of | 57 // Used by content_layouttest_support to hook into the creation of |
52 // RenderFrameImpls. | 58 // RenderFrameImpls. |
53 static void InstallCreateHook( | 59 static void InstallCreateHook( |
54 RenderFrameImpl* (*create_render_frame_impl)(RenderViewImpl*, int32)); | 60 RenderFrameImpl* (*create_render_frame_impl)(RenderViewImpl*, int32)); |
55 | 61 |
56 virtual ~RenderFrameImpl(); | 62 virtual ~RenderFrameImpl(); |
57 | 63 |
| 64 void set_web_frame(blink::WebFrame* web_frame) { |
| 65 DCHECK(!frame_); |
| 66 frame_ = web_frame; |
| 67 } |
| 68 |
| 69 bool is_swapped_out() const { |
| 70 return is_swapped_out_; |
| 71 } |
| 72 |
58 // TODO(jam): this is a temporary getter until all the code is transitioned | 73 // TODO(jam): this is a temporary getter until all the code is transitioned |
59 // to using RenderFrame instead of RenderView. | 74 // to using RenderFrame instead of RenderView. |
60 RenderViewImpl* render_view() { return render_view_; } | 75 RenderViewImpl* render_view() { return render_view_; } |
61 | 76 |
62 // Returns the RenderWidget associated with this frame. | 77 // Returns the RenderWidget associated with this frame. |
63 RenderWidget* GetRenderWidget(); | 78 RenderWidget* GetRenderWidget(); |
64 | 79 |
65 // Called by RenderView right after creating this object when the | 80 // Called by RenderView right after creating this object when the |
66 // blink::WebFrame has been created. | 81 // blink::WebFrame has been created. |
67 void MainWebFrameCreated(blink::WebFrame* frame); | 82 void MainWebFrameCreated(blink::WebFrame* frame); |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 protected: | 333 protected: |
319 RenderFrameImpl(RenderViewImpl* render_view, int32 routing_id); | 334 RenderFrameImpl(RenderViewImpl* render_view, int32 routing_id); |
320 | 335 |
321 private: | 336 private: |
322 friend class RenderFrameObserver; | 337 friend class RenderFrameObserver; |
323 | 338 |
324 // Functions to add and remove observers for this object. | 339 // Functions to add and remove observers for this object. |
325 void AddObserver(RenderFrameObserver* observer); | 340 void AddObserver(RenderFrameObserver* observer); |
326 void RemoveObserver(RenderFrameObserver* observer); | 341 void RemoveObserver(RenderFrameObserver* observer); |
327 | 342 |
| 343 // IPC message handlers ------------------------------------------------------ |
| 344 // |
| 345 // The documentation for these functions should be in |
| 346 // content/common/*_messages.h for the message that the function is handling. |
| 347 |
| 348 void OnSwapOut(); |
| 349 |
| 350 // TODO(creis): Make sure that WebFrame won't be deleted before we are. |
| 351 // We need a sane way to act on our WebFrame when IPC messages are received. |
| 352 // Currently, we expect set_web_frame to be called shortly after creation. |
| 353 blink::WebFrame* frame_; |
| 354 |
328 RenderViewImpl* render_view_; | 355 RenderViewImpl* render_view_; |
329 int routing_id_; | 356 int routing_id_; |
330 bool is_swapped_out_; | 357 bool is_swapped_out_; |
331 bool is_detaching_; | 358 bool is_detaching_; |
332 | 359 |
333 #if defined(ENABLE_PLUGINS) | 360 #if defined(ENABLE_PLUGINS) |
334 typedef std::set<PepperPluginInstanceImpl*> PepperPluginSet; | 361 typedef std::set<PepperPluginInstanceImpl*> PepperPluginSet; |
335 PepperPluginSet active_pepper_instances_; | 362 PepperPluginSet active_pepper_instances_; |
336 | 363 |
337 // Current text input composition text. Empty if no composition is in | 364 // Current text input composition text. Empty if no composition is in |
338 // progress. | 365 // progress. |
339 base::string16 pepper_composition_text_; | 366 base::string16 pepper_composition_text_; |
340 #endif | 367 #endif |
341 | 368 |
342 // All the registered observers. | 369 // All the registered observers. |
343 ObserverList<RenderFrameObserver> observers_; | 370 ObserverList<RenderFrameObserver> observers_; |
344 | 371 |
345 DISALLOW_COPY_AND_ASSIGN(RenderFrameImpl); | 372 DISALLOW_COPY_AND_ASSIGN(RenderFrameImpl); |
346 }; | 373 }; |
347 | 374 |
348 } // namespace content | 375 } // namespace content |
349 | 376 |
350 #endif // CONTENT_RENDERER_RENDER_FRAME_IMPL_H_ | 377 #endif // CONTENT_RENDERER_RENDER_FRAME_IMPL_H_ |
OLD | NEW |