Add ICU message format support
[chromium-blink-merge.git] / content / browser / frame_host / cross_process_frame_connector.h
blobaa5b35a708909b9edaab220d94a50957046b65e9
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.
5 #ifndef CONTENT_BROWSER_FRAME_HOST_CROSS_PROCESS_FRAME_CONNECTOR_H_
6 #define CONTENT_BROWSER_FRAME_HOST_CROSS_PROCESS_FRAME_CONNECTOR_H_
8 #include "cc/output/compositor_frame.h"
9 #include "content/common/content_export.h"
10 #include "ui/gfx/geometry/rect.h"
12 namespace blink {
13 class WebInputEvent;
14 struct WebScreenInfo;
17 namespace cc {
18 struct SurfaceId;
19 struct SurfaceSequence;
22 namespace IPC {
23 class Message;
26 struct FrameHostMsg_CompositorFrameSwappedACK_Params;
27 struct FrameHostMsg_ReclaimCompositorResources_Params;
29 namespace content {
30 class RenderFrameProxyHost;
31 class RenderWidgetHostImpl;
32 class RenderWidgetHostViewChildFrame;
34 // CrossProcessFrameConnector provides the platform view abstraction for
35 // RenderWidgetHostViewChildFrame allowing RWHVChildFrame to remain ignorant
36 // of RenderFrameHost.
38 // The RenderWidgetHostView of an out-of-process child frame needs to
39 // communicate with the RenderFrameProxyHost representing this frame in the
40 // process of the parent frame. For example, assume you have this page:
42 // -----------------
43 // | frame 1 |
44 // | ----------- |
45 // | | frame 2 | |
46 // | ----------- |
47 // -----------------
49 // If frames 1 and 2 are in process A and B, there are 4 RenderFrameHosts:
50 // A1 - RFH for frame 1 in process A
51 // B1 - RFPH for frame 1 in process B
52 // A2 - RFPH for frame 2 in process A
53 // B2 - RFH for frame 2 in process B
55 // B2, having a parent frame in a different process, will have a
56 // RenderWidgetHostViewChildFrame. This RenderWidgetHostViewChildFrame needs
57 // to communicate with A2 because the embedding process is an abstract
58 // for the child frame -- it needs information necessary for compositing child
59 // frame textures, and also can pass platform messages such as view resizing.
60 // CrossProcessFrameConnector bridges between B2's
61 // RenderWidgetHostViewChildFrame and A2 to allow for this communication.
62 // (Note: B1 is only mentioned for completeness. It is not needed in this
63 // example.)
65 // CrossProcessFrameConnector objects are owned by the RenderFrameProxyHost
66 // in the child frame's RenderFrameHostManager corresponding to the parent's
67 // SiteInstance, A2 in the picture above. When a child frame navigates in a new
68 // process, set_view() is called to update to the new view.
70 class CONTENT_EXPORT CrossProcessFrameConnector {
71 public:
72 // |frame_proxy_in_parent_renderer| corresponds to A2 in the example above.
73 explicit CrossProcessFrameConnector(
74 RenderFrameProxyHost* frame_proxy_in_parent_renderer);
75 virtual ~CrossProcessFrameConnector();
77 bool OnMessageReceived(const IPC::Message &msg);
79 // |view| corresponds to B2's RenderWidgetHostViewChildFrame in the example
80 // above.
81 void set_view(RenderWidgetHostViewChildFrame* view);
82 RenderWidgetHostViewChildFrame* get_view_for_testing() { return view_; }
84 void RenderProcessGone();
86 virtual void ChildFrameCompositorFrameSwapped(
87 uint32 output_surface_id,
88 int host_id,
89 int route_id,
90 scoped_ptr<cc::CompositorFrame> frame);
91 virtual void SetChildFrameSurface(const cc::SurfaceId& surface_id,
92 const gfx::Size& frame_size,
93 float scale_factor,
94 const cc::SurfaceSequence& sequence);
96 gfx::Rect ChildFrameRect();
97 void GetScreenInfo(blink::WebScreenInfo* results);
99 private:
100 // Handlers for messages received from the parent frame.
101 void OnCompositorFrameSwappedACK(
102 const FrameHostMsg_CompositorFrameSwappedACK_Params& params);
103 void OnReclaimCompositorResources(
104 const FrameHostMsg_ReclaimCompositorResources_Params& params);
105 void OnForwardInputEvent(const blink::WebInputEvent* event);
106 void OnInitializeChildFrame(gfx::Rect frame_rect, float scale_factor);
107 void OnSatisfySequence(const cc::SurfaceSequence& sequence);
108 void OnRequireSequence(const cc::SurfaceId& id,
109 const cc::SurfaceSequence& sequence);
111 void SetDeviceScaleFactor(float scale_factor);
112 void SetSize(gfx::Rect frame_rect);
114 // The RenderFrameProxyHost that routes messages to the parent frame's
115 // renderer process.
116 RenderFrameProxyHost* frame_proxy_in_parent_renderer_;
118 // The RenderWidgetHostView for the frame. Initially NULL.
119 RenderWidgetHostViewChildFrame* view_;
121 gfx::Rect child_frame_rect_;
122 float device_scale_factor_;
125 } // namespace content
127 #endif // CONTENT_BROWSER_FRAME_HOST_CROSS_PROCESS_FRAME_CONNECTOR_H_