 Chromium Code Reviews
 Chromium Code Reviews Issue 1729373003:
  Implement touch events for site-isolation.  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master
    
  
    Issue 1729373003:
  Implement touch events for site-isolation.  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master| 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): Keyboard events will likely live here for a while, since | |
| 185 // they rely on focus and not on event coordinates, but we should get rid of | |
| 186 // the others since they are directly target using | |
| 187 // RenderWidgetHostInputEventRouter. But neither pathway is currently handling | |
| 188 // gesture events :-( | |
| 
kenrb
2016/02/25 00:58:04
We don't need this to handle keyboard events, eith
 
wjmaclean
2016/02/25 12:23:02
Done.
 | |
| 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 | 
| 198 if (blink::WebInputEvent::isTouchEventType(event->type)) { | |
| 199 view_->ProcessTouchEvent(*static_cast<const blink::WebTouchEvent*>(event), | |
| 
kenrb
2016/02/25 00:58:04
Is this needed? I think the entire method (OnForwa
 
wjmaclean
2016/02/25 12:23:02
I added this mostly for completeness, but I'm will
 | |
| 200 ui::LatencyInfo()); | |
| 201 return; | |
| 202 } | |
| 203 | |
| 180 if (blink::WebInputEvent::isMouseEventType(event->type)) { | 204 if (blink::WebInputEvent::isMouseEventType(event->type)) { | 
| 181 view_->ProcessMouseEvent(*static_cast<const blink::WebMouseEvent*>(event)); | 205 view_->ProcessMouseEvent(*static_cast<const blink::WebMouseEvent*>(event)); | 
| 182 return; | 206 return; | 
| 183 } | 207 } | 
| 184 | 208 | 
| 185 if (event->type == blink::WebInputEvent::MouseWheel) { | 209 if (event->type == blink::WebInputEvent::MouseWheel) { | 
| 186 view_->ProcessMouseWheelEvent( | 210 view_->ProcessMouseWheelEvent( | 
| 187 *static_cast<const blink::WebMouseWheelEvent*>(event)); | 211 *static_cast<const blink::WebMouseWheelEvent*>(event)); | 
| 188 return; | 212 return; | 
| 189 } | 213 } | 
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 243 // in the case of nested WebContents. | 267 // in the case of nested WebContents. | 
| 244 while (top_host->frame_tree_node()->render_manager()->ForInnerDelegate()) { | 268 while (top_host->frame_tree_node()->render_manager()->ForInnerDelegate()) { | 
| 245 top_host = top_host->frame_tree_node()->render_manager()-> | 269 top_host = top_host->frame_tree_node()->render_manager()-> | 
| 246 GetOuterDelegateNode()->frame_tree()->root()->current_frame_host(); | 270 GetOuterDelegateNode()->frame_tree()->root()->current_frame_host(); | 
| 247 } | 271 } | 
| 248 | 272 | 
| 249 return static_cast<RenderWidgetHostViewBase*>(top_host->GetView()); | 273 return static_cast<RenderWidgetHostViewBase*>(top_host->GetView()); | 
| 250 } | 274 } | 
| 251 | 275 | 
| 252 } // namespace content | 276 } // namespace content | 
| OLD | NEW |