| 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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 } | 186 } |
| 187 | 187 |
| 188 // Set the |target| to be the target window of this |event| and send it to | 188 // Set the |target| to be the target window of this |event| and send it to |
| 189 // the EventSink. | 189 // the EventSink. |
| 190 void DispatchEventToTarget(ui::Event* event, WindowMus* target) { | 190 void DispatchEventToTarget(ui::Event* event, WindowMus* target) { |
| 191 ui::Event::DispatcherApi dispatch_helper(event); | 191 ui::Event::DispatcherApi dispatch_helper(event); |
| 192 dispatch_helper.set_target(target->GetWindow()); | 192 dispatch_helper.set_target(target->GetWindow()); |
| 193 GetWindowTreeHostMus(target)->SendEventToSink(event); | 193 GetWindowTreeHostMus(target)->SendEventToSink(event); |
| 194 } | 194 } |
| 195 | 195 |
| 196 // Use for acks from mus that are expected to always succeed and if they don't |
| 197 // a crash is triggered. |
| 198 void OnAckMustSucceed(bool success) { |
| 199 CHECK(success); |
| 200 } |
| 201 |
| 196 } // namespace | 202 } // namespace |
| 197 | 203 |
| 198 WindowTreeClient::WindowTreeClient( | 204 WindowTreeClient::WindowTreeClient( |
| 199 service_manager::Connector* connector, | 205 service_manager::Connector* connector, |
| 200 WindowTreeClientDelegate* delegate, | 206 WindowTreeClientDelegate* delegate, |
| 201 WindowManagerDelegate* window_manager_delegate, | 207 WindowManagerDelegate* window_manager_delegate, |
| 202 mojo::InterfaceRequest<ui::mojom::WindowTreeClient> request, | 208 mojo::InterfaceRequest<ui::mojom::WindowTreeClient> request, |
| 203 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, | 209 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, |
| 204 bool create_discardable_memory) | 210 bool create_discardable_memory) |
| 205 : connector_(connector), | 211 : connector_(connector), |
| (...skipping 1656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1862 if (window_manager_client_) | 1868 if (window_manager_client_) |
| 1863 window_manager_client_->WmSetGlobalOverrideCursor(std::move(cursor)); | 1869 window_manager_client_->WmSetGlobalOverrideCursor(std::move(cursor)); |
| 1864 } | 1870 } |
| 1865 | 1871 |
| 1866 void WindowTreeClient::RequestClose(Window* window) { | 1872 void WindowTreeClient::RequestClose(Window* window) { |
| 1867 DCHECK(window); | 1873 DCHECK(window); |
| 1868 if (window_manager_client_) | 1874 if (window_manager_client_) |
| 1869 window_manager_client_->WmRequestClose(WindowMus::Get(window)->server_id()); | 1875 window_manager_client_->WmRequestClose(WindowMus::Get(window)->server_id()); |
| 1870 } | 1876 } |
| 1871 | 1877 |
| 1878 void WindowTreeClient::SetDisplayConfiguration( |
| 1879 const std::vector<display::Display>& displays, |
| 1880 std::vector<ui::mojom::WmViewportMetricsPtr> viewport_metrics, |
| 1881 int64_t primary_display_id) { |
| 1882 DCHECK_EQ(displays.size(), viewport_metrics.size()); |
| 1883 if (window_manager_client_) { |
| 1884 window_manager_client_->SetDisplayConfiguration( |
| 1885 displays, std::move(viewport_metrics), primary_display_id, |
| 1886 base::Bind(&OnAckMustSucceed)); |
| 1887 } |
| 1888 } |
| 1889 |
| 1872 void WindowTreeClient::OnWindowTreeHostBoundsWillChange( | 1890 void WindowTreeClient::OnWindowTreeHostBoundsWillChange( |
| 1873 WindowTreeHostMus* window_tree_host, | 1891 WindowTreeHostMus* window_tree_host, |
| 1874 const gfx::Rect& bounds) { | 1892 const gfx::Rect& bounds) { |
| 1875 ScheduleInFlightBoundsChange(WindowMus::Get(window_tree_host->window()), | 1893 ScheduleInFlightBoundsChange(WindowMus::Get(window_tree_host->window()), |
| 1876 window_tree_host->GetBoundsInPixels(), bounds); | 1894 window_tree_host->GetBoundsInPixels(), bounds); |
| 1877 } | 1895 } |
| 1878 | 1896 |
| 1879 void WindowTreeClient::OnWindowTreeHostClientAreaWillChange( | 1897 void WindowTreeClient::OnWindowTreeHostClientAreaWillChange( |
| 1880 WindowTreeHostMus* window_tree_host, | 1898 WindowTreeHostMus* window_tree_host, |
| 1881 const gfx::Insets& client_area, | 1899 const gfx::Insets& client_area, |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2104 } | 2122 } |
| 2105 | 2123 |
| 2106 void WindowTreeClient::OnCompositingLockStateChanged( | 2124 void WindowTreeClient::OnCompositingLockStateChanged( |
| 2107 ui::Compositor* compositor) {} | 2125 ui::Compositor* compositor) {} |
| 2108 | 2126 |
| 2109 void WindowTreeClient::OnCompositingShuttingDown(ui::Compositor* compositor) { | 2127 void WindowTreeClient::OnCompositingShuttingDown(ui::Compositor* compositor) { |
| 2110 compositor->RemoveObserver(this); | 2128 compositor->RemoveObserver(this); |
| 2111 } | 2129 } |
| 2112 | 2130 |
| 2113 } // namespace aura | 2131 } // namespace aura |
| OLD | NEW |