OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_
aura.h" | 5 #include "content/browser/renderer_host/input/touch_selection_controller_client_
aura.h" |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "content/browser/renderer_host/render_widget_host_delegate.h" | 8 #include "content/browser/renderer_host/render_widget_host_delegate.h" |
9 #include "content/browser/renderer_host/render_widget_host_impl.h" | 9 #include "content/browser/renderer_host/render_widget_host_impl.h" |
10 #include "content/browser/renderer_host/render_widget_host_view_aura.h" | 10 #include "content/browser/renderer_host/render_widget_host_view_aura.h" |
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 } | 459 } |
460 } | 460 } |
461 | 461 |
462 void TouchSelectionControllerClientAura::RunContextMenu() { | 462 void TouchSelectionControllerClientAura::RunContextMenu() { |
463 gfx::RectF anchor_rect = | 463 gfx::RectF anchor_rect = |
464 rwhva_->selection_controller()->GetRectBetweenBounds(); | 464 rwhva_->selection_controller()->GetRectBetweenBounds(); |
465 gfx::PointF anchor_point = | 465 gfx::PointF anchor_point = |
466 gfx::PointF(anchor_rect.CenterPoint().x(), anchor_rect.y()); | 466 gfx::PointF(anchor_rect.CenterPoint().x(), anchor_rect.y()); |
467 RenderWidgetHostImpl* host = | 467 RenderWidgetHostImpl* host = |
468 RenderWidgetHostImpl::From(rwhva_->GetRenderWidgetHost()); | 468 RenderWidgetHostImpl::From(rwhva_->GetRenderWidgetHost()); |
469 host->Send(new ViewMsg_ShowContextMenu(host->GetRoutingID(), | 469 host->ShowContextMenuAtPoint(gfx::ToRoundedPoint(anchor_point), |
470 ui::MENU_SOURCE_TOUCH_EDIT_MENU, | 470 ui::MENU_SOURCE_TOUCH_EDIT_MENU); |
471 gfx::ToRoundedPoint(anchor_point))); | |
472 | 471 |
473 // Hide selection handles after getting rect-between-bounds from touch | 472 // Hide selection handles after getting rect-between-bounds from touch |
474 // selection controller; otherwise, rect would be empty and the above | 473 // selection controller; otherwise, rect would be empty and the above |
475 // calculations would be invalid. | 474 // calculations would be invalid. |
476 rwhva_->selection_controller()->HideAndDisallowShowingAutomatically(); | 475 rwhva_->selection_controller()->HideAndDisallowShowingAutomatically(); |
477 } | 476 } |
478 | 477 |
479 } // namespace content | 478 } // namespace content |
OLD | NEW |