Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(379)

Side by Side Diff: content/browser/renderer_host/input/touch_selection_controller_client_child_frame.cc

Issue 2894043002: Add machinery to show touch editing context menus in OOPIFs. (Closed)
Patch Set: Remove WVI call to WFWI. Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 #include "content/common/content_switches_internal.h" 11 #include "content/common/content_switches_internal.h"
12 #include "content/common/view_messages.h" 12 #include "content/common/frame_messages.h"
13 #include "ui/base/clipboard/clipboard.h" 13 #include "ui/base/clipboard/clipboard.h"
14 #include "ui/gfx/geometry/point_conversions.h" 14 #include "ui/gfx/geometry/point_conversions.h"
15 #include "ui/strings/grit/ui_strings.h" 15 #include "ui/strings/grit/ui_strings.h"
16 16
17 namespace content { 17 namespace content {
18 18
19 TouchSelectionControllerClientChildFrame:: 19 TouchSelectionControllerClientChildFrame::
20 TouchSelectionControllerClientChildFrame( 20 TouchSelectionControllerClientChildFrame(
21 RenderWidgetHostViewChildFrame* rwhv, 21 RenderWidgetHostViewChildFrame* rwhv,
22 TouchSelectionControllerClientManager* manager) 22 TouchSelectionControllerClientManager* manager)
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 177
178 void TouchSelectionControllerClientChildFrame::RunContextMenu() { 178 void TouchSelectionControllerClientChildFrame::RunContextMenu() {
179 gfx::RectF anchor_rect = 179 gfx::RectF anchor_rect =
180 manager_->GetTouchSelectionController()->GetRectBetweenBounds(); 180 manager_->GetTouchSelectionController()->GetRectBetweenBounds();
181 gfx::PointF anchor_point = 181 gfx::PointF anchor_point =
182 gfx::PointF(anchor_rect.CenterPoint().x(), anchor_rect.y()); 182 gfx::PointF(anchor_rect.CenterPoint().x(), anchor_rect.y());
183 gfx::Point origin = rwhv_->GetViewOriginInRoot(); 183 gfx::Point origin = rwhv_->GetViewOriginInRoot();
184 anchor_point.Offset(-origin.x(), -origin.y()); 184 anchor_point.Offset(-origin.x(), -origin.y());
185 RenderWidgetHostImpl* host = 185 RenderWidgetHostImpl* host =
186 RenderWidgetHostImpl::From(rwhv_->GetRenderWidgetHost()); 186 RenderWidgetHostImpl::From(rwhv_->GetRenderWidgetHost());
187 // TODO(wjmaclean): Probably this ViewMsg should be converted to a FrameMsg 187 host->Send(new FrameMsg_ShowContextMenu(host->GetRoutingID(),
EhsanK 2017/05/23 22:31:23 Just curious if host->ShowContextMenuAtPoint() wou
wjmaclean 2017/05/24 13:05:52 It might ... in preparing this CL I followed the e
188 // since it will need to go to a RenderFrame once the Blink-side plumbing for 188 ui::MENU_SOURCE_TOUCH_EDIT_MENU,
189 // this is hooked up. 189 gfx::ToRoundedPoint(anchor_point)));
190 host->Send(new ViewMsg_ShowContextMenu(host->GetRoutingID(),
191 ui::MENU_SOURCE_TOUCH_EDIT_MENU,
192 gfx::ToRoundedPoint(anchor_point)));
193 190
194 // Hide selection handles after getting rect-between-bounds from touch 191 // Hide selection handles after getting rect-between-bounds from touch
195 // selection controller; otherwise, rect would be empty and the above 192 // selection controller; otherwise, rect would be empty and the above
196 // calculations would be invalid. 193 // calculations would be invalid.
197 manager_->GetTouchSelectionController() 194 manager_->GetTouchSelectionController()
198 ->HideAndDisallowShowingAutomatically(); 195 ->HideAndDisallowShowingAutomatically();
199 } 196 }
200 197
201 } // namespace content 198 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698