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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "services/ui/ws/platform_display_default.h" 5 #include "services/ui/ws/platform_display_default.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "gpu/ipc/client/gpu_channel_host.h" 10 #include "gpu/ipc/client/gpu_channel_host.h"
11 #include "services/ui/display/screen_manager.h" 11 #include "services/ui/display/screen_manager.h"
12 #include "services/ui/public/interfaces/cursor/cursor_struct_traits.h"
12 #include "services/ui/ws/display_client_compositor_frame_sink.h" 13 #include "services/ui/ws/display_client_compositor_frame_sink.h"
13 #include "services/ui/ws/server_window.h" 14 #include "services/ui/ws/server_window.h"
14 #include "ui/base/cursor/image_cursors.h" 15 #include "ui/base/cursor/image_cursors.h"
15 #include "ui/display/display.h" 16 #include "ui/display/display.h"
16 #include "ui/events/event.h" 17 #include "ui/events/event.h"
17 #include "ui/events/event_utils.h" 18 #include "ui/events/event_utils.h"
18 #include "ui/platform_window/platform_ime_controller.h" 19 #include "ui/platform_window/platform_ime_controller.h"
19 #include "ui/platform_window/platform_window.h" 20 #include "ui/platform_window/platform_window.h"
20 21
21 #if defined(OS_WIN) 22 #if defined(OS_WIN)
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 102
102 void PlatformDisplayDefault::SetCursorById(mojom::CursorType cursor_id) { 103 void PlatformDisplayDefault::SetCursorById(mojom::CursorType cursor_id) {
103 if (!image_cursors_) 104 if (!image_cursors_)
104 return; 105 return;
105 106
106 // TODO(erg): This still isn't sufficient, and will only use native cursors 107 // TODO(erg): This still isn't sufficient, and will only use native cursors
107 // that chrome would use, not custom image cursors. For that, we should 108 // that chrome would use, not custom image cursors. For that, we should
108 // delegate to the window manager to load images from resource packs. 109 // delegate to the window manager to load images from resource packs.
109 // 110 //
110 // We probably also need to deal with different DPIs. 111 // We probably also need to deal with different DPIs.
111 ui::Cursor cursor(static_cast<int32_t>(cursor_id)); 112 ui::CursorType type;
112 image_cursors_->SetPlatformCursor(&cursor); 113 if (mojo::EnumTraits<ui::mojom::CursorType, ui::CursorType>::FromMojom(
113 platform_window_->SetCursor(cursor.platform()); 114 cursor_id, &type)) {
115 ui::Cursor cursor(type);
116 image_cursors_->SetPlatformCursor(&cursor);
117 platform_window_->SetCursor(cursor.platform());
118 }
114 } 119 }
115 120
116 void PlatformDisplayDefault::UpdateTextInputState( 121 void PlatformDisplayDefault::UpdateTextInputState(
117 const ui::TextInputState& state) { 122 const ui::TextInputState& state) {
118 ui::PlatformImeController* ime = platform_window_->GetPlatformImeController(); 123 ui::PlatformImeController* ime = platform_window_->GetPlatformImeController();
119 if (ime) 124 if (ime)
120 ime->UpdateTextInputState(state); 125 ime->UpdateTextInputState(state);
121 } 126 }
122 127
123 void PlatformDisplayDefault::SetImeVisibility(bool visible) { 128 void PlatformDisplayDefault::SetImeVisibility(bool visible) {
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 } 252 }
248 253
249 void PlatformDisplayDefault::OnAcceleratedWidgetDestroyed() { 254 void PlatformDisplayDefault::OnAcceleratedWidgetDestroyed() {
250 NOTREACHED(); 255 NOTREACHED();
251 } 256 }
252 257
253 void PlatformDisplayDefault::OnActivationChanged(bool active) {} 258 void PlatformDisplayDefault::OnActivationChanged(bool active) {}
254 259
255 } // namespace ws 260 } // namespace ws
256 } // namespace ui 261 } // namespace ui
OLDNEW
« 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