| 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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 | 150 |
| 151 void TouchSelectionControllerClientAura::OnScrollCompleted() { | 151 void TouchSelectionControllerClientAura::OnScrollCompleted() { |
| 152 scroll_in_progress_ = false; | 152 scroll_in_progress_ = false; |
| 153 rwhva_->selection_controller()->SetTemporarilyHidden(false); | 153 rwhva_->selection_controller()->SetTemporarilyHidden(false); |
| 154 UpdateQuickMenu(); | 154 UpdateQuickMenu(); |
| 155 } | 155 } |
| 156 | 156 |
| 157 bool TouchSelectionControllerClientAura::HandleContextMenu( | 157 bool TouchSelectionControllerClientAura::HandleContextMenu( |
| 158 const ContextMenuParams& params) { | 158 const ContextMenuParams& params) { |
| 159 if (params.source_type == ui::MENU_SOURCE_LONG_PRESS && | 159 if (params.source_type == ui::MENU_SOURCE_LONG_PRESS && |
| 160 rwhva_->selection_controller()->insertion_active_or_requested() && | 160 (rwhva_->selection_controller()->active_status() == |
| 161 ui::TouchSelectionController::INSERTION_ACTIVE) && |
| 161 IsQuickMenuAvailable()) { | 162 IsQuickMenuAvailable()) { |
| 162 DCHECK(params.is_editable); | 163 DCHECK(params.is_editable); |
| 163 DCHECK(params.selection_text.empty()); | 164 DCHECK(params.selection_text.empty()); |
| 164 quick_menu_requested_ = true; | 165 quick_menu_requested_ = true; |
| 165 UpdateQuickMenu(); | 166 UpdateQuickMenu(); |
| 166 return true; | 167 return true; |
| 167 } | 168 } |
| 168 rwhva_->selection_controller()->HideAndDisallowShowingAutomatically(); | 169 rwhva_->selection_controller()->HideAndDisallowShowingAutomatically(); |
| 169 return false; | 170 return false; |
| 170 } | 171 } |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 UpdateQuickMenu(); | 294 UpdateQuickMenu(); |
| 294 break; | 295 break; |
| 295 case ui::SELECTION_HANDLES_MOVED: | 296 case ui::SELECTION_HANDLES_MOVED: |
| 296 case ui::INSERTION_HANDLE_MOVED: | 297 case ui::INSERTION_HANDLE_MOVED: |
| 297 UpdateQuickMenu(); | 298 UpdateQuickMenu(); |
| 298 break; | 299 break; |
| 299 case ui::INSERTION_HANDLE_TAPPED: | 300 case ui::INSERTION_HANDLE_TAPPED: |
| 300 quick_menu_requested_ = !quick_menu_requested_; | 301 quick_menu_requested_ = !quick_menu_requested_; |
| 301 UpdateQuickMenu(); | 302 UpdateQuickMenu(); |
| 302 break; | 303 break; |
| 303 case ui::SELECTION_ESTABLISHED: | |
| 304 case ui::SELECTION_DISSOLVED: | |
| 305 break; | |
| 306 }; | 304 }; |
| 307 } | 305 } |
| 308 | 306 |
| 309 std::unique_ptr<ui::TouchHandleDrawable> | 307 std::unique_ptr<ui::TouchHandleDrawable> |
| 310 TouchSelectionControllerClientAura::CreateDrawable() { | 308 TouchSelectionControllerClientAura::CreateDrawable() { |
| 311 return std::unique_ptr<ui::TouchHandleDrawable>( | 309 return std::unique_ptr<ui::TouchHandleDrawable>( |
| 312 new ui::TouchHandleDrawableAura(rwhva_->GetNativeView())); | 310 new ui::TouchHandleDrawableAura(rwhva_->GetNativeView())); |
| 313 } | 311 } |
| 314 | 312 |
| 315 bool TouchSelectionControllerClientAura::IsCommandIdEnabled( | 313 bool TouchSelectionControllerClientAura::IsCommandIdEnabled( |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 ui::MENU_SOURCE_TOUCH_EDIT_MENU, | 368 ui::MENU_SOURCE_TOUCH_EDIT_MENU, |
| 371 gfx::ToRoundedPoint(anchor_point))); | 369 gfx::ToRoundedPoint(anchor_point))); |
| 372 | 370 |
| 373 // Hide selection handles after getting rect-between-bounds from touch | 371 // Hide selection handles after getting rect-between-bounds from touch |
| 374 // selection controller; otherwise, rect would be empty and the above | 372 // selection controller; otherwise, rect would be empty and the above |
| 375 // calculations would be invalid. | 373 // calculations would be invalid. |
| 376 rwhva_->selection_controller()->HideAndDisallowShowingAutomatically(); | 374 rwhva_->selection_controller()->HideAndDisallowShowingAutomatically(); |
| 377 } | 375 } |
| 378 | 376 |
| 379 } // namespace content | 377 } // namespace content |
| OLD | NEW |