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

Unified Diff: services/ui/ws/platform_display_default.cc

Issue 2833163002: Change ui cursor identifiers to an enum class. (Closed)
Patch Set: OK, it can't be explicit for mac. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « services/ui/ws/event_dispatcher.cc ('k') | services/ui/ws/server_window.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/ui/ws/platform_display_default.cc
diff --git a/services/ui/ws/platform_display_default.cc b/services/ui/ws/platform_display_default.cc
index 08f8f9e26da0b08ec93fad0684ea8ee3cb6c8323..93611c80645ea38269be79af8d4767060cee7d03 100644
--- a/services/ui/ws/platform_display_default.cc
+++ b/services/ui/ws/platform_display_default.cc
@@ -9,6 +9,7 @@
#include "base/memory/ptr_util.h"
#include "gpu/ipc/client/gpu_channel_host.h"
#include "services/ui/display/screen_manager.h"
+#include "services/ui/public/interfaces/cursor/cursor_struct_traits.h"
#include "services/ui/ws/display_client_compositor_frame_sink.h"
#include "services/ui/ws/server_window.h"
#include "ui/base/cursor/image_cursors.h"
@@ -108,9 +109,13 @@ void PlatformDisplayDefault::SetCursorById(mojom::CursorType cursor_id) {
// delegate to the window manager to load images from resource packs.
//
// We probably also need to deal with different DPIs.
- ui::Cursor cursor(static_cast<int32_t>(cursor_id));
- image_cursors_->SetPlatformCursor(&cursor);
- platform_window_->SetCursor(cursor.platform());
+ ui::CursorType type;
+ if (mojo::EnumTraits<ui::mojom::CursorType, ui::CursorType>::FromMojom(
+ cursor_id, &type)) {
+ ui::Cursor cursor(type);
+ image_cursors_->SetPlatformCursor(&cursor);
+ platform_window_->SetCursor(cursor.platform());
+ }
}
void PlatformDisplayDefault::UpdateTextInputState(
« no previous file with comments | « services/ui/ws/event_dispatcher.cc ('k') | services/ui/ws/server_window.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698