| OLD | NEW |
| 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> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/auto_reset.h" | 13 #include "base/auto_reset.h" |
| 14 #include "base/bind.h" | 14 #include "base/bind.h" |
| 15 #include "base/memory/ptr_util.h" | 15 #include "base/memory/ptr_util.h" |
| 16 #include "services/service_manager/public/cpp/connector.h" | 16 #include "services/service_manager/public/cpp/connector.h" |
| 17 #include "services/ui/public/interfaces/window_manager_window_tree_factory.mojom
.h" | 17 #include "services/ui/public/interfaces/window_manager_window_tree_factory.mojom
.h" |
| 18 #include "ui/aura/client/aura_constants.h" | 18 #include "ui/aura/client/aura_constants.h" |
| 19 #include "ui/aura/client/capture_client.h" | 19 #include "ui/aura/client/capture_client.h" |
| 20 #include "ui/aura/client/drag_drop_client.h" |
| 20 #include "ui/aura/client/focus_client.h" | 21 #include "ui/aura/client/focus_client.h" |
| 21 #include "ui/aura/client/transient_window_client.h" | 22 #include "ui/aura/client/transient_window_client.h" |
| 23 #include "ui/aura/mus/drag_drop_controller_mus.h" |
| 22 #include "ui/aura/mus/in_flight_change.h" | 24 #include "ui/aura/mus/in_flight_change.h" |
| 23 #include "ui/aura/mus/input_method_mus.h" | 25 #include "ui/aura/mus/input_method_mus.h" |
| 24 #include "ui/aura/mus/property_converter.h" | 26 #include "ui/aura/mus/property_converter.h" |
| 25 #include "ui/aura/mus/surface_id_handler.h" | 27 #include "ui/aura/mus/surface_id_handler.h" |
| 26 #include "ui/aura/mus/window_manager_delegate.h" | 28 #include "ui/aura/mus/window_manager_delegate.h" |
| 27 #include "ui/aura/mus/window_mus.h" | 29 #include "ui/aura/mus/window_mus.h" |
| 28 #include "ui/aura/mus/window_port_mus.h" | 30 #include "ui/aura/mus/window_port_mus.h" |
| 29 #include "ui/aura/mus/window_tree_client_delegate.h" | 31 #include "ui/aura/mus/window_tree_client_delegate.h" |
| 30 #include "ui/aura/mus/window_tree_client_observer.h" | 32 #include "ui/aura/mus/window_tree_client_observer.h" |
| 31 #include "ui/aura/mus/window_tree_host_mus.h" | 33 #include "ui/aura/mus/window_tree_host_mus.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 WindowTreeHostMus* GetWindowTreeHostMus(WindowMus* window) { | 128 WindowTreeHostMus* GetWindowTreeHostMus(WindowMus* window) { |
| 127 return GetWindowTreeHostMus(window->GetWindow()); | 129 return GetWindowTreeHostMus(window->GetWindow()); |
| 128 } | 130 } |
| 129 | 131 |
| 130 bool IsInternalProperty(const void* key) { | 132 bool IsInternalProperty(const void* key) { |
| 131 return key == client::kModalKey; | 133 return key == client::kModalKey; |
| 132 } | 134 } |
| 133 | 135 |
| 134 } // namespace | 136 } // namespace |
| 135 | 137 |
| 136 struct WindowTreeClient::CurrentDragState { | |
| 137 // The current change id of the current drag an drop ipc. | |
| 138 uint32_t change_id; | |
| 139 | |
| 140 // The effect to return when we send our finish signal. | |
| 141 uint32_t completed_action; | |
| 142 | |
| 143 // Callback executed when a drag initiated by PerformDragDrop() is completed. | |
| 144 base::Callback<void(bool, uint32_t)> on_finished; | |
| 145 }; | |
| 146 | |
| 147 WindowTreeClient::WindowTreeClient( | 138 WindowTreeClient::WindowTreeClient( |
| 148 WindowTreeClientDelegate* delegate, | 139 WindowTreeClientDelegate* delegate, |
| 149 WindowManagerDelegate* window_manager_delegate, | 140 WindowManagerDelegate* window_manager_delegate, |
| 150 mojo::InterfaceRequest<ui::mojom::WindowTreeClient> request) | 141 mojo::InterfaceRequest<ui::mojom::WindowTreeClient> request) |
| 151 : client_id_(0), | 142 : client_id_(0), |
| 152 next_window_id_(1), | 143 next_window_id_(1), |
| 153 next_change_id_(1), | 144 next_change_id_(1), |
| 154 delegate_(delegate), | 145 delegate_(delegate), |
| 155 window_manager_delegate_(window_manager_delegate), | 146 window_manager_delegate_(window_manager_delegate), |
| 156 binding_(this), | 147 binding_(this), |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 // See WindowTreeHostMus for details on ownership. | 464 // See WindowTreeHostMus for details on ownership. |
| 474 new WindowTreeHostMus(base::MakeUnique<WindowPortMus>(this, false), this, | 465 new WindowTreeHostMus(base::MakeUnique<WindowPortMus>(this, false), this, |
| 475 type, display_id, user_window); | 466 type, display_id, user_window); |
| 476 break; | 467 break; |
| 477 } | 468 } |
| 478 } | 469 } |
| 479 WindowMus* user_window_mus = WindowMus::Get(user_window); | 470 WindowMus* user_window_mus = WindowMus::Get(user_window); |
| 480 roots_.insert(user_window_mus); | 471 roots_.insert(user_window_mus); |
| 481 if (!window_data.is_null()) | 472 if (!window_data.is_null()) |
| 482 SetLocalPropertiesFromServerProperties(user_window_mus, window_data); | 473 SetLocalPropertiesFromServerProperties(user_window_mus, window_data); |
| 474 // All WindowTreeHosts are destroyed before this, so we don't need to unset |
| 475 // the DragDropClient. |
| 476 client::SetDragDropClient(user_window->GetRootWindow(), |
| 477 drag_drop_controller_.get()); |
| 483 return user_window; | 478 return user_window; |
| 484 } | 479 } |
| 485 | 480 |
| 486 WindowMus* WindowTreeClient::NewWindowFromWindowData( | 481 WindowMus* WindowTreeClient::NewWindowFromWindowData( |
| 487 WindowMus* parent, | 482 WindowMus* parent, |
| 488 const ui::mojom::WindowDataPtr& window_data) { | 483 const ui::mojom::WindowDataPtr& window_data) { |
| 489 std::unique_ptr<WindowPortMus> window_port_mus( | 484 std::unique_ptr<WindowPortMus> window_port_mus( |
| 490 CreateWindowPortMus(window_data)); | 485 CreateWindowPortMus(window_data)); |
| 491 WindowPortMus* window_port_mus_ptr = window_port_mus.get(); | 486 WindowPortMus* window_port_mus_ptr = window_port_mus.get(); |
| 492 Window* window = new Window(nullptr, std::move(window_port_mus)); | 487 Window* window = new Window(nullptr, std::move(window_port_mus)); |
| 493 WindowMus* window_mus = window_port_mus_ptr; | 488 WindowMus* window_mus = window_port_mus_ptr; |
| 494 window->Init(ui::LAYER_NOT_DRAWN); | 489 window->Init(ui::LAYER_NOT_DRAWN); |
| 495 SetLocalPropertiesFromServerProperties(window_mus, window_data); | 490 SetLocalPropertiesFromServerProperties(window_mus, window_data); |
| 496 window_mus->SetBoundsFromServer(window_data->bounds); | 491 window_mus->SetBoundsFromServer(window_data->bounds); |
| 497 if (parent) | 492 if (parent) |
| 498 parent->AddChildFromServer(window_port_mus_ptr); | 493 parent->AddChildFromServer(window_port_mus_ptr); |
| 499 if (window_data->visible) | 494 if (window_data->visible) |
| 500 window_mus->SetVisibleFromServer(true); | 495 window_mus->SetVisibleFromServer(true); |
| 501 return window_port_mus_ptr; | 496 return window_port_mus_ptr; |
| 502 } | 497 } |
| 503 | 498 |
| 504 void WindowTreeClient::SetWindowTree(ui::mojom::WindowTreePtr window_tree_ptr) { | 499 void WindowTreeClient::SetWindowTree(ui::mojom::WindowTreePtr window_tree_ptr) { |
| 505 tree_ptr_ = std::move(window_tree_ptr); | 500 tree_ptr_ = std::move(window_tree_ptr); |
| 506 tree_ = tree_ptr_.get(); | 501 tree_ = tree_ptr_.get(); |
| 507 | 502 |
| 503 drag_drop_controller_ = base::MakeUnique<DragDropControllerMus>(this, tree_); |
| 504 |
| 508 tree_ptr_->GetCursorLocationMemory( | 505 tree_ptr_->GetCursorLocationMemory( |
| 509 base::Bind(&WindowTreeClient::OnReceivedCursorLocationMemory, | 506 base::Bind(&WindowTreeClient::OnReceivedCursorLocationMemory, |
| 510 weak_factory_.GetWeakPtr())); | 507 weak_factory_.GetWeakPtr())); |
| 511 | 508 |
| 512 tree_ptr_.set_connection_error_handler(base::Bind( | 509 tree_ptr_.set_connection_error_handler(base::Bind( |
| 513 &WindowTreeClient::OnConnectionLost, weak_factory_.GetWeakPtr())); | 510 &WindowTreeClient::OnConnectionLost, weak_factory_.GetWeakPtr())); |
| 514 | 511 |
| 515 if (window_manager_delegate_) { | 512 if (window_manager_delegate_) { |
| 516 tree_ptr_->GetWindowManagerClient(GetProxy(&window_manager_internal_client_, | 513 tree_ptr_->GetWindowManagerClient(GetProxy(&window_manager_internal_client_, |
| 517 tree_ptr_.associated_group())); | 514 tree_ptr_.associated_group())); |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 887 has_pointer_watcher_ = true; | 884 has_pointer_watcher_ = true; |
| 888 tree_->StartPointerWatcher(want_moves); | 885 tree_->StartPointerWatcher(want_moves); |
| 889 } | 886 } |
| 890 | 887 |
| 891 void WindowTreeClient::StopPointerWatcher() { | 888 void WindowTreeClient::StopPointerWatcher() { |
| 892 DCHECK(has_pointer_watcher_); | 889 DCHECK(has_pointer_watcher_); |
| 893 tree_->StopPointerWatcher(); | 890 tree_->StopPointerWatcher(); |
| 894 has_pointer_watcher_ = false; | 891 has_pointer_watcher_ = false; |
| 895 } | 892 } |
| 896 | 893 |
| 897 void WindowTreeClient::PerformDragDrop( | |
| 898 Window* window, | |
| 899 const std::map<std::string, std::vector<uint8_t>>& drag_data, | |
| 900 int drag_operation, | |
| 901 const gfx::Point& cursor_location, | |
| 902 const SkBitmap& bitmap, | |
| 903 const base::Callback<void(bool, uint32_t)>& callback) { | |
| 904 // TODO: dnd. | |
| 905 /* | |
| 906 DCHECK(!current_drag_state_); | |
| 907 | |
| 908 // TODO(erg): Pass |cursor_location| and |bitmap| in PerformDragDrop() when | |
| 909 // we start showing an image representation of the drag under he cursor. | |
| 910 | |
| 911 if (window->drop_target()) { | |
| 912 // To minimize the number of round trips, copy the drag drop data to our | |
| 913 // handler here, instead of forcing mus to send this same data back. | |
| 914 OnDragDropStart( | |
| 915 mojo::Map<mojo::String, mojo::Array<uint8_t>>::From(drag_data)); | |
| 916 } | |
| 917 | |
| 918 uint32_t current_drag_change = ScheduleInFlightChange( | |
| 919 base::MakeUnique<InFlightDragChange>(window, ChangeType::DRAG_LOOP)); | |
| 920 current_drag_state_.reset(new CurrentDragState{ | |
| 921 current_drag_change, ui::mojom::kDropEffectNone, callback}); | |
| 922 | |
| 923 tree_->PerformDragDrop( | |
| 924 current_drag_change, window->server_id(), | |
| 925 mojo::Map<mojo::String, mojo::Array<uint8_t>>::From(drag_data), | |
| 926 drag_operation); | |
| 927 */ | |
| 928 } | |
| 929 | |
| 930 void WindowTreeClient::CancelDragDrop(Window* window) { | |
| 931 // Server will clean up drag and fail the in-flight change. | |
| 932 tree_->CancelDragDrop(WindowMus::Get(window)->server_id()); | |
| 933 } | |
| 934 | |
| 935 void WindowTreeClient::PerformWindowMove( | 894 void WindowTreeClient::PerformWindowMove( |
| 936 Window* window, | 895 Window* window, |
| 937 ui::mojom::MoveLoopSource source, | 896 ui::mojom::MoveLoopSource source, |
| 938 const gfx::Point& cursor_location, | 897 const gfx::Point& cursor_location, |
| 939 const base::Callback<void(bool)>& callback) { | 898 const base::Callback<void(bool)>& callback) { |
| 940 DCHECK(on_current_move_finished_.is_null()); | 899 DCHECK(on_current_move_finished_.is_null()); |
| 941 on_current_move_finished_ = callback; | 900 on_current_move_finished_ = callback; |
| 942 | 901 |
| 943 WindowMus* window_mus = WindowMus::Get(window); | 902 WindowMus* window_mus = WindowMus::Get(window); |
| 944 current_move_loop_change_ = ScheduleInFlightChange( | 903 current_move_loop_change_ = ScheduleInFlightChange( |
| (...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1350 std::unique_ptr<SurfaceInfo> surface_info(base::MakeUnique<SurfaceInfo>()); | 1309 std::unique_ptr<SurfaceInfo> surface_info(base::MakeUnique<SurfaceInfo>()); |
| 1351 surface_info->surface_id = surface_id; | 1310 surface_info->surface_id = surface_id; |
| 1352 surface_info->surface_sequence = surface_sequence; | 1311 surface_info->surface_sequence = surface_sequence; |
| 1353 surface_info->frame_size = frame_size; | 1312 surface_info->frame_size = frame_size; |
| 1354 surface_info->device_scale_factor = device_scale_factor; | 1313 surface_info->device_scale_factor = device_scale_factor; |
| 1355 window->SetSurfaceIdFromServer(std::move(surface_info)); | 1314 window->SetSurfaceIdFromServer(std::move(surface_info)); |
| 1356 } | 1315 } |
| 1357 | 1316 |
| 1358 void WindowTreeClient::OnDragDropStart( | 1317 void WindowTreeClient::OnDragDropStart( |
| 1359 mojo::Map<mojo::String, mojo::Array<uint8_t>> mime_data) { | 1318 mojo::Map<mojo::String, mojo::Array<uint8_t>> mime_data) { |
| 1360 mime_drag_data_ = std::move(mime_data); | 1319 drag_drop_controller_->OnDragDropStart( |
| 1320 mime_data.To<std::map<std::string, std::vector<uint8_t>>>()); |
| 1361 } | 1321 } |
| 1362 | 1322 |
| 1363 void WindowTreeClient::OnDragEnter(Id window_id, | 1323 void WindowTreeClient::OnDragEnter(Id window_id, |
| 1364 uint32_t key_state, | 1324 uint32_t key_state, |
| 1365 const gfx::Point& position, | 1325 const gfx::Point& position, |
| 1366 uint32_t effect_bitmask, | 1326 uint32_t effect_bitmask, |
| 1367 const OnDragEnterCallback& callback) { | 1327 const OnDragEnterCallback& callback) { |
| 1368 // TODO: dnd. | 1328 callback.Run(drag_drop_controller_->OnDragEnter( |
| 1369 /* | 1329 GetWindowByServerId(window_id), key_state, position, effect_bitmask)); |
| 1370 Window* window = GetWindowByServerId(window_id); | |
| 1371 if (!window || !window->drop_target()) { | |
| 1372 callback.Run(ui::mojom::kDropEffectNone); | |
| 1373 return; | |
| 1374 } | |
| 1375 | |
| 1376 if (!base::ContainsKey(drag_entered_windows_, window_id)) { | |
| 1377 window->drop_target()->OnDragDropStart( | |
| 1378 mime_drag_data_.To<std::map<std::string, std::vector<uint8_t>>>()); | |
| 1379 drag_entered_windows_.insert(window_id); | |
| 1380 } | |
| 1381 | |
| 1382 uint32_t ret = | |
| 1383 window->drop_target()->OnDragEnter(key_state, position, effect_bitmask); | |
| 1384 callback.Run(ret); | |
| 1385 */ | |
| 1386 } | 1330 } |
| 1387 | 1331 |
| 1388 void WindowTreeClient::OnDragOver(Id window_id, | 1332 void WindowTreeClient::OnDragOver(Id window_id, |
| 1389 uint32_t key_state, | 1333 uint32_t key_state, |
| 1390 const gfx::Point& position, | 1334 const gfx::Point& position, |
| 1391 uint32_t effect_bitmask, | 1335 uint32_t effect_bitmask, |
| 1392 const OnDragOverCallback& callback) { | 1336 const OnDragOverCallback& callback) { |
| 1393 // TODO: dnd. | 1337 callback.Run(drag_drop_controller_->OnDragOver( |
| 1394 /* | 1338 GetWindowByServerId(window_id), key_state, position, effect_bitmask)); |
| 1395 Window* window = GetWindowByServerId(window_id); | |
| 1396 if (!window || !window->drop_target()) { | |
| 1397 callback.Run(ui::mojom::kDropEffectNone); | |
| 1398 return; | |
| 1399 } | |
| 1400 | |
| 1401 uint32_t ret = | |
| 1402 window->drop_target()->OnDragOver(key_state, position, effect_bitmask); | |
| 1403 callback.Run(ret); | |
| 1404 */ | |
| 1405 } | 1339 } |
| 1406 | 1340 |
| 1407 void WindowTreeClient::OnDragLeave(Id window_id) { | 1341 void WindowTreeClient::OnDragLeave(Id window_id) { |
| 1408 // TODO: dnd. | 1342 drag_drop_controller_->OnDragLeave(GetWindowByServerId(window_id)); |
| 1409 /* | |
| 1410 Window* window = GetWindowByServerId(window_id); | |
| 1411 if (!window || !window->drop_target()) | |
| 1412 return; | |
| 1413 | |
| 1414 window->drop_target()->OnDragLeave(); | |
| 1415 */ | |
| 1416 } | 1343 } |
| 1417 | 1344 |
| 1418 void WindowTreeClient::OnDragDropDone() { | 1345 void WindowTreeClient::OnDragDropDone() { |
| 1419 // TODO: dnd. | 1346 drag_drop_controller_->OnDragDropDone(); |
| 1420 /* | |
| 1421 for (Id id : drag_entered_windows_) { | |
| 1422 Window* window = GetWindowByServerId(id); | |
| 1423 if (!window || !window->drop_target()) | |
| 1424 continue; | |
| 1425 window->drop_target()->OnDragDropDone(); | |
| 1426 } | |
| 1427 drag_entered_windows_.clear(); | |
| 1428 */ | |
| 1429 } | 1347 } |
| 1430 | 1348 |
| 1431 void WindowTreeClient::OnCompleteDrop(Id window_id, | 1349 void WindowTreeClient::OnCompleteDrop(Id window_id, |
| 1432 uint32_t key_state, | 1350 uint32_t key_state, |
| 1433 const gfx::Point& position, | 1351 const gfx::Point& position, |
| 1434 uint32_t effect_bitmask, | 1352 uint32_t effect_bitmask, |
| 1435 const OnCompleteDropCallback& callback) { | 1353 const OnCompleteDropCallback& callback) { |
| 1436 // TODO: dnd. | 1354 callback.Run(drag_drop_controller_->OnCompleteDrop( |
| 1437 /* | 1355 GetWindowByServerId(window_id), key_state, position, effect_bitmask)); |
| 1438 Window* window = GetWindowByServerId(window_id); | |
| 1439 if (!window || !window->drop_target()) { | |
| 1440 callback.Run(ui::mojom::kDropEffectNone); | |
| 1441 return; | |
| 1442 } | |
| 1443 | |
| 1444 uint32_t ret = window->drop_target()->OnCompleteDrop(key_state, position, | |
| 1445 effect_bitmask); | |
| 1446 callback.Run(ret); | |
| 1447 */ | |
| 1448 } | 1356 } |
| 1449 | 1357 |
| 1450 void WindowTreeClient::OnPerformDragDropCompleted(uint32_t change_id, | 1358 void WindowTreeClient::OnPerformDragDropCompleted(uint32_t change_id, |
| 1451 bool success, | 1359 bool success, |
| 1452 uint32_t action_taken) { | 1360 uint32_t action_taken) { |
| 1453 // TODO: dnd. | 1361 if (drag_drop_controller_->DoesChangeIdMatchDragChangeId(change_id)) { |
| 1454 /* | |
| 1455 if (current_drag_state_ && change_id == current_drag_state_->change_id) { | |
| 1456 current_drag_state_->completed_action = action_taken; | |
| 1457 OnChangeCompleted(change_id, success); | 1362 OnChangeCompleted(change_id, success); |
| 1363 drag_drop_controller_->OnPerformDragDropCompleted(action_taken); |
| 1458 } | 1364 } |
| 1459 */ | |
| 1460 } | 1365 } |
| 1461 | 1366 |
| 1462 void WindowTreeClient::OnChangeCompleted(uint32_t change_id, bool success) { | 1367 void WindowTreeClient::OnChangeCompleted(uint32_t change_id, bool success) { |
| 1463 std::unique_ptr<InFlightChange> change(std::move(in_flight_map_[change_id])); | 1368 std::unique_ptr<InFlightChange> change(std::move(in_flight_map_[change_id])); |
| 1464 in_flight_map_.erase(change_id); | 1369 in_flight_map_.erase(change_id); |
| 1465 if (!change) | 1370 if (!change) |
| 1466 return; | 1371 return; |
| 1467 | 1372 |
| 1468 if (!success) | 1373 if (!success) |
| 1469 change->ChangeFailed(); | 1374 change->ChangeFailed(); |
| 1470 | 1375 |
| 1471 InFlightChange* next_change = GetOldestInFlightChangeMatching(*change); | 1376 InFlightChange* next_change = GetOldestInFlightChangeMatching(*change); |
| 1472 if (next_change) { | 1377 if (next_change) { |
| 1473 if (!success) | 1378 if (!success) |
| 1474 next_change->SetRevertValueFrom(*change); | 1379 next_change->SetRevertValueFrom(*change); |
| 1475 } else if (!success) { | 1380 } else if (!success) { |
| 1476 change->Revert(); | 1381 change->Revert(); |
| 1477 } | 1382 } |
| 1478 | 1383 |
| 1479 if (change_id == current_move_loop_change_) { | 1384 if (change_id == current_move_loop_change_) { |
| 1480 current_move_loop_change_ = 0; | 1385 current_move_loop_change_ = 0; |
| 1481 on_current_move_finished_.Run(success); | 1386 on_current_move_finished_.Run(success); |
| 1482 on_current_move_finished_.Reset(); | 1387 on_current_move_finished_.Reset(); |
| 1483 } | 1388 } |
| 1484 | |
| 1485 if (current_drag_state_ && change_id == current_drag_state_->change_id) { | |
| 1486 OnDragDropDone(); | |
| 1487 | |
| 1488 current_drag_state_->on_finished.Run(success, | |
| 1489 current_drag_state_->completed_action); | |
| 1490 current_drag_state_.reset(); | |
| 1491 } | |
| 1492 } | 1389 } |
| 1493 | 1390 |
| 1494 void WindowTreeClient::GetWindowManager( | 1391 void WindowTreeClient::GetWindowManager( |
| 1495 mojo::AssociatedInterfaceRequest<WindowManager> internal) { | 1392 mojo::AssociatedInterfaceRequest<WindowManager> internal) { |
| 1496 window_manager_internal_.reset( | 1393 window_manager_internal_.reset( |
| 1497 new mojo::AssociatedBinding<ui::mojom::WindowManager>( | 1394 new mojo::AssociatedBinding<ui::mojom::WindowManager>( |
| 1498 this, std::move(internal))); | 1395 this, std::move(internal))); |
| 1499 } | 1396 } |
| 1500 | 1397 |
| 1501 void WindowTreeClient::RequestClose(uint32_t window_id) { | 1398 void WindowTreeClient::RequestClose(uint32_t window_id) { |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1557 window_manager_internal_client_->WmResponse(change_id, result); | 1454 window_manager_internal_client_->WmResponse(change_id, result); |
| 1558 } | 1455 } |
| 1559 | 1456 |
| 1560 void WindowTreeClient::WmSetProperty(uint32_t change_id, | 1457 void WindowTreeClient::WmSetProperty(uint32_t change_id, |
| 1561 Id window_id, | 1458 Id window_id, |
| 1562 const mojo::String& name, | 1459 const mojo::String& name, |
| 1563 mojo::Array<uint8_t> transit_data) { | 1460 mojo::Array<uint8_t> transit_data) { |
| 1564 WindowMus* window = GetWindowByServerId(window_id); | 1461 WindowMus* window = GetWindowByServerId(window_id); |
| 1565 bool result = false; | 1462 bool result = false; |
| 1566 if (window) { | 1463 if (window) { |
| 1567 // TODO: map properties. | |
| 1568 DCHECK(window_manager_delegate_); | 1464 DCHECK(window_manager_delegate_); |
| 1569 std::unique_ptr<std::vector<uint8_t>> data; | 1465 std::unique_ptr<std::vector<uint8_t>> data; |
| 1570 if (!transit_data.is_null()) { | 1466 if (!transit_data.is_null()) { |
| 1571 data.reset( | 1467 data.reset( |
| 1572 new std::vector<uint8_t>(transit_data.To<std::vector<uint8_t>>())); | 1468 new std::vector<uint8_t>(transit_data.To<std::vector<uint8_t>>())); |
| 1573 } | 1469 } |
| 1574 result = window_manager_delegate_->OnWmSetProperty(window->GetWindow(), | 1470 result = window_manager_delegate_->OnWmSetProperty(window->GetWindow(), |
| 1575 name, &data); | 1471 name, &data); |
| 1576 if (result) { | 1472 if (result) { |
| 1577 delegate_->GetPropertyConverter()->SetPropertyFromTransportValue( | 1473 delegate_->GetPropertyConverter()->SetPropertyFromTransportValue( |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1786 } | 1682 } |
| 1787 // The change originated from client code and needs to be sent to the server. | 1683 // The change originated from client code and needs to be sent to the server. |
| 1788 DCHECK(tree_); | 1684 DCHECK(tree_); |
| 1789 WindowMus* child_mus = WindowMus::Get(transient_child); | 1685 WindowMus* child_mus = WindowMus::Get(transient_child); |
| 1790 const uint32_t change_id = | 1686 const uint32_t change_id = |
| 1791 ScheduleInFlightChange(base::MakeUnique<CrashInFlightChange>( | 1687 ScheduleInFlightChange(base::MakeUnique<CrashInFlightChange>( |
| 1792 child_mus, ChangeType::REMOVE_TRANSIENT_WINDOW_FROM_PARENT)); | 1688 child_mus, ChangeType::REMOVE_TRANSIENT_WINDOW_FROM_PARENT)); |
| 1793 tree_->RemoveTransientWindowFromParent(change_id, child_mus->server_id()); | 1689 tree_->RemoveTransientWindowFromParent(change_id, child_mus->server_id()); |
| 1794 } | 1690 } |
| 1795 | 1691 |
| 1692 uint32_t WindowTreeClient::CreateChangeIdForDrag(WindowMus* window) { |
| 1693 return ScheduleInFlightChange( |
| 1694 base::MakeUnique<InFlightDragChange>(window, ChangeType::DRAG_LOOP)); |
| 1695 } |
| 1696 |
| 1796 } // namespace aura | 1697 } // namespace aura |
| OLD | NEW |