| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "ui/platform_window/android/platform_window_android.h" | 5 #include "ui/platform_window/android/platform_window_android.h" |
| 6 | 6 |
| 7 #include <android/input.h> | 7 #include <android/input.h> |
| 8 #include <android/native_window_jni.h> | 8 #include <android/native_window_jni.h> |
| 9 | 9 |
| 10 #include "base/android/jni_android.h" | 10 #include "base/android/jni_android.h" |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 jfloat y, | 111 jfloat y, |
| 112 jfloat pressure, | 112 jfloat pressure, |
| 113 jfloat touch_major, | 113 jfloat touch_major, |
| 114 jfloat touch_minor, | 114 jfloat touch_minor, |
| 115 jfloat orientation, | 115 jfloat orientation, |
| 116 jfloat h_wheel, | 116 jfloat h_wheel, |
| 117 jfloat v_wheel) { | 117 jfloat v_wheel) { |
| 118 ui::EventType event_type = MotionEventActionToEventType(masked_action); | 118 ui::EventType event_type = MotionEventActionToEventType(masked_action); |
| 119 if (event_type == ui::ET_UNKNOWN) | 119 if (event_type == ui::ET_UNKNOWN) |
| 120 return false; | 120 return false; |
| 121 ui::TouchEvent touch(event_type, gfx::PointF(x, y), ui::EF_NONE, pointer_id, | 121 ui::TouchEvent touch(event_type, gfx::Point(), ui::EF_NONE, pointer_id, |
| 122 base::TimeDelta::FromMilliseconds(time_ms), | 122 base::TimeDelta::FromMilliseconds(time_ms), touch_major, |
| 123 touch_major, touch_minor, orientation, pressure); | 123 touch_minor, orientation, pressure); |
| 124 touch.set_location_f(gfx::PointF(x, y)); |
| 125 touch.set_root_location_f(gfx::PointF(x, y)); |
| 124 delegate_->DispatchEvent(&touch); | 126 delegate_->DispatchEvent(&touch); |
| 125 return true; | 127 return true; |
| 126 } | 128 } |
| 127 | 129 |
| 128 bool PlatformWindowAndroid::KeyEvent(JNIEnv* env, | 130 bool PlatformWindowAndroid::KeyEvent(JNIEnv* env, |
| 129 jobject obj, | 131 jobject obj, |
| 130 bool pressed, | 132 bool pressed, |
| 131 jint key_code, | 133 jint key_code, |
| 132 jint unicode_character) { | 134 jint unicode_character) { |
| 133 ui::KeyEvent key_event(pressed ? ui::ET_KEY_PRESSED : ui::ET_KEY_RELEASED, | 135 ui::KeyEvent key_event(pressed ? ui::ET_KEY_PRESSED : ui::ET_KEY_RELEASED, |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 | 216 |
| 215 void PlatformWindowAndroid::ConfineCursorToBounds(const gfx::Rect& bounds) { | 217 void PlatformWindowAndroid::ConfineCursorToBounds(const gfx::Rect& bounds) { |
| 216 NOTIMPLEMENTED(); | 218 NOTIMPLEMENTED(); |
| 217 } | 219 } |
| 218 | 220 |
| 219 PlatformImeController* PlatformWindowAndroid::GetPlatformImeController() { | 221 PlatformImeController* PlatformWindowAndroid::GetPlatformImeController() { |
| 220 return &platform_ime_controller_; | 222 return &platform_ime_controller_; |
| 221 } | 223 } |
| 222 | 224 |
| 223 } // namespace ui | 225 } // namespace ui |
| OLD | NEW |