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 "components/mus/ws/window_tree_impl.h" | 5 #include "components/mus/ws/window_tree_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 window_id_to_client_id_map_[window->id()] = | 309 window_id_to_client_id_map_[window->id()] = |
310 waiting_for_top_level_window_info->client_window_id; | 310 waiting_for_top_level_window_info->client_window_id; |
311 roots_.insert(window); | 311 roots_.insert(window); |
312 client_->OnTopLevelCreated(client_change_id, WindowToWindowData(window)); | 312 client_->OnTopLevelCreated(client_change_id, WindowToWindowData(window)); |
313 } | 313 } |
314 | 314 |
315 void WindowTreeImpl::OnChangeCompleted(uint32_t change_id, bool success) { | 315 void WindowTreeImpl::OnChangeCompleted(uint32_t change_id, bool success) { |
316 client_->OnChangeCompleted(change_id, success); | 316 client_->OnChangeCompleted(change_id, success); |
317 } | 317 } |
318 | 318 |
| 319 void WindowTreeImpl::OnAccelerator(uint32_t accelerator_id, |
| 320 mojom::EventPtr event) { |
| 321 DCHECK(window_manager_internal_); |
| 322 window_manager_internal_->OnAccelerator(accelerator_id, std::move(event)); |
| 323 } |
| 324 |
319 void WindowTreeImpl::ProcessWindowBoundsChanged(const ServerWindow* window, | 325 void WindowTreeImpl::ProcessWindowBoundsChanged(const ServerWindow* window, |
320 const gfx::Rect& old_bounds, | 326 const gfx::Rect& old_bounds, |
321 const gfx::Rect& new_bounds, | 327 const gfx::Rect& new_bounds, |
322 bool originated_change) { | 328 bool originated_change) { |
323 ClientWindowId client_window_id; | 329 ClientWindowId client_window_id; |
324 if (originated_change || !IsWindowKnown(window, &client_window_id)) | 330 if (originated_change || !IsWindowKnown(window, &client_window_id)) |
325 return; | 331 return; |
326 client_->OnWindowBoundsChanged(client_window_id.id, Rect::From(old_bounds), | 332 client_->OnWindowBoundsChanged(client_window_id.id, Rect::From(old_bounds), |
327 Rect::From(new_bounds)); | 333 Rect::From(new_bounds)); |
328 } | 334 } |
(...skipping 857 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1186 mojo::AssociatedInterfaceRequest<mojom::WindowManagerClient> internal) { | 1192 mojo::AssociatedInterfaceRequest<mojom::WindowManagerClient> internal) { |
1187 if (!access_policy_->CanSetWindowManager() || !window_manager_internal_ || | 1193 if (!access_policy_->CanSetWindowManager() || !window_manager_internal_ || |
1188 window_manager_internal_client_binding_) { | 1194 window_manager_internal_client_binding_) { |
1189 return; | 1195 return; |
1190 } | 1196 } |
1191 window_manager_internal_client_binding_.reset( | 1197 window_manager_internal_client_binding_.reset( |
1192 new mojo::AssociatedBinding<mojom::WindowManagerClient>( | 1198 new mojo::AssociatedBinding<mojom::WindowManagerClient>( |
1193 this, std::move(internal))); | 1199 this, std::move(internal))); |
1194 } | 1200 } |
1195 | 1201 |
| 1202 void WindowTreeImpl::AddAccelerator(uint32_t id, |
| 1203 mojom::EventMatcherPtr event_matcher, |
| 1204 const AddAcceleratorCallback& callback) { |
| 1205 WindowTreeHostImpl* host = GetHostForWindowManager(); |
| 1206 const bool success = |
| 1207 host && |
| 1208 host->event_dispatcher()->AddAccelerator(id, std::move(event_matcher)); |
| 1209 callback.Run(success); |
| 1210 } |
| 1211 |
| 1212 void WindowTreeImpl::RemoveAccelerator(uint32_t id) { |
| 1213 WindowTreeHostImpl* host = GetHostForWindowManager(); |
| 1214 if (!host) |
| 1215 return; |
| 1216 host->event_dispatcher()->RemoveAccelerator(id); |
| 1217 } |
| 1218 |
1196 void WindowTreeImpl::WmResponse(uint32_t change_id, bool response) { | 1219 void WindowTreeImpl::WmResponse(uint32_t change_id, bool response) { |
1197 // TODO(sky): think about what else case means. | 1220 // TODO(sky): think about what else case means. |
1198 if (GetHostForWindowManager()) | 1221 if (GetHostForWindowManager()) |
1199 connection_manager_->WindowManagerChangeCompleted(change_id, response); | 1222 connection_manager_->WindowManagerChangeCompleted(change_id, response); |
1200 } | 1223 } |
1201 | 1224 |
1202 void WindowTreeImpl::WmRequestClose(Id transport_window_id) { | 1225 void WindowTreeImpl::WmRequestClose(Id transport_window_id) { |
1203 // Only the WindowManager should be using this. | 1226 // Only the WindowManager should be using this. |
1204 WindowTreeHostImpl* host = GetHostForWindowManager(); | 1227 WindowTreeHostImpl* host = GetHostForWindowManager(); |
1205 if (!host) | 1228 if (!host) |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1258 | 1281 |
1259 for (const auto* root : roots_) { | 1282 for (const auto* root : roots_) { |
1260 if (root->Contains(window)) | 1283 if (root->Contains(window)) |
1261 return true; | 1284 return true; |
1262 } | 1285 } |
1263 return false; | 1286 return false; |
1264 } | 1287 } |
1265 | 1288 |
1266 } // namespace ws | 1289 } // namespace ws |
1267 } // namespace mus | 1290 } // namespace mus |
OLD | NEW |