Replace content::CursorInfo with ui::Cursor

https://chromium-review.googlesource.com/c/chromium/src/+/1999201
This commit is contained in:
John Kleinschmidt
2020-03-11 16:55:33 -04:00
parent 34350db4bd
commit 6b3b850692
3 changed files with 13 additions and 12 deletions

View File

@@ -2337,17 +2337,18 @@ bool WebContents::IsBeingCaptured() {
return web_contents()->IsBeingCaptured();
}
void WebContents::OnCursorChange(const content::WebCursor& cursor) {
const content::CursorInfo& info = cursor.info();
void WebContents::OnCursorChange(const content::WebCursor& webcursor) {
const ui::Cursor& cursor = webcursor.cursor();
if (info.type == ui::mojom::CursorType::kCustom) {
Emit("cursor-changed", CursorTypeToString(info),
gfx::Image::CreateFrom1xBitmap(info.custom_image),
info.image_scale_factor,
gfx::Size(info.custom_image.width(), info.custom_image.height()),
info.hotspot);
if (cursor.type() == ui::mojom::CursorType::kCustom) {
Emit("cursor-changed", CursorTypeToString(cursor),
gfx::Image::CreateFrom1xBitmap(cursor.custom_bitmap()),
cursor.image_scale_factor(),
gfx::Size(cursor.custom_bitmap().width(),
cursor.custom_bitmap().height()),
cursor.custom_hotspot());
} else {
Emit("cursor-changed", CursorTypeToString(info));
Emit("cursor-changed", CursorTypeToString(cursor));
}
}

View File

@@ -11,8 +11,8 @@ using Cursor = ui::mojom::CursorType;
namespace electron {
std::string CursorTypeToString(const content::CursorInfo& info) {
switch (info.type) {
std::string CursorTypeToString(const ui::Cursor& cursor) {
switch (cursor.type()) {
case Cursor::kPointer:
return "default";
case Cursor::kCross:

View File

@@ -27,7 +27,7 @@
namespace electron {
// Returns the cursor's type as a string.
std::string CursorTypeToString(const content::CursorInfo& info);
std::string CursorTypeToString(const ui::Cursor& cursor);
} // namespace electron