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 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
13 #include "base/observer_list.h" | |
13 #include "base/process/process_handle.h" | 14 #include "base/process/process_handle.h" |
14 #include "base/strings/string16.h" | 15 #include "base/strings/string16.h" |
15 #include "content/public/renderer/render_frame.h" | 16 #include "content/public/renderer/render_frame.h" |
16 #include "ipc/ipc_message.h" | 17 #include "ipc/ipc_message.h" |
17 #include "third_party/WebKit/public/web/WebDataSource.h" | 18 #include "third_party/WebKit/public/web/WebDataSource.h" |
18 #include "third_party/WebKit/public/web/WebFrameClient.h" | 19 #include "third_party/WebKit/public/web/WebFrameClient.h" |
19 | 20 |
20 class TransportDIB; | 21 class TransportDIB; |
21 | 22 |
22 namespace blink { | 23 namespace blink { |
23 class WebMouseEvent; | 24 class WebMouseEvent; |
24 struct WebCompositionUnderline; | 25 struct WebCompositionUnderline; |
25 struct WebCursorInfo; | 26 struct WebCursorInfo; |
26 } | 27 } |
27 | 28 |
28 namespace gfx { | 29 namespace gfx { |
29 class Range; | 30 class Range; |
30 class Rect; | 31 class Rect; |
31 } | 32 } |
32 | 33 |
33 namespace content { | 34 namespace content { |
34 | 35 |
35 class PepperPluginInstanceImpl; | 36 class PepperPluginInstanceImpl; |
36 class RendererPpapiHost; | 37 class RendererPpapiHost; |
38 class RenderFrameObserver; | |
37 class RenderViewImpl; | 39 class RenderViewImpl; |
38 class RenderWidget; | 40 class RenderWidget; |
39 class RenderWidgetFullscreenPepper; | 41 class RenderWidgetFullscreenPepper; |
40 | 42 |
41 class CONTENT_EXPORT RenderFrameImpl | 43 class CONTENT_EXPORT RenderFrameImpl |
42 : public RenderFrame, | 44 : public RenderFrame, |
43 NON_EXPORTED_BASE(public blink::WebFrameClient) { | 45 NON_EXPORTED_BASE(public blink::WebFrameClient) { |
44 public: | 46 public: |
45 // 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 |
46 // frame belongs to. | 48 // frame belongs to. |
47 static RenderFrameImpl* Create(RenderViewImpl* render_view, int32 routing_id); | 49 static RenderFrameImpl* Create(RenderViewImpl* render_view, int32 routing_id); |
48 | 50 |
49 // Used by content_layouttest_support to hook into the creation of | 51 // Used by content_layouttest_support to hook into the creation of |
50 // RenderFrameImpls. | 52 // RenderFrameImpls. |
51 static void InstallCreateHook( | 53 static void InstallCreateHook( |
52 RenderFrameImpl* (*create_render_frame_impl)(RenderViewImpl*, int32)); | 54 RenderFrameImpl* (*create_render_frame_impl)(RenderViewImpl*, int32)); |
53 | 55 |
54 virtual ~RenderFrameImpl(); | 56 virtual ~RenderFrameImpl(); |
55 | 57 |
56 // TODO(jam): this is a temporary getter until all the code is transitioned | 58 // TODO(jam): this is a temporary getter until all the code is transitioned |
57 // to using RenderFrame instead of RenderView. | 59 // to using RenderFrame instead of RenderView. |
58 RenderViewImpl* render_view() { return render_view_; } | 60 RenderViewImpl* render_view() { return render_view_; } |
59 | 61 |
62 int routing_id() const { return routing_id_; } | |
nasko
2013/12/03 00:07:33
nit: Why not keep the GetRoutingID() naming, which
jam
2013/12/03 00:14:31
just because in general we have unix_hacker access
| |
63 | |
60 // Returns the RenderWidget associated with this frame. | 64 // Returns the RenderWidget associated with this frame. |
61 RenderWidget* GetRenderWidget(); | 65 RenderWidget* GetRenderWidget(); |
62 | 66 |
63 #if defined(ENABLE_PLUGINS) | 67 #if defined(ENABLE_PLUGINS) |
64 // Indicates that the given instance has been created. | 68 // Indicates that the given instance has been created. |
65 void PepperInstanceCreated(PepperPluginInstanceImpl* instance); | 69 void PepperInstanceCreated(PepperPluginInstanceImpl* instance); |
66 | 70 |
67 // Indicates that the given instance is being destroyed. This is called from | 71 // Indicates that the given instance is being destroyed. This is called from |
68 // the destructor, so it's important that the instance is not dereferenced | 72 // the destructor, so it's important that the instance is not dereferenced |
69 // from this call. | 73 // from this call. |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
294 const blink::WebURL& url); | 298 const blink::WebURL& url); |
295 virtual blink::WebString doNotTrackValue(blink::WebFrame* frame); | 299 virtual blink::WebString doNotTrackValue(blink::WebFrame* frame); |
296 virtual bool allowWebGL(blink::WebFrame* frame, bool default_value); | 300 virtual bool allowWebGL(blink::WebFrame* frame, bool default_value); |
297 virtual void didLoseWebGLContext(blink::WebFrame* frame, | 301 virtual void didLoseWebGLContext(blink::WebFrame* frame, |
298 int arb_robustness_status_code); | 302 int arb_robustness_status_code); |
299 | 303 |
300 protected: | 304 protected: |
301 RenderFrameImpl(RenderViewImpl* render_view, int32 routing_id); | 305 RenderFrameImpl(RenderViewImpl* render_view, int32 routing_id); |
302 | 306 |
303 private: | 307 private: |
304 int GetRoutingID() const; | 308 friend class RenderFrameObserver; |
309 | |
310 // Functions to add and remove observers for this object. | |
311 void AddObserver(RenderFrameObserver* observer); | |
312 void RemoveObserver(RenderFrameObserver* observer); | |
305 | 313 |
306 RenderViewImpl* render_view_; | 314 RenderViewImpl* render_view_; |
307 int routing_id_; | 315 int routing_id_; |
308 bool is_swapped_out_; | 316 bool is_swapped_out_; |
309 bool is_detaching_; | 317 bool is_detaching_; |
310 | 318 |
311 #if defined(ENABLE_PLUGINS) | 319 #if defined(ENABLE_PLUGINS) |
312 typedef std::set<PepperPluginInstanceImpl*> PepperPluginSet; | 320 typedef std::set<PepperPluginInstanceImpl*> PepperPluginSet; |
313 PepperPluginSet active_pepper_instances_; | 321 PepperPluginSet active_pepper_instances_; |
314 | 322 |
315 // Whether or not the focus is on a PPAPI plugin | 323 // Whether or not the focus is on a PPAPI plugin |
316 PepperPluginInstanceImpl* focused_pepper_plugin_; | 324 PepperPluginInstanceImpl* focused_pepper_plugin_; |
317 | 325 |
318 // Current text input composition text. Empty if no composition is in | 326 // Current text input composition text. Empty if no composition is in |
319 // progress. | 327 // progress. |
320 string16 pepper_composition_text_; | 328 string16 pepper_composition_text_; |
321 | 329 |
322 // The plugin instance that received the last mouse event. It is set to NULL | 330 // The plugin instance that received the last mouse event. It is set to NULL |
323 // if the last mouse event went to elements other than Pepper plugins. | 331 // if the last mouse event went to elements other than Pepper plugins. |
324 // |pepper_last_mouse_event_target_| is not owned by this class. We can know | 332 // |pepper_last_mouse_event_target_| is not owned by this class. We can know |
325 // about when it is destroyed via InstanceDeleted(). | 333 // about when it is destroyed via InstanceDeleted(). |
326 PepperPluginInstanceImpl* pepper_last_mouse_event_target_; | 334 PepperPluginInstanceImpl* pepper_last_mouse_event_target_; |
327 #endif | 335 #endif |
328 | 336 |
337 // All the registered observers. | |
338 ObserverList<RenderFrameObserver> observers_; | |
339 | |
329 DISALLOW_COPY_AND_ASSIGN(RenderFrameImpl); | 340 DISALLOW_COPY_AND_ASSIGN(RenderFrameImpl); |
330 }; | 341 }; |
331 | 342 |
332 } // namespace content | 343 } // namespace content |
333 | 344 |
334 #endif // CONTENT_RENDERER_RENDER_FRAME_IMPL_H_ | 345 #endif // CONTENT_RENDERER_RENDER_FRAME_IMPL_H_ |
OLD | NEW |