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

Side by Side Diff: ui/aura/mus/window_tree_client.cc

Issue 2830703003: [views-mus] Support custom cursors. (Closed)
Patch Set: rebase to tot 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/aura/mus/window_tree_client.h" 5 #include "ui/aura/mus/window_tree_client.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 automatically_create_display_roots); 295 automatically_create_display_roots);
296 SetWindowTree(std::move(window_tree)); 296 SetWindowTree(std::move(window_tree));
297 } 297 }
298 298
299 void WindowTreeClient::SetCanFocus(Window* window, bool can_focus) { 299 void WindowTreeClient::SetCanFocus(Window* window, bool can_focus) {
300 DCHECK(tree_); 300 DCHECK(tree_);
301 DCHECK(window); 301 DCHECK(window);
302 tree_->SetCanFocus(WindowMus::Get(window)->server_id(), can_focus); 302 tree_->SetCanFocus(WindowMus::Get(window)->server_id(), can_focus);
303 } 303 }
304 304
305 void WindowTreeClient::SetPredefinedCursor(WindowMus* window, 305 void WindowTreeClient::SetCursor(WindowMus* window,
306 ui::mojom::CursorType old_cursor, 306 const ui::CursorData& old_cursor,
307 ui::mojom::CursorType new_cursor) { 307 const ui::CursorData& new_cursor) {
308 DCHECK(tree_); 308 DCHECK(tree_);
309 309
310 const uint32_t change_id = ScheduleInFlightChange( 310 const uint32_t change_id = ScheduleInFlightChange(
311 base::MakeUnique<InFlightPredefinedCursorChange>(window, old_cursor)); 311 base::MakeUnique<InFlightCursorChange>(window, old_cursor));
312 tree_->SetPredefinedCursor(change_id, window->server_id(), new_cursor); 312 tree_->SetCursor(change_id, window->server_id(), new_cursor);
313 } 313 }
314 314
315 void WindowTreeClient::SetWindowTextInputState(WindowMus* window, 315 void WindowTreeClient::SetWindowTextInputState(WindowMus* window,
316 mojo::TextInputStatePtr state) { 316 mojo::TextInputStatePtr state) {
317 DCHECK(tree_); 317 DCHECK(tree_);
318 tree_->SetWindowTextInputState(window->server_id(), std::move(state)); 318 tree_->SetWindowTextInputState(window->server_id(), std::move(state));
319 } 319 }
320 320
321 void WindowTreeClient::SetImeVisibility(WindowMus* window, 321 void WindowTreeClient::SetImeVisibility(WindowMus* window,
322 bool visible, 322 bool visible,
(...skipping 1010 matching lines...) Expand 10 before | Expand all | Expand 10 after
1333 void WindowTreeClient::OnWindowFocused(Id focused_window_id) { 1333 void WindowTreeClient::OnWindowFocused(Id focused_window_id) {
1334 WindowMus* focused_window = GetWindowByServerId(focused_window_id); 1334 WindowMus* focused_window = GetWindowByServerId(focused_window_id);
1335 InFlightFocusChange new_change(this, focus_synchronizer_.get(), 1335 InFlightFocusChange new_change(this, focus_synchronizer_.get(),
1336 focused_window); 1336 focused_window);
1337 if (ApplyServerChangeToExistingInFlightChange(new_change)) 1337 if (ApplyServerChangeToExistingInFlightChange(new_change))
1338 return; 1338 return;
1339 1339
1340 focus_synchronizer_->SetFocusFromServer(focused_window); 1340 focus_synchronizer_->SetFocusFromServer(focused_window);
1341 } 1341 }
1342 1342
1343 void WindowTreeClient::OnWindowPredefinedCursorChanged( 1343 void WindowTreeClient::OnWindowCursorChanged(Id window_id,
1344 Id window_id, 1344 ui::CursorData cursor) {
1345 ui::mojom::CursorType cursor) {
1346 WindowMus* window = GetWindowByServerId(window_id); 1345 WindowMus* window = GetWindowByServerId(window_id);
1347 if (!window) 1346 if (!window)
1348 return; 1347 return;
1349 1348
1350 InFlightPredefinedCursorChange new_change(window, cursor); 1349 InFlightCursorChange new_change(window, cursor);
1351 if (ApplyServerChangeToExistingInFlightChange(new_change)) 1350 if (ApplyServerChangeToExistingInFlightChange(new_change))
1352 return; 1351 return;
1353 1352
1354 window->SetPredefinedCursorFromServer(cursor); 1353 window->SetCursorFromServer(cursor);
1355 } 1354 }
1356 1355
1357 void WindowTreeClient::OnWindowSurfaceChanged( 1356 void WindowTreeClient::OnWindowSurfaceChanged(
1358 Id window_id, 1357 Id window_id,
1359 const cc::SurfaceInfo& surface_info) { 1358 const cc::SurfaceInfo& surface_info) {
1360 WindowMus* window = GetWindowByServerId(window_id); 1359 WindowMus* window = GetWindowByServerId(window_id);
1361 if (!window) 1360 if (!window)
1362 return; 1361 return;
1363 if (enable_surface_synchronization_) { 1362 if (enable_surface_synchronization_) {
1364 // If surface synchronization is enabled, and the parent is informed 1363 // If surface synchronization is enabled, and the parent is informed
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
1764 void WindowTreeClient::SetFrameDecorationValues( 1763 void WindowTreeClient::SetFrameDecorationValues(
1765 ui::mojom::FrameDecorationValuesPtr values) { 1764 ui::mojom::FrameDecorationValuesPtr values) {
1766 if (window_manager_internal_client_) { 1765 if (window_manager_internal_client_) {
1767 normal_client_area_insets_ = values->normal_client_area_insets; 1766 normal_client_area_insets_ = values->normal_client_area_insets;
1768 window_manager_internal_client_->WmSetFrameDecorationValues( 1767 window_manager_internal_client_->WmSetFrameDecorationValues(
1769 std::move(values)); 1768 std::move(values));
1770 } 1769 }
1771 } 1770 }
1772 1771
1773 void WindowTreeClient::SetNonClientCursor(Window* window, 1772 void WindowTreeClient::SetNonClientCursor(Window* window,
1774 ui::mojom::CursorType cursor_id) { 1773 const ui::CursorData& cursor) {
1775 if (window_manager_internal_client_) { 1774 if (window_manager_internal_client_) {
1776 window_manager_internal_client_->WmSetNonClientCursor( 1775 window_manager_internal_client_->WmSetNonClientCursor(
1777 WindowMus::Get(window)->server_id(), cursor_id); 1776 WindowMus::Get(window)->server_id(), cursor);
1778 } 1777 }
1779 } 1778 }
1780 1779
1781 void WindowTreeClient::AddAccelerators( 1780 void WindowTreeClient::AddAccelerators(
1782 std::vector<ui::mojom::WmAcceleratorPtr> accelerators, 1781 std::vector<ui::mojom::WmAcceleratorPtr> accelerators,
1783 const base::Callback<void(bool)>& callback) { 1782 const base::Callback<void(bool)>& callback) {
1784 if (window_manager_internal_client_) { 1783 if (window_manager_internal_client_) {
1785 window_manager_internal_client_->AddAccelerators(std::move(accelerators), 1784 window_manager_internal_client_->AddAccelerators(std::move(accelerators),
1786 callback); 1785 callback);
1787 } 1786 }
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
2031 return ScheduleInFlightChange(base::MakeUnique<InFlightCaptureChange>( 2030 return ScheduleInFlightChange(base::MakeUnique<InFlightCaptureChange>(
2032 this, capture_synchronizer_.get(), window)); 2031 this, capture_synchronizer_.get(), window));
2033 } 2032 }
2034 2033
2035 uint32_t WindowTreeClient::CreateChangeIdForFocus(WindowMus* window) { 2034 uint32_t WindowTreeClient::CreateChangeIdForFocus(WindowMus* window) {
2036 return ScheduleInFlightChange(base::MakeUnique<InFlightFocusChange>( 2035 return ScheduleInFlightChange(base::MakeUnique<InFlightFocusChange>(
2037 this, focus_synchronizer_.get(), window)); 2036 this, focus_synchronizer_.get(), window));
2038 } 2037 }
2039 2038
2040 } // namespace aura 2039 } // namespace aura
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698