| 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 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 546 delegate_->OnEmbed(std::move(window_tree_host)); | 546 delegate_->OnEmbed(std::move(window_tree_host)); |
| 547 } | 547 } |
| 548 | 548 |
| 549 WindowTreeHostMus* WindowTreeClient::WmNewDisplayAddedImpl( | 549 WindowTreeHostMus* WindowTreeClient::WmNewDisplayAddedImpl( |
| 550 const display::Display& display, | 550 const display::Display& display, |
| 551 ui::mojom::WindowDataPtr root_data, | 551 ui::mojom::WindowDataPtr root_data, |
| 552 bool parent_drawn, | 552 bool parent_drawn, |
| 553 const cc::FrameSinkId& frame_sink_id) { | 553 const cc::FrameSinkId& frame_sink_id) { |
| 554 DCHECK(window_manager_delegate_); | 554 DCHECK(window_manager_delegate_); |
| 555 | 555 |
| 556 got_initial_displays_ = true; |
| 557 |
| 556 window_manager_delegate_->OnWmWillCreateDisplay(display); | 558 window_manager_delegate_->OnWmWillCreateDisplay(display); |
| 557 | 559 |
| 558 std::unique_ptr<WindowTreeHostMus> window_tree_host = CreateWindowTreeHost( | 560 std::unique_ptr<WindowTreeHostMus> window_tree_host = CreateWindowTreeHost( |
| 559 WindowMusType::DISPLAY, *root_data, display.id(), frame_sink_id); | 561 WindowMusType::DISPLAY, *root_data, display.id(), frame_sink_id); |
| 560 | 562 |
| 561 WindowTreeHostMus* window_tree_host_ptr = window_tree_host.get(); | 563 WindowTreeHostMus* window_tree_host_ptr = window_tree_host.get(); |
| 562 window_manager_delegate_->OnWmNewDisplay(std::move(window_tree_host), | 564 window_manager_delegate_->OnWmNewDisplay(std::move(window_tree_host), |
| 563 display); | 565 display); |
| 564 return window_tree_host_ptr; | 566 return window_tree_host_ptr; |
| 565 } | 567 } |
| (...skipping 793 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1359 void WindowTreeClient::RequestClose(uint32_t window_id) { | 1361 void WindowTreeClient::RequestClose(uint32_t window_id) { |
| 1360 WindowMus* window = GetWindowByServerId(window_id); | 1362 WindowMus* window = GetWindowByServerId(window_id); |
| 1361 if (!window || !IsRoot(window)) | 1363 if (!window || !IsRoot(window)) |
| 1362 return; | 1364 return; |
| 1363 | 1365 |
| 1364 // Since the window is the root window, we send close request to the entire | 1366 // Since the window is the root window, we send close request to the entire |
| 1365 // WindowTreeHost. | 1367 // WindowTreeHost. |
| 1366 GetWindowTreeHostMus(window->GetWindow())->OnCloseRequest(); | 1368 GetWindowTreeHostMus(window->GetWindow())->OnCloseRequest(); |
| 1367 } | 1369 } |
| 1368 | 1370 |
| 1371 bool WindowTreeClient::WaitForInitialDisplays() { |
| 1372 if (got_initial_displays_) |
| 1373 return true; |
| 1374 |
| 1375 bool valid_wait = true; |
| 1376 // TODO(sky): having to block here is not ideal. http://crbug.com/594852. |
| 1377 while (!got_initial_displays_ && valid_wait) |
| 1378 valid_wait = binding_.WaitForIncomingMethodCall(); |
| 1379 return valid_wait; |
| 1380 } |
| 1381 |
| 1369 void WindowTreeClient::OnConnect(ClientSpecificId client_id) { | 1382 void WindowTreeClient::OnConnect(ClientSpecificId client_id) { |
| 1370 client_id_ = client_id; | 1383 client_id_ = client_id; |
| 1371 } | 1384 } |
| 1372 | 1385 |
| 1373 void WindowTreeClient::WmNewDisplayAdded(const display::Display& display, | 1386 void WindowTreeClient::WmNewDisplayAdded(const display::Display& display, |
| 1374 ui::mojom::WindowDataPtr root_data, | 1387 ui::mojom::WindowDataPtr root_data, |
| 1375 bool parent_drawn, | 1388 bool parent_drawn, |
| 1376 const cc::FrameSinkId& frame_sink_id) { | 1389 const cc::FrameSinkId& frame_sink_id) { |
| 1377 WmNewDisplayAddedImpl(display, std::move(root_data), parent_drawn, | 1390 WmNewDisplayAddedImpl(display, std::move(root_data), parent_drawn, |
| 1378 frame_sink_id); | 1391 frame_sink_id); |
| (...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1915 return ScheduleInFlightChange(base::MakeUnique<InFlightCaptureChange>( | 1928 return ScheduleInFlightChange(base::MakeUnique<InFlightCaptureChange>( |
| 1916 this, capture_synchronizer_.get(), window)); | 1929 this, capture_synchronizer_.get(), window)); |
| 1917 } | 1930 } |
| 1918 | 1931 |
| 1919 uint32_t WindowTreeClient::CreateChangeIdForFocus(WindowMus* window) { | 1932 uint32_t WindowTreeClient::CreateChangeIdForFocus(WindowMus* window) { |
| 1920 return ScheduleInFlightChange(base::MakeUnique<InFlightFocusChange>( | 1933 return ScheduleInFlightChange(base::MakeUnique<InFlightFocusChange>( |
| 1921 this, focus_synchronizer_.get(), window)); | 1934 this, focus_synchronizer_.get(), window)); |
| 1922 } | 1935 } |
| 1923 | 1936 |
| 1924 } // namespace aura | 1937 } // namespace aura |
| OLD | NEW |