| 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 "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "content/public/renderer/render_frame.h" | 9 #include "content/public/renderer/render_frame.h" |
| 10 #include "ipc/ipc_message.h" | 10 #include "ipc/ipc_message.h" |
| 11 #include "third_party/WebKit/public/web/WebDataSource.h" | 11 #include "third_party/WebKit/public/web/WebDataSource.h" |
| 12 #include "third_party/WebKit/public/web/WebFrameClient.h" | 12 #include "third_party/WebKit/public/web/WebFrameClient.h" |
| 13 | 13 |
| 14 namespace content { | 14 namespace content { |
| 15 | 15 |
| 16 class RenderViewImpl; | 16 class RenderViewImpl; |
| 17 | 17 |
| 18 class CONTENT_EXPORT RenderFrameImpl | 18 class CONTENT_EXPORT RenderFrameImpl |
| 19 : public RenderFrame, | 19 : public RenderFrame, |
| 20 NON_EXPORTED_BASE(public blink::WebFrameClient) { | 20 NON_EXPORTED_BASE(public blink::WebFrameClient) { |
| 21 public: | 21 public: |
| 22 // Creates a new RenderFrame. |render_view| is the RenderView object that this | 22 // Creates a new RenderFrame. |render_view| is the RenderView object that this |
| 23 // frame belongs to. | 23 // frame belongs to. |
| 24 // Callers *must* call set_web_frame immediately after creation. |
| 25 // TODO(creis): We should structure this so that set_web_frame isn't needed. |
| 24 static RenderFrameImpl* Create(RenderViewImpl* render_view, int32 routing_id); | 26 static RenderFrameImpl* Create(RenderViewImpl* render_view, int32 routing_id); |
| 25 | 27 |
| 28 // Look up the RenderFrameImpl for the given WebFrame. |
| 29 // TODO(creis): I don't think we need this long term. |
| 30 static RenderFrameImpl* FindByWebFrame(blink::WebFrame* web_frame); |
| 31 |
| 26 // Used by content_layouttest_support to hook into the creation of | 32 // Used by content_layouttest_support to hook into the creation of |
| 27 // RenderFrameImpls. | 33 // RenderFrameImpls. |
| 28 static void InstallCreateHook( | 34 static void InstallCreateHook( |
| 29 RenderFrameImpl* (*create_render_frame_impl)(RenderViewImpl*, int32)); | 35 RenderFrameImpl* (*create_render_frame_impl)(RenderViewImpl*, int32)); |
| 30 | 36 |
| 31 virtual ~RenderFrameImpl(); | 37 virtual ~RenderFrameImpl(); |
| 32 | 38 |
| 39 void set_web_frame(blink::WebFrame* web_frame) { |
| 40 DCHECK(!frame_); |
| 41 frame_ = web_frame; |
| 42 } |
| 43 |
| 44 bool is_swapped_out() const { |
| 45 return is_swapped_out_; |
| 46 } |
| 47 |
| 33 // IPC::Sender | 48 // IPC::Sender |
| 34 virtual bool Send(IPC::Message* msg) OVERRIDE; | 49 virtual bool Send(IPC::Message* msg) OVERRIDE; |
| 35 | 50 |
| 36 // IPC::Listener | 51 // IPC::Listener |
| 37 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; | 52 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; |
| 38 | 53 |
| 39 // blink::WebFrameClient implementation ------------------------------------- | 54 // blink::WebFrameClient implementation ------------------------------------- |
| 40 virtual blink::WebPlugin* createPlugin( | 55 virtual blink::WebPlugin* createPlugin( |
| 41 blink::WebFrame* frame, | 56 blink::WebFrame* frame, |
| 42 const blink::WebPluginParams& params); | 57 const blink::WebPluginParams& params); |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 virtual bool allowWebGL(blink::WebFrame* frame, bool default_value); | 195 virtual bool allowWebGL(blink::WebFrame* frame, bool default_value); |
| 181 virtual void didLoseWebGLContext(blink::WebFrame* frame, | 196 virtual void didLoseWebGLContext(blink::WebFrame* frame, |
| 182 int arb_robustness_status_code); | 197 int arb_robustness_status_code); |
| 183 | 198 |
| 184 protected: | 199 protected: |
| 185 RenderFrameImpl(RenderViewImpl* render_view, int32 routing_id); | 200 RenderFrameImpl(RenderViewImpl* render_view, int32 routing_id); |
| 186 | 201 |
| 187 private: | 202 private: |
| 188 int GetRoutingID() const; | 203 int GetRoutingID() const; |
| 189 | 204 |
| 205 // IPC message handlers ------------------------------------------------------ |
| 206 // |
| 207 // The documentation for these functions should be in |
| 208 // content/common/*_messages.h for the message that the function is handling. |
| 209 |
| 210 void OnSwapOut(); |
| 211 |
| 212 // TODO(creis): Make sure that WebFrame won't be deleted before we are. |
| 213 // We need a sane way to act on our WebFrame when IPC messages are received. |
| 214 // Currently, we expect set_web_frame to be called shortly after creation. |
| 215 blink::WebFrame* frame_; |
| 216 |
| 190 RenderViewImpl* render_view_; | 217 RenderViewImpl* render_view_; |
| 191 int routing_id_; | 218 int routing_id_; |
| 192 bool is_swapped_out_; | 219 bool is_swapped_out_; |
| 193 bool is_detaching_; | 220 bool is_detaching_; |
| 194 | 221 |
| 195 DISALLOW_COPY_AND_ASSIGN(RenderFrameImpl); | 222 DISALLOW_COPY_AND_ASSIGN(RenderFrameImpl); |
| 196 }; | 223 }; |
| 197 | 224 |
| 198 } // namespace content | 225 } // namespace content |
| 199 | 226 |
| 200 #endif // CONTENT_RENDERER_RENDER_FRAME_IMPL_H_ | 227 #endif // CONTENT_RENDERER_RENDER_FRAME_IMPL_H_ |
| OLD | NEW |