| 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       params.is_editable && | 
 |  161       params.selection_text.empty() && | 
|  161       IsQuickMenuAvailable()) { |  162       IsQuickMenuAvailable()) { | 
|  162     DCHECK(params.is_editable); |  | 
|  163     DCHECK(params.selection_text.empty()); |  | 
|  164     quick_menu_requested_ = true; |  163     quick_menu_requested_ = true; | 
|  165     UpdateQuickMenu(); |  164     UpdateQuickMenu(); | 
|  166     return true; |  165     return true; | 
|  167   } |  166   } | 
|  168   rwhva_->selection_controller()->HideAndDisallowShowingAutomatically(); |  167   rwhva_->selection_controller()->HideAndDisallowShowingAutomatically(); | 
|  169   return false; |  168   return false; | 
|  170 } |  169 } | 
|  171  |  170  | 
|  172 bool TouchSelectionControllerClientAura::IsQuickMenuAvailable() const { |  171 bool TouchSelectionControllerClientAura::IsQuickMenuAvailable() const { | 
|  173   return ui::TouchSelectionMenuRunner::GetInstance() && |  172   return ui::TouchSelectionMenuRunner::GetInstance() && | 
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  293       UpdateQuickMenu(); |  292       UpdateQuickMenu(); | 
|  294       break; |  293       break; | 
|  295     case ui::SELECTION_HANDLES_MOVED: |  294     case ui::SELECTION_HANDLES_MOVED: | 
|  296     case ui::INSERTION_HANDLE_MOVED: |  295     case ui::INSERTION_HANDLE_MOVED: | 
|  297       UpdateQuickMenu(); |  296       UpdateQuickMenu(); | 
|  298       break; |  297       break; | 
|  299     case ui::INSERTION_HANDLE_TAPPED: |  298     case ui::INSERTION_HANDLE_TAPPED: | 
|  300       quick_menu_requested_ = !quick_menu_requested_; |  299       quick_menu_requested_ = !quick_menu_requested_; | 
|  301       UpdateQuickMenu(); |  300       UpdateQuickMenu(); | 
|  302       break; |  301       break; | 
|  303     case ui::SELECTION_ESTABLISHED: |  | 
|  304     case ui::SELECTION_DISSOLVED: |  | 
|  305       break; |  | 
|  306   }; |  302   }; | 
|  307 } |  303 } | 
|  308  |  304  | 
|  309 std::unique_ptr<ui::TouchHandleDrawable> |  305 std::unique_ptr<ui::TouchHandleDrawable> | 
|  310 TouchSelectionControllerClientAura::CreateDrawable() { |  306 TouchSelectionControllerClientAura::CreateDrawable() { | 
|  311   return std::unique_ptr<ui::TouchHandleDrawable>( |  307   return std::unique_ptr<ui::TouchHandleDrawable>( | 
|  312       new ui::TouchHandleDrawableAura(rwhva_->GetNativeView())); |  308       new ui::TouchHandleDrawableAura(rwhva_->GetNativeView())); | 
|  313 } |  309 } | 
|  314  |  310  | 
|  315 bool TouchSelectionControllerClientAura::IsCommandIdEnabled( |  311 bool TouchSelectionControllerClientAura::IsCommandIdEnabled( | 
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  370                                          ui::MENU_SOURCE_TOUCH_EDIT_MENU, |  366                                          ui::MENU_SOURCE_TOUCH_EDIT_MENU, | 
|  371                                          gfx::ToRoundedPoint(anchor_point))); |  367                                          gfx::ToRoundedPoint(anchor_point))); | 
|  372  |  368  | 
|  373   // Hide selection handles after getting rect-between-bounds from touch |  369   // Hide selection handles after getting rect-between-bounds from touch | 
|  374   // selection controller; otherwise, rect would be empty and the above |  370   // selection controller; otherwise, rect would be empty and the above | 
|  375   // calculations would be invalid. |  371   // calculations would be invalid. | 
|  376   rwhva_->selection_controller()->HideAndDisallowShowingAutomatically(); |  372   rwhva_->selection_controller()->HideAndDisallowShowingAutomatically(); | 
|  377 } |  373 } | 
|  378  |  374  | 
|  379 }  // namespace content |  375 }  // namespace content | 
| OLD | NEW |