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

Unified Diff: content/browser/renderer_host/render_widget_host_view_android.cc

Issue 2878403002: Support setting mouse cursor icon in Android N. (Closed)
Patch Set: Support setting pointer icon in Android N Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | device/power_save_blocker/BUILD.gn » ('j') | device/power_save_blocker/BUILD.gn » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/render_widget_host_view_android.cc
diff --git a/content/browser/renderer_host/render_widget_host_view_android.cc b/content/browser/renderer_host/render_widget_host_view_android.cc
index 3d5e597188c7408a5d07df7f34927b96ab9a78e0..d67b325907c52ac195d4788fa30e80a254b713a7 100644
--- a/content/browser/renderer_host/render_widget_host_view_android.cc
+++ b/content/browser/renderer_host/render_widget_host_view_android.cc
@@ -76,9 +76,11 @@
#include "ipc/ipc_message_macros.h"
#include "ipc/ipc_message_start.h"
#include "skia/ext/image_operations.h"
+#include "third_party/WebKit/public/platform/WebCursorInfo.h"
#include "third_party/khronos/GLES2/gl2.h"
#include "third_party/khronos/GLES2/gl2ext.h"
#include "third_party/skia/include/core/SkCanvas.h"
+#include "ui/android/cursor_type.h"
#include "ui/android/window_android.h"
#include "ui/android/window_android_compositor.h"
#include "ui/base/layout.h"
@@ -122,6 +124,8 @@ class PendingReadbackLock : public base::RefCounted<PendingReadbackLock> {
using base::android::ApplicationState;
using base::android::ApplicationStatusListener;
+using blink::WebCursorInfo;
+using ui::CursorType;
class GLHelperHolder {
public:
@@ -703,7 +707,90 @@ float RenderWidgetHostViewAndroid::GetBottomControlsHeight() const {
}
void RenderWidgetHostViewAndroid::UpdateCursor(const WebCursor& cursor) {
- // There are no cursors on Android.
+ if (!content_view_core_)
aelias_OOO_until_Jul13 2017/05/17 04:47:15 No longer needed.
Jinsuk Kim 2017/05/17 04:49:50 No need to do this check.
jaebaek 2017/05/18 01:44:28 Done.
jaebaek 2017/05/18 01:44:28 Done.
+ return;
+
+ CursorInfo cursor_info;
+ cursor.GetCursorInfo(&cursor_info);
+ CursorType cursor_type;
+ switch (cursor_info.type) {
+ case WebCursorInfo::kTypeCustom:
+ cursor_type = CursorType::CURSOR_TYPE_CUSTOM;
+ break;
+ case WebCursorInfo::kTypeNone:
+ cursor_type = CursorType::CURSOR_TYPE_NULL;
+ break;
+ case WebCursorInfo::kTypePointer:
+ cursor_type = CursorType::CURSOR_TYPE_ARROW;
+ break;
+ case WebCursorInfo::kTypeContextMenu:
+ cursor_type = CursorType::CURSOR_TYPE_CONTEXT_MENU;
+ break;
+ case WebCursorInfo::kTypeHand:
+ cursor_type = CursorType::CURSOR_TYPE_HAND;
+ break;
+ case WebCursorInfo::kTypeHelp:
+ cursor_type = CursorType::CURSOR_TYPE_HELP;
+ break;
+ case WebCursorInfo::kTypeWait:
+ cursor_type = CursorType::CURSOR_TYPE_WAIT;
+ break;
+ case WebCursorInfo::kTypeCell:
+ cursor_type = CursorType::CURSOR_TYPE_CELL;
+ break;
+ case WebCursorInfo::kTypeCross:
+ cursor_type = CursorType::CURSOR_TYPE_CROSSHAIR;
+ break;
+ case WebCursorInfo::kTypeIBeam:
+ cursor_type = CursorType::CURSOR_TYPE_TEXT;
+ break;
+ case WebCursorInfo::kTypeVerticalText:
+ cursor_type = CursorType::CURSOR_TYPE_VERTICAL_TEXT;
+ break;
+ case WebCursorInfo::kTypeAlias:
+ cursor_type = CursorType::CURSOR_TYPE_ALIAS;
+ break;
+ case WebCursorInfo::kTypeCopy:
+ cursor_type = CursorType::CURSOR_TYPE_COPY;
+ break;
+ case WebCursorInfo::kTypeNoDrop:
+ cursor_type = CursorType::CURSOR_TYPE_NO_DROP;
+ break;
+ case WebCursorInfo::kTypeEastWestResize:
+ case WebCursorInfo::kTypeColumnResize:
+ cursor_type = CursorType::CURSOR_TYPE_HORIZONTAL_DOUBLE_ARROW;
+ break;
+ case WebCursorInfo::kTypeNorthSouthResize:
+ case WebCursorInfo::kTypeRowResize:
+ cursor_type = CursorType::CURSOR_TYPE_VERTICAL_DOUBLE_ARROW;
+ break;
+ case WebCursorInfo::kTypeNorthEastSouthWestResize:
+ cursor_type = CursorType::CURSOR_TYPE_TOP_RIGHT_DIAGONAL_DOUBLE_ARROW;
+ break;
+ case WebCursorInfo::kTypeNorthWestSouthEastResize:
+ cursor_type = CursorType::CURSOR_TYPE_TOP_LEFT_DIAGONAL_DOUBLE_ARROW;
+ break;
+ case WebCursorInfo::kTypeZoomIn:
+ cursor_type = CursorType::CURSOR_TYPE_ZOOM_IN;
+ break;
+ case WebCursorInfo::kTypeZoomOut:
+ cursor_type = CursorType::CURSOR_TYPE_ZOOM_OUT;
+ break;
+ case WebCursorInfo::kTypeGrab:
+ cursor_type = CursorType::CURSOR_TYPE_GRAB;
+ break;
+ case WebCursorInfo::kTypeGrabbing:
+ cursor_type = CursorType::CURSOR_TYPE_GRABBING;
+ break;
+ default:
+ LOG(WARNING) << "Invalid cursor type: "
aelias_OOO_until_Jul13 2017/05/17 04:47:15 This is likely to spam logs and the problem is not
jaebaek 2017/05/18 01:44:28 Done.
+ << WebCursorInfo::GetName(cursor_info.type) << " ("
+ << cursor_info.type << ")";
+ cursor_type = CursorType::CURSOR_TYPE_ARROW;
+ break;
+ }
+ view_.OnCursorChanged(cursor_type, cursor_info.custom_image,
+ cursor_info.hotspot);
}
void RenderWidgetHostViewAndroid::SetIsLoading(bool is_loading) {
« no previous file with comments | « no previous file | device/power_save_blocker/BUILD.gn » ('j') | device/power_save_blocker/BUILD.gn » ('J')

Powered by Google App Engine
This is Rietveld 408576698