| 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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 bool TouchSelectionControllerClientAura::HandleContextMenu( | 163 bool TouchSelectionControllerClientAura::HandleContextMenu( |
| 164 const ContextMenuParams& params) { | 164 const ContextMenuParams& params) { |
| 165 if (params.source_type == ui::MENU_SOURCE_LONG_PRESS && | 165 if (params.source_type == ui::MENU_SOURCE_LONG_PRESS && |
| 166 params.is_editable && | 166 params.is_editable && |
| 167 params.selection_text.empty() && | 167 params.selection_text.empty() && |
| 168 IsQuickMenuAvailable()) { | 168 IsQuickMenuAvailable()) { |
| 169 quick_menu_requested_ = true; | 169 quick_menu_requested_ = true; |
| 170 UpdateQuickMenu(); | 170 UpdateQuickMenu(); |
| 171 return true; | 171 return true; |
| 172 } | 172 } |
| 173 |
| 174 const bool from_touch = params.source_type == ui::MENU_SOURCE_LONG_PRESS || |
| 175 params.source_type == ui::MENU_SOURCE_TOUCH; |
| 176 if (from_touch && !params.selection_text.empty()) |
| 177 return true; |
| 178 |
| 173 rwhva_->selection_controller()->HideAndDisallowShowingAutomatically(); | 179 rwhva_->selection_controller()->HideAndDisallowShowingAutomatically(); |
| 174 return false; | 180 return false; |
| 175 } | 181 } |
| 176 | 182 |
| 177 void TouchSelectionControllerClientAura::UpdateClientSelectionBounds( | 183 void TouchSelectionControllerClientAura::UpdateClientSelectionBounds( |
| 178 const gfx::SelectionBound& start, | 184 const gfx::SelectionBound& start, |
| 179 const gfx::SelectionBound& end) { | 185 const gfx::SelectionBound& end) { |
| 180 UpdateClientSelectionBounds(start, end, &internal_client_, this); | 186 UpdateClientSelectionBounds(start, end, &internal_client_, this); |
| 181 } | 187 } |
| 182 | 188 |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 host->ShowContextMenuAtPoint(gfx::ToRoundedPoint(anchor_point), | 475 host->ShowContextMenuAtPoint(gfx::ToRoundedPoint(anchor_point), |
| 470 ui::MENU_SOURCE_TOUCH_EDIT_MENU); | 476 ui::MENU_SOURCE_TOUCH_EDIT_MENU); |
| 471 | 477 |
| 472 // Hide selection handles after getting rect-between-bounds from touch | 478 // Hide selection handles after getting rect-between-bounds from touch |
| 473 // selection controller; otherwise, rect would be empty and the above | 479 // selection controller; otherwise, rect would be empty and the above |
| 474 // calculations would be invalid. | 480 // calculations would be invalid. |
| 475 rwhva_->selection_controller()->HideAndDisallowShowingAutomatically(); | 481 rwhva_->selection_controller()->HideAndDisallowShowingAutomatically(); |
| 476 } | 482 } |
| 477 | 483 |
| 478 } // namespace content | 484 } // namespace content |
| OLD | NEW |