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

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

Issue 2785853002: Selection Action mode triggered like a context menu (Closed)
Patch Set: Fixing rebase bug Created 3 years, 8 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 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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 bool TouchSelectionControllerClientAura::HandleContextMenu( 158 bool TouchSelectionControllerClientAura::HandleContextMenu(
159 const ContextMenuParams& params) { 159 const ContextMenuParams& params) {
160 if (params.source_type == ui::MENU_SOURCE_LONG_PRESS && 160 if (params.source_type == ui::MENU_SOURCE_LONG_PRESS &&
161 params.is_editable && 161 params.is_editable &&
162 params.selection_text.empty() && 162 params.selection_text.empty() &&
163 IsQuickMenuAvailable()) { 163 IsQuickMenuAvailable()) {
164 quick_menu_requested_ = true; 164 quick_menu_requested_ = true;
165 UpdateQuickMenu(); 165 UpdateQuickMenu();
166 return true; 166 return true;
167 } 167 }
168
169 const bool from_touch = params.source_type == ui::MENU_SOURCE_LONG_PRESS ||
170 params.source_type == ui::MENU_SOURCE_TOUCH;
171 if (from_touch && !params.selection_text.empty())
172 return true;
173
168 rwhva_->selection_controller()->HideAndDisallowShowingAutomatically(); 174 rwhva_->selection_controller()->HideAndDisallowShowingAutomatically();
169 return false; 175 return false;
170 } 176 }
171 177
172 bool TouchSelectionControllerClientAura::IsQuickMenuAvailable() const { 178 bool TouchSelectionControllerClientAura::IsQuickMenuAvailable() const {
173 return ui::TouchSelectionMenuRunner::GetInstance() && 179 return ui::TouchSelectionMenuRunner::GetInstance() &&
174 ui::TouchSelectionMenuRunner::GetInstance()->IsMenuAvailable(this); 180 ui::TouchSelectionMenuRunner::GetInstance()->IsMenuAvailable(this);
175 } 181 }
176 182
177 void TouchSelectionControllerClientAura::ShowQuickMenu() { 183 void TouchSelectionControllerClientAura::ShowQuickMenu() {
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 ui::MENU_SOURCE_TOUCH_EDIT_MENU, 373 ui::MENU_SOURCE_TOUCH_EDIT_MENU,
368 gfx::ToRoundedPoint(anchor_point))); 374 gfx::ToRoundedPoint(anchor_point)));
369 375
370 // Hide selection handles after getting rect-between-bounds from touch 376 // Hide selection handles after getting rect-between-bounds from touch
371 // selection controller; otherwise, rect would be empty and the above 377 // selection controller; otherwise, rect would be empty and the above
372 // calculations would be invalid. 378 // calculations would be invalid.
373 rwhva_->selection_controller()->HideAndDisallowShowingAutomatically(); 379 rwhva_->selection_controller()->HideAndDisallowShowingAutomatically();
374 } 380 }
375 381
376 } // namespace content 382 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698