Chromium Code Reviews| 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> |
| (...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 474 gfx::ConvertRectToDIP(ScaleFactorForDisplay(window), window_data.bounds)); | 474 gfx::ConvertRectToDIP(ScaleFactorForDisplay(window), window_data.bounds)); |
| 475 if (parent) | 475 if (parent) |
| 476 parent->AddChildFromServer(window_port_mus_ptr); | 476 parent->AddChildFromServer(window_port_mus_ptr); |
| 477 if (window_data.visible) | 477 if (window_data.visible) |
| 478 window_mus->SetVisibleFromServer(true); | 478 window_mus->SetVisibleFromServer(true); |
| 479 return window_port_mus_ptr; | 479 return window_port_mus_ptr; |
| 480 } | 480 } |
| 481 | 481 |
| 482 void WindowTreeClient::SetWindowTree(ui::mojom::WindowTreePtr window_tree_ptr) { | 482 void WindowTreeClient::SetWindowTree(ui::mojom::WindowTreePtr window_tree_ptr) { |
| 483 tree_ptr_ = std::move(window_tree_ptr); | 483 tree_ptr_ = std::move(window_tree_ptr); |
| 484 | |
| 485 // Enable nested dispatch on both sides of this connect because these objects | |
| 486 // are used in the presence of nested runloops, such as those during drag and | |
| 487 // drop. | |
| 488 binding_.EnableNestedDispatch(true); | |
| 489 tree_ptr_.EnableNestedDispatch(true); | |
| 490 | |
| 484 WindowTreeConnectionEstablished(tree_ptr_.get()); | 491 WindowTreeConnectionEstablished(tree_ptr_.get()); |
| 485 tree_ptr_->GetCursorLocationMemory( | 492 tree_ptr_->GetCursorLocationMemory( |
| 486 base::Bind(&WindowTreeClient::OnReceivedCursorLocationMemory, | 493 base::Bind(&WindowTreeClient::OnReceivedCursorLocationMemory, |
| 487 weak_factory_.GetWeakPtr())); | 494 weak_factory_.GetWeakPtr())); |
| 488 | 495 |
| 489 tree_ptr_.set_connection_error_handler(base::Bind( | 496 tree_ptr_.set_connection_error_handler(base::Bind( |
| 490 &WindowTreeClient::OnConnectionLost, weak_factory_.GetWeakPtr())); | 497 &WindowTreeClient::OnConnectionLost, weak_factory_.GetWeakPtr())); |
| 491 | 498 |
| 492 if (window_manager_delegate_) { | 499 if (window_manager_delegate_) { |
| 493 tree_ptr_->GetWindowManagerClient( | 500 tree_ptr_->GetWindowManagerClient( |
| (...skipping 892 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1386 gfx::Rect bounds_in_dip = transit_bounds_in_dip; | 1393 gfx::Rect bounds_in_dip = transit_bounds_in_dip; |
| 1387 // TODO: this needs to trigger scheduling a bounds change on |window|. | 1394 // TODO: this needs to trigger scheduling a bounds change on |window|. |
| 1388 result = window_manager_delegate_->OnWmSetBounds(window->GetWindow(), | 1395 result = window_manager_delegate_->OnWmSetBounds(window->GetWindow(), |
| 1389 &bounds_in_dip); | 1396 &bounds_in_dip); |
| 1390 if (result) { | 1397 if (result) { |
| 1391 // If the resulting bounds differ return false. Returning false ensures | 1398 // If the resulting bounds differ return false. Returning false ensures |
| 1392 // the client applies the bounds we set below. | 1399 // the client applies the bounds we set below. |
| 1393 result = bounds_in_dip == transit_bounds_in_dip; | 1400 result = bounds_in_dip == transit_bounds_in_dip; |
| 1394 window->SetBoundsFromServer(bounds_in_dip); | 1401 window->SetBoundsFromServer(bounds_in_dip); |
| 1395 } | 1402 } |
| 1403 } else { | |
| 1404 DVLOG(1) << "Bad window passed to WmSetBounds()."; | |
|
sky
2017/03/17 00:02:21
Bad -> Unknown (just because it's possible the cli
Elliot Glaysher
2017/03/17 17:43:12
Done.
| |
| 1396 } | 1405 } |
| 1397 if (window_manager_internal_client_) | 1406 if (window_manager_internal_client_) |
| 1398 window_manager_internal_client_->WmResponse(change_id, result); | 1407 window_manager_internal_client_->WmResponse(change_id, result); |
| 1399 } | 1408 } |
| 1400 | 1409 |
| 1401 void WindowTreeClient::WmSetProperty( | 1410 void WindowTreeClient::WmSetProperty( |
| 1402 uint32_t change_id, | 1411 uint32_t change_id, |
| 1403 Id window_id, | 1412 Id window_id, |
| 1404 const std::string& name, | 1413 const std::string& name, |
| 1405 const base::Optional<std::vector<uint8_t>>& transit_data) { | 1414 const base::Optional<std::vector<uint8_t>>& transit_data) { |
| (...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1849 return ScheduleInFlightChange(base::MakeUnique<InFlightCaptureChange>( | 1858 return ScheduleInFlightChange(base::MakeUnique<InFlightCaptureChange>( |
| 1850 this, capture_synchronizer_.get(), window)); | 1859 this, capture_synchronizer_.get(), window)); |
| 1851 } | 1860 } |
| 1852 | 1861 |
| 1853 uint32_t WindowTreeClient::CreateChangeIdForFocus(WindowMus* window) { | 1862 uint32_t WindowTreeClient::CreateChangeIdForFocus(WindowMus* window) { |
| 1854 return ScheduleInFlightChange(base::MakeUnique<InFlightFocusChange>( | 1863 return ScheduleInFlightChange(base::MakeUnique<InFlightFocusChange>( |
| 1855 this, focus_synchronizer_.get(), window)); | 1864 this, focus_synchronizer_.get(), window)); |
| 1856 } | 1865 } |
| 1857 | 1866 |
| 1858 } // namespace aura | 1867 } // namespace aura |
| OLD | NEW |