| 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> |
| 8 |
| 7 #include "base/bind.h" | 9 #include "base/bind.h" |
| 8 #include "components/mus/common/util.h" | 10 #include "components/mus/common/util.h" |
| 9 #include "components/mus/public/cpp/input_event_handler.h" | 11 #include "components/mus/public/cpp/input_event_handler.h" |
| 10 #include "components/mus/public/cpp/lib/in_flight_change.h" | 12 #include "components/mus/public/cpp/lib/in_flight_change.h" |
| 11 #include "components/mus/public/cpp/lib/window_private.h" | 13 #include "components/mus/public/cpp/lib/window_private.h" |
| 12 #include "components/mus/public/cpp/window_manager_delegate.h" | 14 #include "components/mus/public/cpp/window_manager_delegate.h" |
| 13 #include "components/mus/public/cpp/window_observer.h" | 15 #include "components/mus/public/cpp/window_observer.h" |
| 14 #include "components/mus/public/cpp/window_tree_connection.h" | 16 #include "components/mus/public/cpp/window_tree_connection.h" |
| 15 #include "components/mus/public/cpp/window_tree_connection_observer.h" | 17 #include "components/mus/public/cpp/window_tree_connection_observer.h" |
| 16 #include "components/mus/public/cpp/window_tree_delegate.h" | 18 #include "components/mus/public/cpp/window_tree_delegate.h" |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 return false; | 382 return false; |
| 381 | 383 |
| 382 existing_change->SetRevertValueFrom(change); | 384 existing_change->SetRevertValueFrom(change); |
| 383 return true; | 385 return true; |
| 384 } | 386 } |
| 385 | 387 |
| 386 void WindowTreeClientImpl::OnEmbedImpl(mojom::WindowTree* window_tree, | 388 void WindowTreeClientImpl::OnEmbedImpl(mojom::WindowTree* window_tree, |
| 387 ConnectionSpecificId connection_id, | 389 ConnectionSpecificId connection_id, |
| 388 mojom::WindowDataPtr root_data, | 390 mojom::WindowDataPtr root_data, |
| 389 Id focused_window_id, | 391 Id focused_window_id, |
| 390 uint32 access_policy) { | 392 uint32_t access_policy) { |
| 391 tree_ = window_tree; | 393 tree_ = window_tree; |
| 392 connection_id_ = connection_id; | 394 connection_id_ = connection_id; |
| 393 is_embed_root_ = | 395 is_embed_root_ = |
| 394 (access_policy & mojom::WindowTree::ACCESS_POLICY_EMBED_ROOT) != 0; | 396 (access_policy & mojom::WindowTree::ACCESS_POLICY_EMBED_ROOT) != 0; |
| 395 | 397 |
| 396 DCHECK(!root_); | 398 DCHECK(!root_); |
| 397 root_ = AddWindowToConnection(this, nullptr, root_data); | 399 root_ = AddWindowToConnection(this, nullptr, root_data); |
| 398 | 400 |
| 399 focused_window_ = GetWindowById(focused_window_id); | 401 focused_window_ = GetWindowById(focused_window_id); |
| 400 | 402 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 459 | 461 |
| 460 void WindowTreeClientImpl::RemoveObserver( | 462 void WindowTreeClientImpl::RemoveObserver( |
| 461 WindowTreeConnectionObserver* observer) { | 463 WindowTreeConnectionObserver* observer) { |
| 462 observers_.RemoveObserver(observer); | 464 observers_.RemoveObserver(observer); |
| 463 } | 465 } |
| 464 | 466 |
| 465 void WindowTreeClientImpl::OnEmbed(ConnectionSpecificId connection_id, | 467 void WindowTreeClientImpl::OnEmbed(ConnectionSpecificId connection_id, |
| 466 mojom::WindowDataPtr root_data, | 468 mojom::WindowDataPtr root_data, |
| 467 mojom::WindowTreePtr tree, | 469 mojom::WindowTreePtr tree, |
| 468 Id focused_window_id, | 470 Id focused_window_id, |
| 469 uint32 access_policy) { | 471 uint32_t access_policy) { |
| 470 DCHECK(!tree_ptr_); | 472 DCHECK(!tree_ptr_); |
| 471 tree_ptr_ = std::move(tree); | 473 tree_ptr_ = std::move(tree); |
| 472 tree_ptr_.set_connection_error_handler([this]() { delete this; }); | 474 tree_ptr_.set_connection_error_handler([this]() { delete this; }); |
| 473 | 475 |
| 474 if (window_manager_delegate_) { | 476 if (window_manager_delegate_) { |
| 475 tree_ptr_->GetWindowManagerInternalClient(GetProxy( | 477 tree_ptr_->GetWindowManagerInternalClient(GetProxy( |
| 476 &window_manager_internal_client_, tree_ptr_.associated_group())); | 478 &window_manager_internal_client_, tree_ptr_.associated_group())); |
| 477 } | 479 } |
| 478 | 480 |
| 479 OnEmbedImpl(tree_ptr_.get(), connection_id, std::move(root_data), | 481 OnEmbedImpl(tree_ptr_.get(), connection_id, std::move(root_data), |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 672 if (!window) | 674 if (!window) |
| 673 return; | 675 return; |
| 674 | 676 |
| 675 InFlightPredefinedCursorChange new_change(window, cursor); | 677 InFlightPredefinedCursorChange new_change(window, cursor); |
| 676 if (ApplyServerChangeToExistingInFlightChange(new_change)) | 678 if (ApplyServerChangeToExistingInFlightChange(new_change)) |
| 677 return; | 679 return; |
| 678 | 680 |
| 679 WindowPrivate(window).LocalSetPredefinedCursor(cursor); | 681 WindowPrivate(window).LocalSetPredefinedCursor(cursor); |
| 680 } | 682 } |
| 681 | 683 |
| 682 void WindowTreeClientImpl::OnChangeCompleted(uint32 change_id, bool success) { | 684 void WindowTreeClientImpl::OnChangeCompleted(uint32_t change_id, bool success) { |
| 683 scoped_ptr<InFlightChange> change(std::move(in_flight_map_[change_id])); | 685 scoped_ptr<InFlightChange> change(std::move(in_flight_map_[change_id])); |
| 684 in_flight_map_.erase(change_id); | 686 in_flight_map_.erase(change_id); |
| 685 if (!change) | 687 if (!change) |
| 686 return; | 688 return; |
| 687 | 689 |
| 688 if (!success) | 690 if (!success) |
| 689 change->ChangeFailed(); | 691 change->ChangeFailed(); |
| 690 | 692 |
| 691 InFlightChange* next_change = GetOldestInFlightChangeMatching(*change); | 693 InFlightChange* next_change = GetOldestInFlightChangeMatching(*change); |
| 692 if (next_change) { | 694 if (next_change) { |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 749 if (result) { | 751 if (result) { |
| 750 // If the resulting bounds differ return false. Returning false ensures | 752 // If the resulting bounds differ return false. Returning false ensures |
| 751 // the client applies the bounds we set below. | 753 // the client applies the bounds we set below. |
| 752 window->SetSharedPropertyInternal(name, data.get()); | 754 window->SetSharedPropertyInternal(name, data.get()); |
| 753 } | 755 } |
| 754 } | 756 } |
| 755 window_manager_internal_client_->WmResponse(change_id, result); | 757 window_manager_internal_client_->WmResponse(change_id, result); |
| 756 } | 758 } |
| 757 | 759 |
| 758 } // namespace mus | 760 } // namespace mus |
| OLD | NEW |