OLD | NEW |
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 "ui/views/mus/desktop_window_tree_host_mus.h" | 5 #include "ui/views/mus/desktop_window_tree_host_mus.h" |
6 | 6 |
7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 #include "ui/views/mus/mus_property_mirror.h" | 28 #include "ui/views/mus/mus_property_mirror.h" |
29 #include "ui/views/mus/window_manager_frame_values.h" | 29 #include "ui/views/mus/window_manager_frame_values.h" |
30 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" | 30 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" |
31 #include "ui/views/widget/native_widget_aura.h" | 31 #include "ui/views/widget/native_widget_aura.h" |
32 #include "ui/views/widget/widget_delegate.h" | 32 #include "ui/views/widget/widget_delegate.h" |
33 #include "ui/wm/core/cursor_manager.h" | 33 #include "ui/wm/core/cursor_manager.h" |
34 #include "ui/wm/core/native_cursor_manager.h" | 34 #include "ui/wm/core/native_cursor_manager.h" |
35 #include "ui/wm/core/window_util.h" | 35 #include "ui/wm/core/window_util.h" |
36 #include "ui/wm/public/activation_client.h" | 36 #include "ui/wm/public/activation_client.h" |
37 | 37 |
| 38 #if defined(USE_OZONE) |
| 39 #include "ui/base/cursor/ozone/cursor_data_factory_ozone.h" |
| 40 #endif |
| 41 |
38 namespace views { | 42 namespace views { |
39 | 43 |
40 namespace { | 44 namespace { |
41 | 45 |
42 // As the window manager renderers the non-client decorations this class does | 46 // As the window manager renderers the non-client decorations this class does |
43 // very little but honor the client area insets from the window manager. | 47 // very little but honor the client area insets from the window manager. |
44 class ClientSideNonClientFrameView : public NonClientFrameView { | 48 class ClientSideNonClientFrameView : public NonClientFrameView { |
45 public: | 49 public: |
46 explicit ClientSideNonClientFrameView(views::Widget* widget) | 50 explicit ClientSideNonClientFrameView(views::Widget* widget) |
47 : widget_(widget) {} | 51 : widget_(widget) {} |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 ~NativeCursorManagerMus() override {} | 128 ~NativeCursorManagerMus() override {} |
125 | 129 |
126 // wm::NativeCursorManager: | 130 // wm::NativeCursorManager: |
127 void SetDisplay(const display::Display& display, | 131 void SetDisplay(const display::Display& display, |
128 wm::NativeCursorManagerDelegate* delegate) override { | 132 wm::NativeCursorManagerDelegate* delegate) override { |
129 // We ignore this entirely, as cursor are set on the client. | 133 // We ignore this entirely, as cursor are set on the client. |
130 } | 134 } |
131 | 135 |
132 void SetCursor(gfx::NativeCursor cursor, | 136 void SetCursor(gfx::NativeCursor cursor, |
133 wm::NativeCursorManagerDelegate* delegate) override { | 137 wm::NativeCursorManagerDelegate* delegate) override { |
134 aura::WindowPortMus::Get(window_)->SetPredefinedCursor( | 138 ui::CursorData mojo_cursor; |
135 ui::mojom::CursorType(cursor.native_type())); | 139 if (cursor.platform()) { |
| 140 #if defined(USE_OZONE) |
| 141 mojo_cursor = |
| 142 ui::CursorDataFactoryOzone::GetCursorData(cursor.platform()); |
| 143 #else |
| 144 NOTIMPLEMENTED() |
| 145 << "Can't pass native platform cursors on non-ozone platforms"; |
| 146 mojo_cursor = ui::CursorData(ui::CursorType::kPointer); |
| 147 #endif |
| 148 } else { |
| 149 mojo_cursor = ui::CursorData(cursor.native_type()); |
| 150 } |
| 151 |
| 152 aura::WindowPortMus::Get(window_)->SetCursor(mojo_cursor); |
136 delegate->CommitCursor(cursor); | 153 delegate->CommitCursor(cursor); |
137 } | 154 } |
138 | 155 |
139 void SetVisibility(bool visible, | 156 void SetVisibility(bool visible, |
140 wm::NativeCursorManagerDelegate* delegate) override { | 157 wm::NativeCursorManagerDelegate* delegate) override { |
141 delegate->CommitVisibility(visible); | 158 delegate->CommitVisibility(visible); |
142 | 159 |
143 if (visible) { | 160 if (visible) { |
144 SetCursor(delegate->GetCursor(), delegate); | 161 SetCursor(delegate->GetCursor(), delegate); |
145 } else { | 162 } else { |
146 aura::WindowPortMus::Get(window_)->SetPredefinedCursor( | 163 aura::WindowPortMus::Get(window_)->SetCursor( |
147 ui::mojom::CursorType::kNone); | 164 ui::CursorData(ui::CursorType::kNone)); |
148 } | 165 } |
149 } | 166 } |
150 | 167 |
151 void SetCursorSet(ui::CursorSetType cursor_set, | 168 void SetCursorSet(ui::CursorSetType cursor_set, |
152 wm::NativeCursorManagerDelegate* delegate) override { | 169 wm::NativeCursorManagerDelegate* delegate) override { |
153 // TODO(erg): For now, ignore the difference between SET_NORMAL and | 170 // TODO(erg): For now, ignore the difference between SET_NORMAL and |
154 // SET_LARGE here. This feels like a thing that mus should decide instead. | 171 // SET_LARGE here. This feels like a thing that mus should decide instead. |
155 // | 172 // |
156 // Also, it's NOTIMPLEMENTED() in the desktop version!? Including not | 173 // Also, it's NOTIMPLEMENTED() in the desktop version!? Including not |
157 // acknowledging the call in the delegate. | 174 // acknowledging the call in the delegate. |
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
798 } | 815 } |
799 const gfx::Rect old_bounds_in_pixels = GetBoundsInPixels(); | 816 const gfx::Rect old_bounds_in_pixels = GetBoundsInPixels(); |
800 WindowTreeHostMus::SetBoundsInPixels(final_bounds_in_pixels); | 817 WindowTreeHostMus::SetBoundsInPixels(final_bounds_in_pixels); |
801 if (old_bounds_in_pixels.size() != final_bounds_in_pixels.size()) { | 818 if (old_bounds_in_pixels.size() != final_bounds_in_pixels.size()) { |
802 SendClientAreaToServer(); | 819 SendClientAreaToServer(); |
803 SendHitTestMaskToServer(); | 820 SendHitTestMaskToServer(); |
804 } | 821 } |
805 } | 822 } |
806 | 823 |
807 } // namespace views | 824 } // namespace views |
OLD | NEW |