| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/web_input_event_builders_android.h
" | 5 #include "content/browser/renderer_host/input/web_input_event_builders_android.h
" |
| 6 | 6 |
| 7 #include <android/input.h> | 7 #include <android/input.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "ui/events/android/key_event_utils.h" | 10 #include "ui/events/android/key_event_utils.h" |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 | 113 |
| 114 WebMouseEvent WebMouseEventBuilder::Build(WebInputEvent::Type type, | 114 WebMouseEvent WebMouseEventBuilder::Build(WebInputEvent::Type type, |
| 115 double time_sec, | 115 double time_sec, |
| 116 int window_x, | 116 int window_x, |
| 117 int window_y, | 117 int window_y, |
| 118 int modifiers, | 118 int modifiers, |
| 119 int click_count, | 119 int click_count, |
| 120 int pointer_id, | 120 int pointer_id, |
| 121 float pressure, | 121 float pressure, |
| 122 float orientation_rad, | 122 float orientation_rad, |
| 123 float tilt_rad, | 123 float tilt_x, |
| 124 float tilt_y, |
| 124 int action_button, | 125 int action_button, |
| 125 int tool_type) { | 126 int tool_type) { |
| 126 DCHECK(WebInputEvent::IsMouseEventType(type)); | 127 DCHECK(WebInputEvent::IsMouseEventType(type)); |
| 127 WebMouseEvent result(type, ui::EventFlagsToWebEventModifiers(modifiers), | 128 WebMouseEvent result(type, ui::EventFlagsToWebEventModifiers(modifiers), |
| 128 time_sec); | 129 time_sec); |
| 129 | 130 |
| 130 result.SetPositionInWidget(window_x, window_y); | 131 result.SetPositionInWidget(window_x, window_y); |
| 131 result.click_count = click_count; | 132 result.click_count = click_count; |
| 132 | 133 |
| 133 int button = action_button; | 134 int button = action_button; |
| 134 // For events other than MouseDown/Up, action_button is not defined. So we are | 135 // For events other than MouseDown/Up, action_button is not defined. So we are |
| 135 // determining |button| value from |modifiers| as is done in other platforms. | 136 // determining |button| value from |modifiers| as is done in other platforms. |
| 136 if (type != WebInputEvent::kMouseDown && type != WebInputEvent::kMouseUp) { | 137 if (type != WebInputEvent::kMouseDown && type != WebInputEvent::kMouseUp) { |
| 137 if (modifiers & ui::EF_LEFT_MOUSE_BUTTON) | 138 if (modifiers & ui::EF_LEFT_MOUSE_BUTTON) |
| 138 button = ui::MotionEvent::BUTTON_PRIMARY; | 139 button = ui::MotionEvent::BUTTON_PRIMARY; |
| 139 else if (modifiers & ui::EF_MIDDLE_MOUSE_BUTTON) | 140 else if (modifiers & ui::EF_MIDDLE_MOUSE_BUTTON) |
| 140 button = ui::MotionEvent::BUTTON_TERTIARY; | 141 button = ui::MotionEvent::BUTTON_TERTIARY; |
| 141 else if (modifiers & ui::EF_RIGHT_MOUSE_BUTTON) | 142 else if (modifiers & ui::EF_RIGHT_MOUSE_BUTTON) |
| 142 button = ui::MotionEvent::BUTTON_SECONDARY; | 143 button = ui::MotionEvent::BUTTON_SECONDARY; |
| 143 else | 144 else |
| 144 button = 0; | 145 button = 0; |
| 145 } | 146 } |
| 146 | 147 |
| 147 ui::SetWebPointerPropertiesFromMotionEventData(result, pointer_id, pressure, | 148 ui::SetWebPointerPropertiesFromMotionEventData(result, pointer_id, pressure, |
| 148 orientation_rad, tilt_rad, | 149 orientation_rad, tilt_x, |
| 149 button, tool_type); | 150 tilt_y, button, tool_type); |
| 150 | 151 |
| 151 return result; | 152 return result; |
| 152 } | 153 } |
| 153 | 154 |
| 154 WebMouseWheelEvent WebMouseWheelEventBuilder::Build(float ticks_x, | 155 WebMouseWheelEvent WebMouseWheelEventBuilder::Build(float ticks_x, |
| 155 float ticks_y, | 156 float ticks_y, |
| 156 float tick_multiplier, | 157 float tick_multiplier, |
| 157 double time_sec, | 158 double time_sec, |
| 158 int window_x, | 159 int window_x, |
| 159 int window_y) { | 160 int window_y) { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 178 WebGestureEvent result(type, WebInputEvent::kNoModifiers, time_sec); | 179 WebGestureEvent result(type, WebInputEvent::kNoModifiers, time_sec); |
| 179 | 180 |
| 180 result.x = x; | 181 result.x = x; |
| 181 result.y = y; | 182 result.y = y; |
| 182 result.source_device = blink::kWebGestureDeviceTouchscreen; | 183 result.source_device = blink::kWebGestureDeviceTouchscreen; |
| 183 | 184 |
| 184 return result; | 185 return result; |
| 185 } | 186 } |
| 186 | 187 |
| 187 } // namespace content | 188 } // namespace content |
| OLD | NEW |