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