| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/android/content_view_core_impl.h" | 5 #include "content/browser/android/content_view_core_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
| 10 #include "base/android/jni_array.h" | 10 #include "base/android/jni_array.h" |
| (...skipping 1023 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1034 jfloat ticks_y, | 1034 jfloat ticks_y, |
| 1035 jfloat pixels_per_tick) { | 1035 jfloat pixels_per_tick) { |
| 1036 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); | 1036 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); |
| 1037 if (!rwhv) | 1037 if (!rwhv) |
| 1038 return false; | 1038 return false; |
| 1039 | 1039 |
| 1040 if (!ticks_x && !ticks_y) | 1040 if (!ticks_x && !ticks_y) |
| 1041 return false; | 1041 return false; |
| 1042 | 1042 |
| 1043 // Compute Event.Latency.OS.MOUSE_WHEEL histogram. | 1043 // Compute Event.Latency.OS.MOUSE_WHEEL histogram. |
| 1044 base::TimeDelta current_time = ui::EventTimeForNow(); | 1044 base::TimeTicks current_time = ui::EventTimeForNow(); |
| 1045 base::TimeDelta event_time = base::TimeDelta::FromMilliseconds(time_ms); | 1045 base::TimeTicks event_time = base::TimeTicks() + |
| 1046 base::TimeDelta::FromMilliseconds(time_ms); |
| 1046 base::TimeDelta delta = current_time - event_time; | 1047 base::TimeDelta delta = current_time - event_time; |
| 1047 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.MOUSE_WHEEL", | 1048 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.MOUSE_WHEEL", |
| 1048 delta.InMicroseconds(), 1, 1000000, 50); | 1049 delta.InMicroseconds(), 1, 1000000, 50); |
| 1049 | 1050 |
| 1050 blink::WebMouseWheelEvent event = WebMouseWheelEventBuilder::Build( | 1051 blink::WebMouseWheelEvent event = WebMouseWheelEventBuilder::Build( |
| 1051 ticks_x, ticks_y, pixels_per_tick / dpi_scale(), time_ms / 1000.0, | 1052 ticks_x, ticks_y, pixels_per_tick / dpi_scale(), time_ms / 1000.0, |
| 1052 x / dpi_scale(), y / dpi_scale()); | 1053 x / dpi_scale(), y / dpi_scale()); |
| 1053 | 1054 |
| 1054 rwhv->SendMouseWheelEvent(event); | 1055 rwhv->SendMouseWheelEvent(event); |
| 1055 return true; | 1056 return true; |
| (...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1581 return ScopedJavaLocalRef<jobject>(); | 1582 return ScopedJavaLocalRef<jobject>(); |
| 1582 | 1583 |
| 1583 return view->GetJavaObject(); | 1584 return view->GetJavaObject(); |
| 1584 } | 1585 } |
| 1585 | 1586 |
| 1586 bool RegisterContentViewCore(JNIEnv* env) { | 1587 bool RegisterContentViewCore(JNIEnv* env) { |
| 1587 return RegisterNativesImpl(env); | 1588 return RegisterNativesImpl(env); |
| 1588 } | 1589 } |
| 1589 | 1590 |
| 1590 } // namespace content | 1591 } // namespace content |
| OLD | NEW |