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 12 matching lines...) Expand all Loading... |
23 | 23 |
24 ui::DoubleTapListener* null_double_tap_listener = nullptr; | 24 ui::DoubleTapListener* null_double_tap_listener = nullptr; |
25 | 25 |
26 // Doubletap, showpress and longpress detection are not required, and | 26 // Doubletap, showpress and longpress detection are not required, and |
27 // should be explicitly disabled for efficiency. | 27 // should be explicitly disabled for efficiency. |
28 scoped_ptr<ui::GestureDetector> detector( | 28 scoped_ptr<ui::GestureDetector> detector( |
29 new ui::GestureDetector(config, listener, null_double_tap_listener)); | 29 new ui::GestureDetector(config, listener, null_double_tap_listener)); |
30 detector->set_longpress_enabled(false); | 30 detector->set_longpress_enabled(false); |
31 detector->set_showpress_enabled(false); | 31 detector->set_showpress_enabled(false); |
32 | 32 |
33 return detector.Pass(); | 33 return detector; |
34 } | 34 } |
35 | 35 |
36 } // namespace | 36 } // namespace |
37 | 37 |
38 StylusTextSelector::StylusTextSelector(StylusTextSelectorClient* client) | 38 StylusTextSelector::StylusTextSelector(StylusTextSelectorClient* client) |
39 : client_(client), | 39 : client_(client), |
40 text_selection_triggered_(false), | 40 text_selection_triggered_(false), |
41 secondary_button_pressed_(false), | 41 secondary_button_pressed_(false), |
42 dragging_(false), | 42 dragging_(false), |
43 dragged_(false), | 43 dragged_(false), |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 |