| 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   if (auto main_view = GetRootRenderWidgetHostView()) | 
|  | 156     main_view->ProcessAckedTouchEvent(touch, ack_result); | 
|  | 157 } | 
|  | 158 | 
| 152 bool CrossProcessFrameConnector::HasFocus() { | 159 bool CrossProcessFrameConnector::HasFocus() { | 
| 153   RenderWidgetHostViewBase* root_view = GetRootRenderWidgetHostView(); | 160   RenderWidgetHostViewBase* root_view = GetRootRenderWidgetHostView(); | 
| 154   if (root_view) | 161   if (root_view) | 
| 155     return root_view->HasFocus(); | 162     return root_view->HasFocus(); | 
| 156   return false; | 163   return false; | 
| 157 } | 164 } | 
| 158 | 165 | 
|  | 166 void CrossProcessFrameConnector::Focus() { | 
|  | 167   RenderWidgetHostViewBase* root_view = GetRootRenderWidgetHostView(); | 
|  | 168   if (root_view) | 
|  | 169     root_view->Focus(); | 
|  | 170 } | 
|  | 171 | 
| 159 void CrossProcessFrameConnector::OnForwardInputEvent( | 172 void CrossProcessFrameConnector::OnForwardInputEvent( | 
| 160     const blink::WebInputEvent* event) { | 173     const blink::WebInputEvent* event) { | 
| 161   if (!view_) | 174   if (!view_) | 
| 162     return; | 175     return; | 
| 163 | 176 | 
| 164   RenderFrameHostManager* manager = | 177   RenderFrameHostManager* manager = | 
| 165       frame_proxy_in_parent_renderer_->frame_tree_node()->render_manager(); | 178       frame_proxy_in_parent_renderer_->frame_tree_node()->render_manager(); | 
| 166   RenderWidgetHostImpl* parent_widget = | 179   RenderWidgetHostImpl* parent_widget = | 
| 167       manager->ForInnerDelegate() | 180       manager->ForInnerDelegate() | 
| 168           ? manager->GetOuterRenderWidgetHostForKeyboardInput() | 181           ? manager->GetOuterRenderWidgetHostForKeyboardInput() | 
| 169           : frame_proxy_in_parent_renderer_->GetRenderViewHost()->GetWidget(); | 182           : frame_proxy_in_parent_renderer_->GetRenderViewHost()->GetWidget(); | 
| 170 | 183 | 
|  | 184   // TODO(wjmaclean): We should remove these forwarding functions, since they | 
|  | 185   // are directly target using RenderWidgetHostInputEventRouter. But neither | 
|  | 186   // pathway is currently handling gesture events, so that needs to be fixed | 
|  | 187   // in a subsequent CL. | 
| 171   if (blink::WebInputEvent::isKeyboardEventType(event->type)) { | 188   if (blink::WebInputEvent::isKeyboardEventType(event->type)) { | 
| 172     if (!parent_widget->GetLastKeyboardEvent()) | 189     if (!parent_widget->GetLastKeyboardEvent()) | 
| 173       return; | 190       return; | 
| 174     NativeWebKeyboardEvent keyboard_event( | 191     NativeWebKeyboardEvent keyboard_event( | 
| 175         *parent_widget->GetLastKeyboardEvent()); | 192         *parent_widget->GetLastKeyboardEvent()); | 
| 176     view_->ProcessKeyboardEvent(keyboard_event); | 193     view_->ProcessKeyboardEvent(keyboard_event); | 
| 177     return; | 194     return; | 
| 178   } | 195   } | 
| 179 | 196 | 
| 180   if (blink::WebInputEvent::isMouseEventType(event->type)) { | 197   if (blink::WebInputEvent::isMouseEventType(event->type)) { | 
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 243   // in the case of nested WebContents. | 260   // in the case of nested WebContents. | 
| 244   while (top_host->frame_tree_node()->render_manager()->ForInnerDelegate()) { | 261   while (top_host->frame_tree_node()->render_manager()->ForInnerDelegate()) { | 
| 245     top_host = top_host->frame_tree_node()->render_manager()-> | 262     top_host = top_host->frame_tree_node()->render_manager()-> | 
| 246         GetOuterDelegateNode()->frame_tree()->root()->current_frame_host(); | 263         GetOuterDelegateNode()->frame_tree()->root()->current_frame_host(); | 
| 247   } | 264   } | 
| 248 | 265 | 
| 249   return static_cast<RenderWidgetHostViewBase*>(top_host->GetView()); | 266   return static_cast<RenderWidgetHostViewBase*>(top_host->GetView()); | 
| 250 } | 267 } | 
| 251 | 268 | 
| 252 }  // namespace content | 269 }  // namespace content | 
| OLD | NEW | 
|---|