Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1266)

Side by Side Diff: content/browser/frame_host/cross_process_frame_connector.cc

Issue 132383005: Set correct viewport size for an out of process iframe. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed obsolete test Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 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 #include "content/browser/frame_host/cross_process_frame_connector.h" 5 #include "content/browser/frame_host/cross_process_frame_connector.h"
6 6
7 #include "content/browser/frame_host/render_frame_host_impl.h" 7 #include "content/browser/frame_host/render_frame_host_impl.h"
8 #include "content/browser/frame_host/render_widget_host_view_child_frame.h" 8 #include "content/browser/frame_host/render_widget_host_view_child_frame.h"
9 #include "content/browser/renderer_host/render_view_host_impl.h" 9 #include "content/browser/renderer_host/render_view_host_impl.h"
10 #include "content/browser/renderer_host/render_widget_host_impl.h" 10 #include "content/browser/renderer_host/render_widget_host_impl.h"
11 #include "content/common/frame_messages.h" 11 #include "content/common/frame_messages.h"
12 #include "content/common/gpu/gpu_messages.h" 12 #include "content/common/gpu/gpu_messages.h"
13 #include "third_party/WebKit/public/web/WebInputEvent.h" 13 #include "third_party/WebKit/public/web/WebInputEvent.h"
14 14
15 namespace content { 15 namespace content {
16 16
17 CrossProcessFrameConnector::CrossProcessFrameConnector( 17 CrossProcessFrameConnector::CrossProcessFrameConnector(
18 RenderFrameHostImpl* frame_proxy_in_parent_renderer) 18 RenderFrameHostImpl* frame_proxy_in_parent_renderer)
19 : frame_proxy_in_parent_renderer_(frame_proxy_in_parent_renderer), 19 : frame_proxy_in_parent_renderer_(frame_proxy_in_parent_renderer),
20 view_(NULL) { 20 view_(NULL),
21 device_scale_factor_(1) {
21 frame_proxy_in_parent_renderer->set_cross_process_frame_connector(this); 22 frame_proxy_in_parent_renderer->set_cross_process_frame_connector(this);
22 } 23 }
23 24
24 CrossProcessFrameConnector::~CrossProcessFrameConnector() { 25 CrossProcessFrameConnector::~CrossProcessFrameConnector() {
25 if (view_) 26 if (view_)
26 view_->set_cross_process_frame_connector(NULL); 27 view_->set_cross_process_frame_connector(NULL);
27 } 28 }
28 29
29 bool CrossProcessFrameConnector::OnMessageReceived(const IPC::Message& msg) { 30 bool CrossProcessFrameConnector::OnMessageReceived(const IPC::Message& msg) {
30 bool handled = true; 31 bool handled = true;
31 bool msg_is_ok = true; 32 bool msg_is_ok = true;
32 33
33 IPC_BEGIN_MESSAGE_MAP_EX(CrossProcessFrameConnector, msg, msg_is_ok) 34 IPC_BEGIN_MESSAGE_MAP_EX(CrossProcessFrameConnector, msg, msg_is_ok)
34 IPC_MESSAGE_HANDLER(FrameHostMsg_BuffersSwappedACK, OnBuffersSwappedACK) 35 IPC_MESSAGE_HANDLER(FrameHostMsg_BuffersSwappedACK, OnBuffersSwappedACK)
35 IPC_MESSAGE_HANDLER(FrameHostMsg_CompositorFrameSwappedACK, 36 IPC_MESSAGE_HANDLER(FrameHostMsg_CompositorFrameSwappedACK,
36 OnCompositorFrameSwappedACK) 37 OnCompositorFrameSwappedACK)
37 IPC_MESSAGE_HANDLER(FrameHostMsg_ReclaimCompositorResources, 38 IPC_MESSAGE_HANDLER(FrameHostMsg_ReclaimCompositorResources,
38 OnReclaimCompositorResources) 39 OnReclaimCompositorResources)
39 IPC_MESSAGE_HANDLER(FrameHostMsg_ForwardInputEvent, OnForwardInputEvent) 40 IPC_MESSAGE_HANDLER(FrameHostMsg_ForwardInputEvent, OnForwardInputEvent)
41 IPC_MESSAGE_HANDLER(FrameHostMsg_InitializeChildFrame,
42 OnInitializeChildFrame)
40 IPC_MESSAGE_UNHANDLED(handled = false) 43 IPC_MESSAGE_UNHANDLED(handled = false)
41 IPC_END_MESSAGE_MAP_EX() 44 IPC_END_MESSAGE_MAP_EX()
42 45
43 return handled; 46 return handled;
44 } 47 }
45 48
46 void CrossProcessFrameConnector::set_view( 49 void CrossProcessFrameConnector::set_view(
47 RenderWidgetHostViewChildFrame* view) { 50 RenderWidgetHostViewChildFrame* view) {
48 // Detach ourselves from the previous |view_|. 51 // Detach ourselves from the previous |view_|.
49 if (view_) 52 if (view_)
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 } 115 }
113 116
114 void CrossProcessFrameConnector::OnReclaimCompositorResources( 117 void CrossProcessFrameConnector::OnReclaimCompositorResources(
115 const FrameHostMsg_ReclaimCompositorResources_Params& params) { 118 const FrameHostMsg_ReclaimCompositorResources_Params& params) {
116 RenderWidgetHostImpl::SendReclaimCompositorResources(params.route_id, 119 RenderWidgetHostImpl::SendReclaimCompositorResources(params.route_id,
117 params.output_surface_id, 120 params.output_surface_id,
118 params.renderer_host_id, 121 params.renderer_host_id,
119 params.ack); 122 params.ack);
120 } 123 }
121 124
125 void CrossProcessFrameConnector::OnInitializeChildFrame(gfx::Rect frame_rect,
126 float scale_factor) {
127 if (scale_factor != device_scale_factor_) {
128 device_scale_factor_ = scale_factor;
129 if (view_) {
130 RenderWidgetHostImpl* child_widget =
131 RenderWidgetHostImpl::From(view_->GetRenderWidgetHost());
132 child_widget->NotifyScreenInfoChanged();
133 }
134 }
135
136 if (!frame_rect.size().IsEmpty()) {
137 child_frame_rect_ = frame_rect;
138 if (view_)
139 view_->SetSize(frame_rect.size());
140 }
141 }
142
122 gfx::Rect CrossProcessFrameConnector::ChildFrameRect() { 143 gfx::Rect CrossProcessFrameConnector::ChildFrameRect() {
123 return child_frame_rect_; 144 return child_frame_rect_;
124 } 145 }
125 146
126 void CrossProcessFrameConnector::OnForwardInputEvent( 147 void CrossProcessFrameConnector::OnForwardInputEvent(
127 const blink::WebInputEvent* event) { 148 const blink::WebInputEvent* event) {
128 if (!view_) 149 if (!view_)
129 return; 150 return;
130 151
131 RenderWidgetHostImpl* child_widget = 152 RenderWidgetHostImpl* child_widget =
(...skipping 17 matching lines...) Expand all
149 } 170 }
150 171
151 if (event->type == blink::WebInputEvent::MouseWheel) { 172 if (event->type == blink::WebInputEvent::MouseWheel) {
152 child_widget->ForwardWheelEvent( 173 child_widget->ForwardWheelEvent(
153 *static_cast<const blink::WebMouseWheelEvent*>(event)); 174 *static_cast<const blink::WebMouseWheelEvent*>(event));
154 return; 175 return;
155 } 176 }
156 } 177 }
157 178
158 } // namespace content 179 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/cross_process_frame_connector.h ('k') | content/browser/frame_host/render_frame_host_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698