| 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 if (dragged_) | 82 if (dragged_) |
| 83 client_->OnStylusSelectEnd(); | 83 client_->OnStylusSelectEnd(); |
| 84 dragged_ = false; | 84 dragged_ = false; |
| 85 dragging_ = false; | 85 dragging_ = false; |
| 86 break; | 86 break; |
| 87 | 87 |
| 88 case MotionEvent::ACTION_POINTER_UP: | 88 case MotionEvent::ACTION_POINTER_UP: |
| 89 case MotionEvent::ACTION_POINTER_DOWN: | 89 case MotionEvent::ACTION_POINTER_DOWN: |
| 90 break; | 90 break; |
| 91 case MotionEvent::ACTION_NONE: | 91 case MotionEvent::ACTION_NONE: |
| 92 case MotionEvent::ACTION_HOVER_ENTER: |
| 93 case MotionEvent::ACTION_HOVER_EXIT: |
| 94 case MotionEvent::ACTION_HOVER_MOVE: |
| 95 case MotionEvent::ACTION_BUTTON_PRESS: |
| 96 case MotionEvent::ACTION_BUTTON_RELEASE: |
| 92 NOTREACHED(); | 97 NOTREACHED(); |
| 93 break; | 98 break; |
| 94 } | 99 } |
| 95 | 100 |
| 96 if (!gesture_detector_) | 101 if (!gesture_detector_) |
| 97 gesture_detector_ = CreateGestureDetector(this); | 102 gesture_detector_ = CreateGestureDetector(this); |
| 98 | 103 |
| 99 gesture_detector_->OnTouchEvent(event); | 104 gesture_detector_->OnTouchEvent(event); |
| 100 | 105 |
| 101 // Always return true, even if |gesture_detector_| technically doesn't | 106 // Always return true, even if |gesture_detector_| technically doesn't |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 bool StylusTextSelector::ShouldStartTextSelection(const MotionEvent& event) { | 141 bool StylusTextSelector::ShouldStartTextSelection(const MotionEvent& event) { |
| 137 DCHECK_GT(event.GetPointerCount(), 0u); | 142 DCHECK_GT(event.GetPointerCount(), 0u); |
| 138 // Currently we are supporting stylus-only cases. | 143 // Currently we are supporting stylus-only cases. |
| 139 const bool is_stylus = event.GetToolType(0) == MotionEvent::TOOL_TYPE_STYLUS; | 144 const bool is_stylus = event.GetToolType(0) == MotionEvent::TOOL_TYPE_STYLUS; |
| 140 const bool is_only_secondary_button_pressed = | 145 const bool is_only_secondary_button_pressed = |
| 141 event.GetButtonState() == MotionEvent::BUTTON_SECONDARY; | 146 event.GetButtonState() == MotionEvent::BUTTON_SECONDARY; |
| 142 return is_stylus && is_only_secondary_button_pressed; | 147 return is_stylus && is_only_secondary_button_pressed; |
| 143 } | 148 } |
| 144 | 149 |
| 145 } // namespace content | 150 } // namespace content |
| OLD | NEW |