| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "chrome/browser/android/vr_shell/android_ui_gesture_target.h" | 5 #include "chrome/browser/android/vr_shell/android_ui_gesture_target.h" |
| 6 | 6 |
| 7 #include "jni/MotionEventSynthesizer_jni.h" | 7 #include "jni/MotionEventSynthesizer_jni.h" |
| 8 | 8 |
| 9 namespace vr_shell { | 9 namespace vr_shell { |
| 10 | 10 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 Inject(env, Action::Start, gesture->timeStampSeconds()); | 53 Inject(env, Action::Start, gesture->timeStampSeconds()); |
| 54 Inject(env, Action::End, gesture->timeStampSeconds()); | 54 Inject(env, Action::End, gesture->timeStampSeconds()); |
| 55 break; | 55 break; |
| 56 case blink::WebGestureEvent::GestureFlingCancel: | 56 case blink::WebGestureEvent::GestureFlingCancel: |
| 57 Inject(env, Action::Cancel, gesture->timeStampSeconds()); | 57 Inject(env, Action::Cancel, gesture->timeStampSeconds()); |
| 58 break; | 58 break; |
| 59 case blink::WebGestureEvent::GestureFlingStart: | 59 case blink::WebGestureEvent::GestureFlingStart: |
| 60 // Flings are automatically generated for android UI. Ignore this input. | 60 // Flings are automatically generated for android UI. Ignore this input. |
| 61 break; | 61 break; |
| 62 case blink::WebMouseEvent::MouseEnter: | 62 case blink::WebMouseEvent::MouseEnter: |
| 63 SetPointer(env, mouse->x, mouse->y); | 63 SetPointer(env, mouse->positionInWidget().x, mouse->positionInWidget().y); |
| 64 Inject(env, Action::HoverEnter, gesture->timeStampSeconds()); | 64 Inject(env, Action::HoverEnter, gesture->timeStampSeconds()); |
| 65 break; | 65 break; |
| 66 case blink::WebMouseEvent::MouseMove: | 66 case blink::WebMouseEvent::MouseMove: |
| 67 SetPointer(env, mouse->x, mouse->y); | 67 SetPointer(env, mouse->positionInWidget().x, mouse->positionInWidget().y); |
| 68 Inject(env, Action::HoverMove, gesture->timeStampSeconds()); | 68 Inject(env, Action::HoverMove, gesture->timeStampSeconds()); |
| 69 break; | 69 break; |
| 70 case blink::WebMouseEvent::MouseLeave: | 70 case blink::WebMouseEvent::MouseLeave: |
| 71 SetPointer(env, mouse->x, mouse->y); | 71 SetPointer(env, mouse->positionInWidget().x, mouse->positionInWidget().y); |
| 72 Inject(env, Action::HoverExit, gesture->timeStampSeconds()); | 72 Inject(env, Action::HoverExit, gesture->timeStampSeconds()); |
| 73 break; | 73 break; |
| 74 default: | 74 default: |
| 75 NOTREACHED(); | 75 NOTREACHED(); |
| 76 break; | 76 break; |
| 77 } | 77 } |
| 78 } | 78 } |
| 79 | 79 |
| 80 void AndroidUiGestureTarget::SetPointer(JNIEnv* env, int x, int y) { | 80 void AndroidUiGestureTarget::SetPointer(JNIEnv* env, int x, int y) { |
| 81 content::Java_MotionEventSynthesizer_setPointer(env, event_synthesizer_, 0, x, | 81 content::Java_MotionEventSynthesizer_setPointer(env, event_synthesizer_, 0, x, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 93 | 93 |
| 94 void AndroidUiGestureTarget::Inject(JNIEnv* env, | 94 void AndroidUiGestureTarget::Inject(JNIEnv* env, |
| 95 Action action, | 95 Action action, |
| 96 double time_in_seconds) { | 96 double time_in_seconds) { |
| 97 content::Java_MotionEventSynthesizer_inject( | 97 content::Java_MotionEventSynthesizer_inject( |
| 98 env, event_synthesizer_, static_cast<int>(action), 1, | 98 env, event_synthesizer_, static_cast<int>(action), 1, |
| 99 static_cast<int64_t>(time_in_seconds * 1000.0)); | 99 static_cast<int64_t>(time_in_seconds * 1000.0)); |
| 100 } | 100 } |
| 101 | 101 |
| 102 } // namespace vr_shell | 102 } // namespace vr_shell |
| OLD | NEW |