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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 drag_state_ = DRAGGING_WITH_BUTTON_RELEASED; | 76 drag_state_ = DRAGGING_WITH_BUTTON_RELEASED; |
77 anchor_x_ = event.GetX(); | 77 anchor_x_ = event.GetX(); |
78 anchor_y_ = event.GetY(); | 78 anchor_y_ = event.GetY(); |
79 } | 79 } |
80 break; | 80 break; |
81 | 81 |
82 case MotionEvent::ACTION_UP: | 82 case MotionEvent::ACTION_UP: |
83 case MotionEvent::ACTION_CANCEL: | 83 case MotionEvent::ACTION_CANCEL: |
84 if (drag_state_ == DRAGGING_WITH_BUTTON_PRESSED || | 84 if (drag_state_ == DRAGGING_WITH_BUTTON_PRESSED || |
85 drag_state_ == DRAGGING_WITH_BUTTON_RELEASED) | 85 drag_state_ == DRAGGING_WITH_BUTTON_RELEASED) |
86 client_->OnStylusSelectEnd(); | 86 client_->OnStylusSelectEnd(event.GetX(), event.GetY()); |
87 drag_state_ = NO_DRAG; | 87 drag_state_ = NO_DRAG; |
88 break; | 88 break; |
89 | 89 |
90 case MotionEvent::ACTION_POINTER_UP: | 90 case MotionEvent::ACTION_POINTER_UP: |
91 case MotionEvent::ACTION_POINTER_DOWN: | 91 case MotionEvent::ACTION_POINTER_DOWN: |
92 break; | 92 break; |
93 case MotionEvent::ACTION_NONE: | 93 case MotionEvent::ACTION_NONE: |
94 case MotionEvent::ACTION_HOVER_ENTER: | 94 case MotionEvent::ACTION_HOVER_ENTER: |
95 case MotionEvent::ACTION_HOVER_EXIT: | 95 case MotionEvent::ACTION_HOVER_EXIT: |
96 case MotionEvent::ACTION_HOVER_MOVE: | 96 case MotionEvent::ACTION_HOVER_MOVE: |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 | 146 |
147 // For Android version < M, stylus button pressed state is BUTTON_SECONDARY. | 147 // For Android version < M, stylus button pressed state is BUTTON_SECONDARY. |
148 // From Android M, this state has changed to BUTTON_STYLUS_PRIMARY. | 148 // From Android M, this state has changed to BUTTON_STYLUS_PRIMARY. |
149 const bool is_only_secondary_button_pressed = | 149 const bool is_only_secondary_button_pressed = |
150 event.GetButtonState() == MotionEvent::BUTTON_SECONDARY || | 150 event.GetButtonState() == MotionEvent::BUTTON_SECONDARY || |
151 event.GetButtonState() == MotionEvent::BUTTON_STYLUS_PRIMARY; | 151 event.GetButtonState() == MotionEvent::BUTTON_STYLUS_PRIMARY; |
152 return is_stylus && is_only_secondary_button_pressed; | 152 return is_stylus && is_only_secondary_button_pressed; |
153 } | 153 } |
154 | 154 |
155 } // namespace content | 155 } // namespace content |
OLD | NEW |