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 29 matching lines...) Expand all Loading... |
40 class RenderViewImpl; | 40 class RenderViewImpl; |
41 class RenderWidget; | 41 class RenderWidget; |
42 class RenderWidgetFullscreenPepper; | 42 class RenderWidgetFullscreenPepper; |
43 | 43 |
44 class CONTENT_EXPORT RenderFrameImpl | 44 class CONTENT_EXPORT RenderFrameImpl |
45 : public RenderFrame, | 45 : public RenderFrame, |
46 NON_EXPORTED_BASE(public blink::WebFrameClient) { | 46 NON_EXPORTED_BASE(public blink::WebFrameClient) { |
47 public: | 47 public: |
48 // Creates a new RenderFrame. |render_view| is the RenderView object that this | 48 // Creates a new RenderFrame. |render_view| is the RenderView object that this |
49 // frame belongs to. | 49 // frame belongs to. |
| 50 // Callers *must* call |SetWebFrame| immediately after creation. |
| 51 // TODO(creis): We should structure this so that |SetWebFrame| isn't needed. |
50 static RenderFrameImpl* Create(RenderViewImpl* render_view, int32 routing_id); | 52 static RenderFrameImpl* Create(RenderViewImpl* render_view, int32 routing_id); |
51 | 53 |
| 54 // For subframes, look up the RenderFrameImpl for the given WebFrame. Returns |
| 55 // NULL for main frames. |
| 56 // This only works when using --site-per-process, and returns NULL otherwise. |
| 57 // TODO(creis): Remove this when the RenderView methods dealing with frames |
| 58 // have moved to RenderFrame. |
| 59 static RenderFrameImpl* FindByWebFrame(blink::WebFrame* web_frame); |
| 60 |
52 // Used by content_layouttest_support to hook into the creation of | 61 // Used by content_layouttest_support to hook into the creation of |
53 // RenderFrameImpls. | 62 // RenderFrameImpls. |
54 static void InstallCreateHook( | 63 static void InstallCreateHook( |
55 RenderFrameImpl* (*create_render_frame_impl)(RenderViewImpl*, int32)); | 64 RenderFrameImpl* (*create_render_frame_impl)(RenderViewImpl*, int32)); |
56 | 65 |
57 virtual ~RenderFrameImpl(); | 66 virtual ~RenderFrameImpl(); |
58 | 67 |
| 68 bool is_swapped_out() const { |
| 69 return is_swapped_out_; |
| 70 } |
| 71 |
59 // TODO(jam): this is a temporary getter until all the code is transitioned | 72 // TODO(jam): this is a temporary getter until all the code is transitioned |
60 // to using RenderFrame instead of RenderView. | 73 // to using RenderFrame instead of RenderView. |
61 RenderViewImpl* render_view() { return render_view_; } | 74 RenderViewImpl* render_view() { return render_view_; } |
62 | 75 |
63 RendererWebCookieJarImpl* cookie_jar() { return &cookie_jar_; } | 76 RendererWebCookieJarImpl* cookie_jar() { return &cookie_jar_; } |
64 | 77 |
65 // Returns the RenderWidget associated with this frame. | 78 // Returns the RenderWidget associated with this frame. |
66 RenderWidget* GetRenderWidget(); | 79 RenderWidget* GetRenderWidget(); |
67 | 80 |
68 // Called by RenderView right after creating this object when the | 81 // Called by RenderView right after creating this object when the |
69 // blink::WebFrame has been created. | 82 // blink::WebFrame has been created. |
70 void MainWebFrameCreated(blink::WebFrame* frame); | 83 void MainWebFrameCreated(blink::WebFrame* frame); |
71 | 84 |
| 85 // In --site-per-process mode, we keep track of which WebFrame this |
| 86 // RenderFrameImpl is for. |
| 87 void SetWebFrame(blink::WebFrame* web_frame); |
| 88 |
72 #if defined(ENABLE_PLUGINS) | 89 #if defined(ENABLE_PLUGINS) |
73 // Notification that a PPAPI plugin has been created. | 90 // Notification that a PPAPI plugin has been created. |
74 void PepperPluginCreated(RendererPpapiHost* host); | 91 void PepperPluginCreated(RendererPpapiHost* host); |
75 | 92 |
76 // Indicates that the given instance has been created. | 93 // Indicates that the given instance has been created. |
77 void PepperInstanceCreated(PepperPluginInstanceImpl* instance); | 94 void PepperInstanceCreated(PepperPluginInstanceImpl* instance); |
78 | 95 |
79 // Indicates that the given instance is being destroyed. This is called from | 96 // Indicates that the given instance is being destroyed. This is called from |
80 // the destructor, so it's important that the instance is not dereferenced | 97 // the destructor, so it's important that the instance is not dereferenced |
81 // from this call. | 98 // from this call. |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 protected: | 339 protected: |
323 RenderFrameImpl(RenderViewImpl* render_view, int32 routing_id); | 340 RenderFrameImpl(RenderViewImpl* render_view, int32 routing_id); |
324 | 341 |
325 private: | 342 private: |
326 friend class RenderFrameObserver; | 343 friend class RenderFrameObserver; |
327 | 344 |
328 // Functions to add and remove observers for this object. | 345 // Functions to add and remove observers for this object. |
329 void AddObserver(RenderFrameObserver* observer); | 346 void AddObserver(RenderFrameObserver* observer); |
330 void RemoveObserver(RenderFrameObserver* observer); | 347 void RemoveObserver(RenderFrameObserver* observer); |
331 | 348 |
| 349 // IPC message handlers ------------------------------------------------------ |
| 350 // |
| 351 // The documentation for these functions should be in |
| 352 // content/common/*_messages.h for the message that the function is handling. |
| 353 void OnSwapOut(); |
| 354 |
| 355 // In --site-per-process mode, stores the WebFrame we are associated with. |
| 356 // NULL otherwise. |
| 357 blink::WebFrame* frame_; |
| 358 |
332 RenderViewImpl* render_view_; | 359 RenderViewImpl* render_view_; |
333 int routing_id_; | 360 int routing_id_; |
334 bool is_swapped_out_; | 361 bool is_swapped_out_; |
335 bool is_detaching_; | 362 bool is_detaching_; |
336 | 363 |
337 #if defined(ENABLE_PLUGINS) | 364 #if defined(ENABLE_PLUGINS) |
338 typedef std::set<PepperPluginInstanceImpl*> PepperPluginSet; | 365 typedef std::set<PepperPluginInstanceImpl*> PepperPluginSet; |
339 PepperPluginSet active_pepper_instances_; | 366 PepperPluginSet active_pepper_instances_; |
340 | 367 |
341 // Current text input composition text. Empty if no composition is in | 368 // Current text input composition text. Empty if no composition is in |
342 // progress. | 369 // progress. |
343 base::string16 pepper_composition_text_; | 370 base::string16 pepper_composition_text_; |
344 #endif | 371 #endif |
345 | 372 |
346 RendererWebCookieJarImpl cookie_jar_; | 373 RendererWebCookieJarImpl cookie_jar_; |
347 | 374 |
348 // All the registered observers. | 375 // All the registered observers. |
349 ObserverList<RenderFrameObserver> observers_; | 376 ObserverList<RenderFrameObserver> observers_; |
350 | 377 |
351 DISALLOW_COPY_AND_ASSIGN(RenderFrameImpl); | 378 DISALLOW_COPY_AND_ASSIGN(RenderFrameImpl); |
352 }; | 379 }; |
353 | 380 |
354 } // namespace content | 381 } // namespace content |
355 | 382 |
356 #endif // CONTENT_RENDERER_RENDER_FRAME_IMPL_H_ | 383 #endif // CONTENT_RENDERER_RENDER_FRAME_IMPL_H_ |
OLD | NEW |