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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 | 105 |
106 bool StylusTextSelector::OnSingleTapUp(const MotionEvent& e, int tap_count) { | 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 const MotionEvent& secondary_pointer_down, |
115 float distance_x, | 116 float distance_x, |
116 float distance_y) { | 117 float distance_y) { |
117 DCHECK(text_selection_triggered_); | 118 DCHECK(text_selection_triggered_); |
118 | 119 |
119 // Return if Stylus button is not pressed. | 120 // Return if Stylus button is not pressed. |
120 if (!secondary_button_pressed_) | 121 if (!secondary_button_pressed_) |
121 return true; | 122 return true; |
122 | 123 |
123 if (!dragging_) { | 124 if (!dragging_) { |
124 dragging_ = true; | 125 dragging_ = true; |
(...skipping 10 matching lines...) Expand all Loading... |
135 bool StylusTextSelector::ShouldStartTextSelection(const MotionEvent& event) { | 136 bool StylusTextSelector::ShouldStartTextSelection(const MotionEvent& event) { |
136 DCHECK_GT(event.GetPointerCount(), 0u); | 137 DCHECK_GT(event.GetPointerCount(), 0u); |
137 // Currently we are supporting stylus-only cases. | 138 // Currently we are supporting stylus-only cases. |
138 const bool is_stylus = event.GetToolType(0) == MotionEvent::TOOL_TYPE_STYLUS; | 139 const bool is_stylus = event.GetToolType(0) == MotionEvent::TOOL_TYPE_STYLUS; |
139 const bool is_only_secondary_button_pressed = | 140 const bool is_only_secondary_button_pressed = |
140 event.GetButtonState() == MotionEvent::BUTTON_SECONDARY; | 141 event.GetButtonState() == MotionEvent::BUTTON_SECONDARY; |
141 return is_stylus && is_only_secondary_button_pressed; | 142 return is_stylus && is_only_secondary_button_pressed; |
142 } | 143 } |
143 | 144 |
144 } // namespace content | 145 } // namespace content |
OLD | NEW |