| OLD | NEW |
| 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 device_scale_factor_(1) { |
| 22 LOG(ERROR) << "CPFC::CPFC[" << this << "]:" |
| 23 << " rfh:" << frame_proxy_in_parent_renderer; |
| 24 |
| 22 frame_proxy_in_parent_renderer->set_cross_process_frame_connector(this); | 25 frame_proxy_in_parent_renderer->set_cross_process_frame_connector(this); |
| 23 } | 26 } |
| 24 | 27 |
| 25 CrossProcessFrameConnector::~CrossProcessFrameConnector() { | 28 CrossProcessFrameConnector::~CrossProcessFrameConnector() { |
| 26 if (view_) | 29 if (view_) |
| 27 view_->set_cross_process_frame_connector(NULL); | 30 view_->set_cross_process_frame_connector(NULL); |
| 28 } | 31 } |
| 29 | 32 |
| 30 bool CrossProcessFrameConnector::OnMessageReceived(const IPC::Message& msg) { | 33 bool CrossProcessFrameConnector::OnMessageReceived(const IPC::Message& msg) { |
| 31 bool handled = true; | 34 bool handled = true; |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 void CrossProcessFrameConnector::OnReclaimCompositorResources( | 120 void CrossProcessFrameConnector::OnReclaimCompositorResources( |
| 118 const FrameHostMsg_ReclaimCompositorResources_Params& params) { | 121 const FrameHostMsg_ReclaimCompositorResources_Params& params) { |
| 119 RenderWidgetHostImpl::SendReclaimCompositorResources(params.route_id, | 122 RenderWidgetHostImpl::SendReclaimCompositorResources(params.route_id, |
| 120 params.output_surface_id, | 123 params.output_surface_id, |
| 121 params.renderer_host_id, | 124 params.renderer_host_id, |
| 122 params.ack); | 125 params.ack); |
| 123 } | 126 } |
| 124 | 127 |
| 125 void CrossProcessFrameConnector::OnInitializeChildFrame(gfx::Rect frame_rect, | 128 void CrossProcessFrameConnector::OnInitializeChildFrame(gfx::Rect frame_rect, |
| 126 float scale_factor) { | 129 float scale_factor) { |
| 130 LOG(ERROR) << "CPFC::OnInitializeChildFrame[" << this << "]"; |
| 127 if (scale_factor != device_scale_factor_) { | 131 if (scale_factor != device_scale_factor_) { |
| 128 device_scale_factor_ = scale_factor; | 132 device_scale_factor_ = scale_factor; |
| 129 if (view_) { | 133 if (view_) { |
| 130 RenderWidgetHostImpl* child_widget = | 134 RenderWidgetHostImpl* child_widget = |
| 131 RenderWidgetHostImpl::From(view_->GetRenderWidgetHost()); | 135 RenderWidgetHostImpl::From(view_->GetRenderWidgetHost()); |
| 132 child_widget->NotifyScreenInfoChanged(); | 136 child_widget->NotifyScreenInfoChanged(); |
| 137 LOG(ERROR) << "CPFC::OnInitializeChildFrame[" << this << "]: notify"; |
| 133 } | 138 } |
| 134 } | 139 } |
| 135 | 140 |
| 136 if (!frame_rect.size().IsEmpty()) { | 141 if (!frame_rect.size().IsEmpty()) { |
| 137 child_frame_rect_ = frame_rect; | 142 child_frame_rect_ = frame_rect; |
| 138 if (view_) | 143 if (view_) { |
| 139 view_->SetSize(frame_rect.size()); | 144 view_->SetSize(frame_rect.size()); |
| 145 LOG(ERROR) << "CPFC::OnInitializeChildFrame[" << this << "]: set size"; |
| 146 } |
| 140 } | 147 } |
| 141 } | 148 } |
| 142 | 149 |
| 143 gfx::Rect CrossProcessFrameConnector::ChildFrameRect() { | 150 gfx::Rect CrossProcessFrameConnector::ChildFrameRect() { |
| 144 return child_frame_rect_; | 151 return child_frame_rect_; |
| 145 } | 152 } |
| 146 | 153 |
| 147 void CrossProcessFrameConnector::OnForwardInputEvent( | 154 void CrossProcessFrameConnector::OnForwardInputEvent( |
| 148 const blink::WebInputEvent* event) { | 155 const blink::WebInputEvent* event) { |
| 156 LOG(ERROR) << "CPFC::OnForwardInputEvent[" << this << "]: " << view_; |
| 149 if (!view_) | 157 if (!view_) |
| 150 return; | 158 return; |
| 151 | 159 |
| 152 RenderWidgetHostImpl* child_widget = | 160 RenderWidgetHostImpl* child_widget = |
| 153 RenderWidgetHostImpl::From(view_->GetRenderWidgetHost()); | 161 RenderWidgetHostImpl::From(view_->GetRenderWidgetHost()); |
| 154 RenderWidgetHostImpl* parent_widget = | 162 RenderWidgetHostImpl* parent_widget = |
| 155 frame_proxy_in_parent_renderer_->render_view_host(); | 163 frame_proxy_in_parent_renderer_->render_view_host(); |
| 156 | 164 |
| 157 if (blink::WebInputEvent::isKeyboardEventType(event->type)) { | 165 if (blink::WebInputEvent::isKeyboardEventType(event->type)) { |
| 158 if (!parent_widget->GetLastKeyboardEvent()) | 166 if (!parent_widget->GetLastKeyboardEvent()) |
| 159 return; | 167 return; |
| 160 NativeWebKeyboardEvent keyboard_event( | 168 NativeWebKeyboardEvent keyboard_event( |
| 161 *parent_widget->GetLastKeyboardEvent()); | 169 *parent_widget->GetLastKeyboardEvent()); |
| 162 child_widget->ForwardKeyboardEvent(keyboard_event); | 170 child_widget->ForwardKeyboardEvent(keyboard_event); |
| 171 LOG(ERROR) << "CPFC::OnForwardInputEvent[" << this << "]: kbd"; |
| 163 return; | 172 return; |
| 164 } | 173 } |
| 165 | 174 |
| 166 if (blink::WebInputEvent::isMouseEventType(event->type)) { | 175 if (blink::WebInputEvent::isMouseEventType(event->type)) { |
| 167 child_widget->ForwardMouseEvent( | 176 child_widget->ForwardMouseEvent( |
| 168 *static_cast<const blink::WebMouseEvent*>(event)); | 177 *static_cast<const blink::WebMouseEvent*>(event)); |
| 178 LOG(ERROR) << "CPFC::OnForwardInputEvent[" << this << "]: mouse"; |
| 169 return; | 179 return; |
| 170 } | 180 } |
| 171 | 181 |
| 172 if (event->type == blink::WebInputEvent::MouseWheel) { | 182 if (event->type == blink::WebInputEvent::MouseWheel) { |
| 173 child_widget->ForwardWheelEvent( | 183 child_widget->ForwardWheelEvent( |
| 174 *static_cast<const blink::WebMouseWheelEvent*>(event)); | 184 *static_cast<const blink::WebMouseWheelEvent*>(event)); |
| 185 LOG(ERROR) << "CPFC::OnForwardInputEvent[" << this << "]: wheel"; |
| 175 return; | 186 return; |
| 176 } | 187 } |
| 177 } | 188 } |
| 178 | 189 |
| 179 } // namespace content | 190 } // namespace content |
| OLD | NEW |