| 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 "cc/surfaces/surface.h" | 7 #include "cc/surfaces/surface.h" |
| 8 #include "cc/surfaces/surface_manager.h" | 8 #include "cc/surfaces/surface_manager.h" |
| 9 #include "content/browser/compositor/surface_utils.h" | 9 #include "content/browser/compositor/surface_utils.h" |
| 10 #include "content/browser/frame_host/frame_tree.h" | 10 #include "content/browser/frame_host/frame_tree.h" |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 const gfx::Point& point, | 142 const gfx::Point& point, |
| 143 cc::SurfaceId surface_id) { | 143 cc::SurfaceId surface_id) { |
| 144 gfx::Point transformed_point = point; | 144 gfx::Point transformed_point = point; |
| 145 RenderWidgetHostViewBase* root_view = GetRootRenderWidgetHostView(); | 145 RenderWidgetHostViewBase* root_view = GetRootRenderWidgetHostView(); |
| 146 if (root_view) | 146 if (root_view) |
| 147 root_view->TransformPointToLocalCoordSpace(point, surface_id, | 147 root_view->TransformPointToLocalCoordSpace(point, surface_id, |
| 148 &transformed_point); | 148 &transformed_point); |
| 149 return transformed_point; | 149 return transformed_point; |
| 150 } | 150 } |
| 151 | 151 |
| 152 void CrossProcessFrameConnector::ForwardProcessAckedTouchEvent( |
| 153 const TouchEventWithLatencyInfo& touch, |
| 154 InputEventAckState ack_result) { |
| 155 auto main_view = GetRootRenderWidgetHostView(); |
| 156 if (main_view) |
| 157 main_view->ProcessAckedTouchEvent(touch, ack_result); |
| 158 } |
| 159 |
| 152 bool CrossProcessFrameConnector::HasFocus() { | 160 bool CrossProcessFrameConnector::HasFocus() { |
| 153 RenderWidgetHostViewBase* root_view = GetRootRenderWidgetHostView(); | 161 RenderWidgetHostViewBase* root_view = GetRootRenderWidgetHostView(); |
| 154 if (root_view) | 162 if (root_view) |
| 155 return root_view->HasFocus(); | 163 return root_view->HasFocus(); |
| 156 return false; | 164 return false; |
| 157 } | 165 } |
| 158 | 166 |
| 167 void CrossProcessFrameConnector::FocusRootView() { |
| 168 RenderWidgetHostViewBase* root_view = GetRootRenderWidgetHostView(); |
| 169 if (root_view) |
| 170 root_view->Focus(); |
| 171 } |
| 172 |
| 159 void CrossProcessFrameConnector::OnForwardInputEvent( | 173 void CrossProcessFrameConnector::OnForwardInputEvent( |
| 160 const blink::WebInputEvent* event) { | 174 const blink::WebInputEvent* event) { |
| 161 if (!view_) | 175 if (!view_) |
| 162 return; | 176 return; |
| 163 | 177 |
| 164 RenderFrameHostManager* manager = | 178 RenderFrameHostManager* manager = |
| 165 frame_proxy_in_parent_renderer_->frame_tree_node()->render_manager(); | 179 frame_proxy_in_parent_renderer_->frame_tree_node()->render_manager(); |
| 166 RenderWidgetHostImpl* parent_widget = | 180 RenderWidgetHostImpl* parent_widget = |
| 167 manager->ForInnerDelegate() | 181 manager->ForInnerDelegate() |
| 168 ? manager->GetOuterRenderWidgetHostForKeyboardInput() | 182 ? manager->GetOuterRenderWidgetHostForKeyboardInput() |
| 169 : frame_proxy_in_parent_renderer_->GetRenderViewHost()->GetWidget(); | 183 : frame_proxy_in_parent_renderer_->GetRenderViewHost()->GetWidget(); |
| 170 | 184 |
| 185 // TODO(wjmaclean): We should remove these forwarding functions, since they |
| 186 // are directly target using RenderWidgetHostInputEventRouter. But neither |
| 187 // pathway is currently handling gesture events, so that needs to be fixed |
| 188 // in a subsequent CL. |
| 171 if (blink::WebInputEvent::isKeyboardEventType(event->type)) { | 189 if (blink::WebInputEvent::isKeyboardEventType(event->type)) { |
| 172 if (!parent_widget->GetLastKeyboardEvent()) | 190 if (!parent_widget->GetLastKeyboardEvent()) |
| 173 return; | 191 return; |
| 174 NativeWebKeyboardEvent keyboard_event( | 192 NativeWebKeyboardEvent keyboard_event( |
| 175 *parent_widget->GetLastKeyboardEvent()); | 193 *parent_widget->GetLastKeyboardEvent()); |
| 176 view_->ProcessKeyboardEvent(keyboard_event); | 194 view_->ProcessKeyboardEvent(keyboard_event); |
| 177 return; | 195 return; |
| 178 } | 196 } |
| 179 | 197 |
| 180 if (blink::WebInputEvent::isMouseEventType(event->type)) { | 198 if (blink::WebInputEvent::isMouseEventType(event->type)) { |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 | 284 |
| 267 if (parent) { | 285 if (parent) { |
| 268 return static_cast<RenderWidgetHostViewBase*>( | 286 return static_cast<RenderWidgetHostViewBase*>( |
| 269 parent->current_frame_host()->GetView()); | 287 parent->current_frame_host()->GetView()); |
| 270 } | 288 } |
| 271 | 289 |
| 272 return nullptr; | 290 return nullptr; |
| 273 } | 291 } |
| 274 | 292 |
| 275 } // namespace content | 293 } // namespace content |
| OLD | NEW |