OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_RENDERER_RENDER_FRAME_PROXY_H_ |
| 6 #define CONTENT_RENDERER_RENDER_FRAME_PROXY_H_ |
| 7 |
| 8 #include "base/basictypes.h" |
| 9 #include "content/common/content_export.h" |
| 10 #include "ipc/ipc_listener.h" |
| 11 #include "ipc/ipc_sender.h" |
| 12 |
| 13 #include "third_party/WebKit/public/web/WebFrameClient.h" |
| 14 #include "third_party/WebKit/public/web/WebRemoteFrame.h" |
| 15 |
| 16 namespace content { |
| 17 |
| 18 class RenderFrameImpl; |
| 19 class RenderViewImpl; |
| 20 |
| 21 // When a page's frames are rendered by multiple processes, each renderer has a |
| 22 // full copy of the frame tree. It has full RenderFrames for the frames it is |
| 23 // responsible for rendering and placeholder objects for frames rendered by |
| 24 // other processes. This class is the renderer-side object for the placeholder. |
| 25 // RenderFrameProxy allows us to keep existing window references valid over |
| 26 // cross-process navigations and route cross-site asynchronous JavaScript calls, |
| 27 // such as postMessage. |
| 28 // |
| 29 // For now, RenderFrameProxy is created when RenderFrame is swapped out. It |
| 30 // acts as a wrapper and is used for sending and receiving IPC messages. It is |
| 31 // deleted when the RenderFrame is swapped back in or the node of the frame |
| 32 // tree is deleted. |
| 33 // |
| 34 // Long term, RenderFrameProxy will be created to replace the RenderFrame in the |
| 35 // frame tree and the RenderFrame will be deleted after its unload handler has |
| 36 // finished executing. It will still be responsible for routing IPC messages |
| 37 // which are valid for cross-site interactions between frames. |
| 38 // RenderFrameProxy will be deleted when the node in the frame tree is deleted |
| 39 // or when navigating the frame causes it to return to this process and a new |
| 40 // RenderFrame is created for it. |
| 41 class CONTENT_EXPORT RenderFrameProxy |
| 42 : public IPC::Listener, |
| 43 public IPC::Sender, |
| 44 NON_EXPORTED_BASE(public blink::WebFrameClient) { |
| 45 public: |
| 46 static RenderFrameProxy* CreateFrameProxy(int routing_id, |
| 47 int frame_routing_id); |
| 48 |
| 49 // Returns the RenderFrameProxy for the given routing ID. |
| 50 static RenderFrameProxy* FromRoutingID(int routing_id); |
| 51 |
| 52 virtual ~RenderFrameProxy(); |
| 53 |
| 54 // IPC::Sender |
| 55 virtual bool Send(IPC::Message* msg) OVERRIDE; |
| 56 |
| 57 RenderFrameImpl* render_frame() { |
| 58 return render_frame_; |
| 59 } |
| 60 |
| 61 private: |
| 62 RenderFrameProxy(int routing_id, int frame_routing_id); |
| 63 |
| 64 // IPC::Listener |
| 65 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; |
| 66 |
| 67 // IPC handlers |
| 68 void OnDeleteProxy(); |
| 69 |
| 70 int routing_id_; |
| 71 int frame_routing_id_; |
| 72 RenderFrameImpl* render_frame_; |
| 73 |
| 74 DISALLOW_COPY_AND_ASSIGN(RenderFrameProxy); |
| 75 }; |
| 76 |
| 77 } // namespace |
| 78 |
| 79 #endif // CONTENT_RENDERER_RENDER_FRAME_PROXY_H_ |
OLD | NEW |