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/public/cpp/lib/window_tree_client_impl.h" | 5 #include "components/mus/public/cpp/lib/window_tree_client_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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 | 213 |
214 void WindowTreeClientImpl::SetBounds(Window* window, | 214 void WindowTreeClientImpl::SetBounds(Window* window, |
215 const gfx::Rect& old_bounds, | 215 const gfx::Rect& old_bounds, |
216 const gfx::Rect& bounds) { | 216 const gfx::Rect& bounds) { |
217 DCHECK(tree_); | 217 DCHECK(tree_); |
218 const uint32_t change_id = ScheduleInFlightChange( | 218 const uint32_t change_id = ScheduleInFlightChange( |
219 make_scoped_ptr(new InFlightBoundsChange(window, old_bounds))); | 219 make_scoped_ptr(new InFlightBoundsChange(window, old_bounds))); |
220 tree_->SetWindowBounds(change_id, window->id(), mojo::Rect::From(bounds)); | 220 tree_->SetWindowBounds(change_id, window->id(), mojo::Rect::From(bounds)); |
221 } | 221 } |
222 | 222 |
| 223 void WindowTreeClientImpl::SetCapture(Window* window) { |
| 224 // In order for us to get here we had to have exposed a window, which implies |
| 225 // we got a connection. |
| 226 DCHECK(tree_); |
| 227 const uint32_t change_id = ScheduleInFlightChange(make_scoped_ptr( |
| 228 new CrashInFlightChange(window, ChangeType::SET_CAPTURE))); |
| 229 tree_->SetCapture(change_id, window->id()); |
| 230 } |
| 231 |
| 232 void WindowTreeClientImpl::ReleaseCapture(Window* window) { |
| 233 // In order for us to get here we had to have exposed a window, which implies |
| 234 // we got a connection. |
| 235 DCHECK(tree_); |
| 236 const uint32_t change_id = ScheduleInFlightChange(make_scoped_ptr( |
| 237 new CrashInFlightChange(window, ChangeType::RELEASE_CAPTURE))); |
| 238 tree_->ReleaseCapture(change_id, window->id()); |
| 239 } |
| 240 |
223 void WindowTreeClientImpl::SetClientArea( | 241 void WindowTreeClientImpl::SetClientArea( |
224 Id window_id, | 242 Id window_id, |
225 const gfx::Insets& client_area, | 243 const gfx::Insets& client_area, |
226 const std::vector<gfx::Rect>& additional_client_areas) { | 244 const std::vector<gfx::Rect>& additional_client_areas) { |
227 DCHECK(tree_); | 245 DCHECK(tree_); |
228 tree_->SetClientArea( | 246 tree_->SetClientArea( |
229 window_id, mojo::Insets::From(client_area), | 247 window_id, mojo::Insets::From(client_area), |
230 mojo::Array<mojo::RectPtr>::From(additional_client_areas)); | 248 mojo::Array<mojo::RectPtr>::From(additional_client_areas)); |
231 } | 249 } |
232 | 250 |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 | 538 |
521 void WindowTreeClientImpl::OnUnembed(Id window_id) { | 539 void WindowTreeClientImpl::OnUnembed(Id window_id) { |
522 Window* window = GetWindowById(window_id); | 540 Window* window = GetWindowById(window_id); |
523 if (!window) | 541 if (!window) |
524 return; | 542 return; |
525 | 543 |
526 delegate_->OnUnembed(window); | 544 delegate_->OnUnembed(window); |
527 WindowPrivate(window).LocalDestroy(); | 545 WindowPrivate(window).LocalDestroy(); |
528 } | 546 } |
529 | 547 |
| 548 void WindowTreeClientImpl::OnLostCapture(Id window_id) { |
| 549 Window* window = GetWindowById(window_id); |
| 550 if (window) { |
| 551 FOR_EACH_OBSERVER(WindowObserver, *WindowPrivate(window).observers(), |
| 552 OnWindowLostCapture(window)); |
| 553 } |
| 554 } |
| 555 |
530 void WindowTreeClientImpl::OnTopLevelCreated(uint32_t change_id, | 556 void WindowTreeClientImpl::OnTopLevelCreated(uint32_t change_id, |
531 mojom::WindowDataPtr data) { | 557 mojom::WindowDataPtr data) { |
532 // The server ack'd the top level window we created and supplied the state | 558 // The server ack'd the top level window we created and supplied the state |
533 // of the window at the time the server created it. For properties we do not | 559 // of the window at the time the server created it. For properties we do not |
534 // have changes in flight for we can update them immediately. For properties | 560 // have changes in flight for we can update them immediately. For properties |
535 // with changes in flight we set the revert value from the server. | 561 // with changes in flight we set the revert value from the server. |
536 | 562 |
537 scoped_ptr<InFlightChange> change(std::move(in_flight_map_[change_id])); | 563 scoped_ptr<InFlightChange> change(std::move(in_flight_map_[change_id])); |
538 in_flight_map_.erase(change_id); | 564 in_flight_map_.erase(change_id); |
539 DCHECK(change); | 565 DCHECK(change); |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
864 window->id()); | 890 window->id()); |
865 } | 891 } |
866 | 892 |
867 void WindowTreeClientImpl::SetFrameDecorationValues( | 893 void WindowTreeClientImpl::SetFrameDecorationValues( |
868 mojom::FrameDecorationValuesPtr values) { | 894 mojom::FrameDecorationValuesPtr values) { |
869 window_manager_internal_client_->WmSetFrameDecorationValues( | 895 window_manager_internal_client_->WmSetFrameDecorationValues( |
870 std::move(values)); | 896 std::move(values)); |
871 } | 897 } |
872 | 898 |
873 } // namespace mus | 899 } // namespace mus |
OLD | NEW |