| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/stylus_text_selector.h" | 5 #include "content/browser/renderer_host/input/stylus_text_selector.h" |
| 6 | 6 |
| 7 #include "ui/events/event_constants.h" | 7 #include "ui/events/event_constants.h" |
| 8 #include "ui/events/gesture_detection/gesture_detector.h" | 8 #include "ui/events/gesture_detection/gesture_detector.h" |
| 9 #include "ui/events/gesture_detection/gesture_provider_config_helper.h" | 9 #include "ui/events/gesture_detection/gesture_provider_config_helper.h" |
| 10 #include "ui/events/gesture_detection/motion_event.h" | 10 #include "ui/events/gesture_detection/motion_event.h" |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 if (!gesture_detector_) | 96 if (!gesture_detector_) |
| 97 gesture_detector_ = CreateGestureDetector(this); | 97 gesture_detector_ = CreateGestureDetector(this); |
| 98 | 98 |
| 99 gesture_detector_->OnTouchEvent(event); | 99 gesture_detector_->OnTouchEvent(event); |
| 100 | 100 |
| 101 // Always return true, even if |gesture_detector_| technically doesn't | 101 // Always return true, even if |gesture_detector_| technically doesn't |
| 102 // consume the event. This prevents forwarding of a partial touch stream. | 102 // consume the event. This prevents forwarding of a partial touch stream. |
| 103 return true; | 103 return true; |
| 104 } | 104 } |
| 105 | 105 |
| 106 bool StylusTextSelector::OnSingleTapUp(const MotionEvent& e) { | 106 bool StylusTextSelector::OnSingleTapUp(const MotionEvent& e, int tap_count) { |
| 107 DCHECK(text_selection_triggered_); | 107 DCHECK(text_selection_triggered_); |
| 108 DCHECK(!dragging_); | 108 DCHECK(!dragging_); |
| 109 client_->OnStylusSelectTap(e.GetEventTime(), e.GetX(), e.GetY()); | 109 client_->OnStylusSelectTap(e.GetEventTime(), e.GetX(), e.GetY()); |
| 110 return true; | 110 return true; |
| 111 } | 111 } |
| 112 | 112 |
| 113 bool StylusTextSelector::OnScroll(const MotionEvent& e1, | 113 bool StylusTextSelector::OnScroll(const MotionEvent& e1, |
| 114 const MotionEvent& e2, | 114 const MotionEvent& e2, |
| 115 float distance_x, | 115 float distance_x, |
| 116 float distance_y) { | 116 float distance_y) { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 135 bool StylusTextSelector::ShouldStartTextSelection(const MotionEvent& event) { | 135 bool StylusTextSelector::ShouldStartTextSelection(const MotionEvent& event) { |
| 136 DCHECK_GT(event.GetPointerCount(), 0u); | 136 DCHECK_GT(event.GetPointerCount(), 0u); |
| 137 // Currently we are supporting stylus-only cases. | 137 // Currently we are supporting stylus-only cases. |
| 138 const bool is_stylus = event.GetToolType(0) == MotionEvent::TOOL_TYPE_STYLUS; | 138 const bool is_stylus = event.GetToolType(0) == MotionEvent::TOOL_TYPE_STYLUS; |
| 139 const bool is_only_secondary_button_pressed = | 139 const bool is_only_secondary_button_pressed = |
| 140 event.GetButtonState() == MotionEvent::BUTTON_SECONDARY; | 140 event.GetButtonState() == MotionEvent::BUTTON_SECONDARY; |
| 141 return is_stylus && is_only_secondary_button_pressed; | 141 return is_stylus && is_only_secondary_button_pressed; |
| 142 } | 142 } |
| 143 | 143 |
| 144 } // namespace content | 144 } // namespace content |
| OLD | NEW |