| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/renderer_host/input/touch_selection_controller_client_
child_frame.h" | 5 #include "content/browser/renderer_host/input/touch_selection_controller_client_
child_frame.h" |
| 6 | 6 |
| 7 #include "content/browser/frame_host/render_widget_host_view_child_frame.h" | 7 #include "content/browser/frame_host/render_widget_host_view_child_frame.h" |
| 8 #include "content/browser/renderer_host/input/touch_selection_controller_client_
manager.h" | 8 #include "content/browser/renderer_host/input/touch_selection_controller_client_
manager.h" |
| 9 #include "content/browser/renderer_host/render_widget_host_delegate.h" | 9 #include "content/browser/renderer_host/render_widget_host_delegate.h" |
| 10 #include "content/browser/renderer_host/render_widget_host_impl.h" | 10 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 | 180 |
| 181 void TouchSelectionControllerClientChildFrame::RunContextMenu() { | 181 void TouchSelectionControllerClientChildFrame::RunContextMenu() { |
| 182 gfx::RectF anchor_rect = | 182 gfx::RectF anchor_rect = |
| 183 manager_->GetTouchSelectionController()->GetRectBetweenBounds(); | 183 manager_->GetTouchSelectionController()->GetRectBetweenBounds(); |
| 184 gfx::PointF anchor_point = | 184 gfx::PointF anchor_point = |
| 185 gfx::PointF(anchor_rect.CenterPoint().x(), anchor_rect.y()); | 185 gfx::PointF(anchor_rect.CenterPoint().x(), anchor_rect.y()); |
| 186 gfx::Point origin = rwhv_->GetViewOriginInRoot(); | 186 gfx::Point origin = rwhv_->GetViewOriginInRoot(); |
| 187 anchor_point.Offset(-origin.x(), -origin.y()); | 187 anchor_point.Offset(-origin.x(), -origin.y()); |
| 188 RenderWidgetHostImpl* host = | 188 RenderWidgetHostImpl* host = |
| 189 RenderWidgetHostImpl::From(rwhv_->GetRenderWidgetHost()); | 189 RenderWidgetHostImpl::From(rwhv_->GetRenderWidgetHost()); |
| 190 // TODO(wjmaclean): Probably this ViewMsg should be converted to a FrameMsg | |
| 191 // since it will need to go to a RenderFrame once the Blink-side plumbing for | |
| 192 // this is hooked up. | |
| 193 host->Send(new ViewMsg_ShowContextMenu(host->GetRoutingID(), | 190 host->Send(new ViewMsg_ShowContextMenu(host->GetRoutingID(), |
| 194 ui::MENU_SOURCE_TOUCH_EDIT_MENU, | 191 ui::MENU_SOURCE_TOUCH_EDIT_MENU, |
| 195 gfx::ToRoundedPoint(anchor_point))); | 192 gfx::ToRoundedPoint(anchor_point))); |
| 196 | 193 |
| 197 // Hide selection handles after getting rect-between-bounds from touch | 194 // Hide selection handles after getting rect-between-bounds from touch |
| 198 // selection controller; otherwise, rect would be empty and the above | 195 // selection controller; otherwise, rect would be empty and the above |
| 199 // calculations would be invalid. | 196 // calculations would be invalid. |
| 200 manager_->GetTouchSelectionController() | 197 manager_->GetTouchSelectionController() |
| 201 ->HideAndDisallowShowingAutomatically(); | 198 ->HideAndDisallowShowingAutomatically(); |
| 202 } | 199 } |
| 203 | 200 |
| 204 } // namespace content | 201 } // namespace content |
| OLD | NEW |