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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "components/mus/common/util.h" | 8 #include "components/mus/common/util.h" |
9 #include "components/mus/public/cpp/lib/in_flight_change.h" | 9 #include "components/mus/public/cpp/lib/in_flight_change.h" |
10 #include "components/mus/public/cpp/lib/window_private.h" | 10 #include "components/mus/public/cpp/lib/window_private.h" |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 // we got a connection. | 215 // we got a connection. |
216 DCHECK(tree_); | 216 DCHECK(tree_); |
217 tree_->SetFocus(window_id); | 217 tree_->SetFocus(window_id); |
218 } | 218 } |
219 | 219 |
220 void WindowTreeClientImpl::SetCanFocus(Id window_id, bool can_focus) { | 220 void WindowTreeClientImpl::SetCanFocus(Id window_id, bool can_focus) { |
221 DCHECK(tree_); | 221 DCHECK(tree_); |
222 tree_->SetCanFocus(window_id, can_focus); | 222 tree_->SetCanFocus(window_id, can_focus); |
223 } | 223 } |
224 | 224 |
| 225 void WindowTreeClientImpl::SetStandardCursor(Id window_id, |
| 226 mus::mojom::Cursor cursor_id) { |
| 227 DCHECK(tree_); |
| 228 tree_->SetStandardCursor(window_id, cursor_id); |
| 229 } |
| 230 |
225 void WindowTreeClientImpl::SetVisible(Id window_id, bool visible) { | 231 void WindowTreeClientImpl::SetVisible(Id window_id, bool visible) { |
226 DCHECK(tree_); | 232 DCHECK(tree_); |
227 tree_->SetWindowVisibility(window_id, visible, ActionCompletedCallback()); | 233 tree_->SetWindowVisibility(window_id, visible, ActionCompletedCallback()); |
228 } | 234 } |
229 | 235 |
230 void WindowTreeClientImpl::SetProperty(Window* window, | 236 void WindowTreeClientImpl::SetProperty(Window* window, |
231 const std::string& name, | 237 const std::string& name, |
232 mojo::Array<uint8_t> data) { | 238 mojo::Array<uint8_t> data) { |
233 DCHECK(tree_); | 239 DCHECK(tree_); |
234 | 240 |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
585 if (blurred) { | 591 if (blurred) { |
586 FOR_EACH_OBSERVER(WindowObserver, *WindowPrivate(blurred).observers(), | 592 FOR_EACH_OBSERVER(WindowObserver, *WindowPrivate(blurred).observers(), |
587 OnWindowFocusChanged(focused, blurred)); | 593 OnWindowFocusChanged(focused, blurred)); |
588 } | 594 } |
589 if (focused) { | 595 if (focused) { |
590 FOR_EACH_OBSERVER(WindowObserver, *WindowPrivate(focused).observers(), | 596 FOR_EACH_OBSERVER(WindowObserver, *WindowPrivate(focused).observers(), |
591 OnWindowFocusChanged(focused, blurred)); | 597 OnWindowFocusChanged(focused, blurred)); |
592 } | 598 } |
593 } | 599 } |
594 | 600 |
| 601 void WindowTreeClientImpl::OnWindowCursorChanged(Id window_id, |
| 602 mojom::Cursor cursor) { |
| 603 Window* window = GetWindowById(window_id); |
| 604 if (window) { |
| 605 FOR_EACH_OBSERVER(WindowObserver, *WindowPrivate(window).observers(), |
| 606 OnWindowCursorChanged(window, cursor)); |
| 607 } |
| 608 } |
| 609 |
595 void WindowTreeClientImpl::OnChangeCompleted(uint32 change_id, bool success) { | 610 void WindowTreeClientImpl::OnChangeCompleted(uint32 change_id, bool success) { |
596 scoped_ptr<InFlightChange> change(std::move(in_flight_map_[change_id])); | 611 scoped_ptr<InFlightChange> change(std::move(in_flight_map_[change_id])); |
597 in_flight_map_.erase(change_id); | 612 in_flight_map_.erase(change_id); |
598 if (!change) | 613 if (!change) |
599 return; | 614 return; |
600 | 615 |
601 if (!success) | 616 if (!success) |
602 change->ChangeFailed(); | 617 change->ChangeFailed(); |
603 | 618 |
604 InFlightChange* next_change = GetOldestInFlightChangeMatching(*change); | 619 InFlightChange* next_change = GetOldestInFlightChangeMatching(*change); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
658 void WindowTreeClientImpl::OnActionCompleted(bool success) { | 673 void WindowTreeClientImpl::OnActionCompleted(bool success) { |
659 if (!change_acked_callback_.is_null()) | 674 if (!change_acked_callback_.is_null()) |
660 change_acked_callback_.Run(); | 675 change_acked_callback_.Run(); |
661 } | 676 } |
662 | 677 |
663 mojo::Callback<void(bool)> WindowTreeClientImpl::ActionCompletedCallback() { | 678 mojo::Callback<void(bool)> WindowTreeClientImpl::ActionCompletedCallback() { |
664 return [this](bool success) { OnActionCompleted(success); }; | 679 return [this](bool success) { OnActionCompleted(success); }; |
665 } | 680 } |
666 | 681 |
667 } // namespace mus | 682 } // namespace mus |
OLD | NEW |