| 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/gesture_text_selector.h" | 5 #include "content/browser/renderer_host/input/gesture_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" |
| 11 | 11 |
| 12 using ui::GestureDetector; | 12 using ui::GestureDetector; |
| 13 using ui::MotionEvent; | 13 using ui::MotionEvent; |
| 14 | 14 |
| 15 namespace content { | 15 namespace content { |
| 16 namespace { | 16 namespace { |
| 17 scoped_ptr<GestureDetector> CreateGestureDetector( | 17 scoped_ptr<GestureDetector> CreateGestureDetector( |
| 18 ui::GestureListener* listener) { | 18 ui::GestureListener* listener) { |
| 19 GestureDetector::Config config = | 19 GestureDetector::Config config = |
| 20 ui::DefaultGestureProviderConfig().gesture_detector_config; | 20 ui::GetGestureProviderConfig( |
| 21 ui::GestureProviderConfigType::CURRENT_PLATFORM) |
| 22 .gesture_detector_config; |
| 21 | 23 |
| 22 ui::DoubleTapListener* null_double_tap_listener = nullptr; | 24 ui::DoubleTapListener* null_double_tap_listener = nullptr; |
| 23 | 25 |
| 24 // Doubletap, showpress and longpress detection are not required, and | 26 // Doubletap, showpress and longpress detection are not required, and |
| 25 // should be explicitly disabled for efficiency. | 27 // should be explicitly disabled for efficiency. |
| 26 scoped_ptr<ui::GestureDetector> detector( | 28 scoped_ptr<ui::GestureDetector> detector( |
| 27 new ui::GestureDetector(config, listener, null_double_tap_listener)); | 29 new ui::GestureDetector(config, listener, null_double_tap_listener)); |
| 28 detector->set_longpress_enabled(false); | 30 detector->set_longpress_enabled(false); |
| 29 detector->set_showpress_enabled(false); | 31 detector->set_showpress_enabled(false); |
| 30 | 32 |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 bool GestureTextSelector::ShouldStartTextSelection(const MotionEvent& event) { | 108 bool GestureTextSelector::ShouldStartTextSelection(const MotionEvent& event) { |
| 107 DCHECK_GT(event.GetPointerCount(), 0u); | 109 DCHECK_GT(event.GetPointerCount(), 0u); |
| 108 // Currently we are supporting stylus-only cases. | 110 // Currently we are supporting stylus-only cases. |
| 109 const bool is_stylus = event.GetToolType(0) == MotionEvent::TOOL_TYPE_STYLUS; | 111 const bool is_stylus = event.GetToolType(0) == MotionEvent::TOOL_TYPE_STYLUS; |
| 110 const bool is_only_secondary_button_pressed = | 112 const bool is_only_secondary_button_pressed = |
| 111 event.GetButtonState() == MotionEvent::BUTTON_SECONDARY; | 113 event.GetButtonState() == MotionEvent::BUTTON_SECONDARY; |
| 112 return is_stylus && is_only_secondary_button_pressed; | 114 return is_stylus && is_only_secondary_button_pressed; |
| 113 } | 115 } |
| 114 | 116 |
| 115 } // namespace content | 117 } // namespace content |
| OLD | NEW |