diff options
Diffstat (limited to 'chromium/ui/android/view_android.cc')
-rw-r--r-- | chromium/ui/android/view_android.cc | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/chromium/ui/android/view_android.cc b/chromium/ui/android/view_android.cc index 7d2e6ded2f0..9de5d840506 100644 --- a/chromium/ui/android/view_android.cc +++ b/chromium/ui/android/view_android.cc @@ -14,9 +14,11 @@ #include "base/stl_util.h" #include "cc/layers/layer.h" #include "components/viz/common/frame_sinks/copy_output_request.h" +#include "third_party/skia/include/core/SkBitmap.h" #include "ui/android/event_forwarder.h" #include "ui/android/ui_android_jni_headers/ViewAndroidDelegate_jni.h" #include "ui/android/window_android.h" +#include "ui/base/cursor/cursor.h" #include "ui/base/cursor/mojom/cursor_type.mojom-shared.h" #include "ui/base/layout.h" #include "ui/events/android/drag_event_android.h" @@ -25,6 +27,7 @@ #include "ui/events/android/key_event_android.h" #include "ui/events/android/motion_event_android.h" #include "ui/gfx/android/java_bitmap.h" +#include "ui/gfx/geometry/point.h" #include "url/gurl.h" namespace ui { @@ -389,25 +392,25 @@ bool ViewAndroid::StartDragAndDrop(const JavaRef<jstring>& jtext, jimage); } -void ViewAndroid::OnCursorChanged(int type, - const SkBitmap& custom_image, - const gfx::Point& hotspot) { +void ViewAndroid::OnCursorChanged(const Cursor& cursor) { ScopedJavaLocalRef<jobject> delegate(GetViewAndroidDelegate()); if (delegate.is_null()) return; JNIEnv* env = base::android::AttachCurrentThread(); - if (type == static_cast<int>(ui::mojom::CursorType::kCustom)) { - if (custom_image.drawsNothing()) { + if (cursor.type() == mojom::CursorType::kCustom) { + const SkBitmap& bitmap = cursor.custom_bitmap(); + const gfx::Point& hotspot = cursor.custom_hotspot(); + if (bitmap.drawsNothing()) { Java_ViewAndroidDelegate_onCursorChanged( - env, delegate, static_cast<int>(ui::mojom::CursorType::kPointer)); + env, delegate, static_cast<int>(mojom::CursorType::kPointer)); return; } - ScopedJavaLocalRef<jobject> java_bitmap = - gfx::ConvertToJavaBitmap(&custom_image); + ScopedJavaLocalRef<jobject> java_bitmap = gfx::ConvertToJavaBitmap(&bitmap); Java_ViewAndroidDelegate_onCursorChangedToCustom(env, delegate, java_bitmap, hotspot.x(), hotspot.y()); } else { - Java_ViewAndroidDelegate_onCursorChanged(env, delegate, type); + Java_ViewAndroidDelegate_onCursorChanged(env, delegate, + static_cast<int>(cursor.type())); } } @@ -461,6 +464,16 @@ void ViewAndroid::OnBrowserControlsHeightChanged() { } } +void ViewAndroid::OnVerticalScrollDirectionChanged(bool direction_up, + float current_scroll_ratio) { + ScopedJavaLocalRef<jobject> delegate(GetViewAndroidDelegate()); + if (delegate.is_null()) + return; + JNIEnv* env = base::android::AttachCurrentThread(); + Java_ViewAndroidDelegate_onVerticalScrollDirectionChanged( + env, delegate, direction_up, current_scroll_ratio); +} + void ViewAndroid::OnSizeChanged(int width, int height) { // Match-parent view must not receive size events. DCHECK(!match_parent()); |