Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(238)

Side by Side Diff: content/browser/android/content_view_core_impl.cc

Issue 2770613002: Forward GenericMotionEvent to EventForwarder (Closed)
Patch Set: comments Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 847 matching lines...) Expand 10 before | Expand all | Expand 10 after
858 JNIEnv* env, 858 JNIEnv* env,
859 const JavaParamRef<jobject>& obj, 859 const JavaParamRef<jobject>& obj,
860 jint orientation) { 860 jint orientation) {
861 if (device_orientation_ != orientation) { 861 if (device_orientation_ != orientation) {
862 base::RecordAction(base::UserMetricsAction("ScreenOrientationChange")); 862 base::RecordAction(base::UserMetricsAction("ScreenOrientationChange"));
863 device_orientation_ = orientation; 863 device_orientation_ = orientation;
864 SendOrientationChangeEventInternal(); 864 SendOrientationChangeEventInternal();
865 } 865 }
866 } 866 }
867 867
868 jboolean ContentViewCoreImpl::SendMouseWheelEvent(
869 JNIEnv* env,
870 const JavaParamRef<jobject>& obj,
871 jlong time_ms,
872 jfloat x,
873 jfloat y,
874 jfloat ticks_x,
875 jfloat ticks_y,
876 jfloat pixels_per_tick) {
877 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid();
878 if (!rwhv)
879 return false;
880
881 if (!ticks_x && !ticks_y)
882 return false;
883
884 // Compute Event.Latency.OS.MOUSE_WHEEL histogram.
885 base::TimeTicks current_time = ui::EventTimeForNow();
886 base::TimeTicks event_time = base::TimeTicks() +
887 base::TimeDelta::FromMilliseconds(time_ms);
888 base::TimeDelta delta = current_time - event_time;
889 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.MOUSE_WHEEL",
890 delta.InMicroseconds(), 1, 1000000, 50);
891
892 blink::WebMouseWheelEvent event = WebMouseWheelEventBuilder::Build(
893 ticks_x, ticks_y, pixels_per_tick / dpi_scale(), time_ms / 1000.0,
894 x / dpi_scale(), y / dpi_scale());
895
896 rwhv->SendMouseWheelEvent(event);
897 return true;
898 }
899
900 WebGestureEvent ContentViewCoreImpl::MakeGestureEvent(WebInputEvent::Type type, 868 WebGestureEvent ContentViewCoreImpl::MakeGestureEvent(WebInputEvent::Type type,
901 int64_t time_ms, 869 int64_t time_ms,
902 float x, 870 float x,
903 float y) const { 871 float y) const {
904 return WebGestureEventBuilder::Build( 872 return WebGestureEventBuilder::Build(
905 type, time_ms / 1000.0, x / dpi_scale(), y / dpi_scale()); 873 type, time_ms / 1000.0, x / dpi_scale(), y / dpi_scale());
906 } 874 }
907 875
908 void ContentViewCoreImpl::SendGestureEvent( 876 void ContentViewCoreImpl::SendGestureEvent(
909 const blink::WebGestureEvent& event) { 877 const blink::WebGestureEvent& event) {
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
1391 return ScopedJavaLocalRef<jobject>(); 1359 return ScopedJavaLocalRef<jobject>();
1392 1360
1393 return view->GetJavaObject(); 1361 return view->GetJavaObject();
1394 } 1362 }
1395 1363
1396 bool RegisterContentViewCore(JNIEnv* env) { 1364 bool RegisterContentViewCore(JNIEnv* env) {
1397 return RegisterNativesImpl(env); 1365 return RegisterNativesImpl(env);
1398 } 1366 }
1399 1367
1400 } // namespace content 1368 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/android/browser_jni_registrar.cc ('k') | content/browser/android/joystick_scroll_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698