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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 namespace { | 62 namespace { |
63 | 63 |
64 Id MakeTransportId(ClientSpecificId client_id, ClientSpecificId local_id) { | 64 Id MakeTransportId(ClientSpecificId client_id, ClientSpecificId local_id) { |
65 return (client_id << 16) | local_id; | 65 return (client_id << 16) | local_id; |
66 } | 66 } |
67 | 67 |
68 inline uint16_t HiWord(uint32_t id) { | 68 inline uint16_t HiWord(uint32_t id) { |
69 return static_cast<uint16_t>((id >> 16) & 0xFFFF); | 69 return static_cast<uint16_t>((id >> 16) & 0xFFFF); |
70 } | 70 } |
71 | 71 |
72 struct WindowPortPropertyDataMus : public WindowPortPropertyData { | 72 struct WindowPortPropertyDataMus : public ui::PropertyData { |
73 std::string transport_name; | 73 std::string transport_name; |
74 std::unique_ptr<std::vector<uint8_t>> transport_value; | 74 std::unique_ptr<std::vector<uint8_t>> transport_value; |
75 }; | 75 }; |
76 | 76 |
77 // Handles acknowledgment of an input event, either immediately when a nested | 77 // Handles acknowledgment of an input event, either immediately when a nested |
78 // message loop starts, or upon destruction. | 78 // message loop starts, or upon destruction. |
79 class EventAckHandler : public base::MessageLoop::NestingObserver { | 79 class EventAckHandler : public base::MessageLoop::NestingObserver { |
80 public: | 80 public: |
81 explicit EventAckHandler(std::unique_ptr<EventResultCallback> ack_callback) | 81 explicit EventAckHandler(std::unique_ptr<EventResultCallback> ack_callback) |
82 : ack_callback_(std::move(ack_callback)) { | 82 : ack_callback_(std::move(ack_callback)) { |
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
589 if (window->server_id() != kInvalidServerId) | 589 if (window->server_id() != kInvalidServerId) |
590 return; | 590 return; |
591 | 591 |
592 window->set_server_id(MakeTransportId(client_id_, next_window_id_++)); | 592 window->set_server_id(MakeTransportId(client_id_, next_window_id_++)); |
593 RegisterWindowMus(window); | 593 RegisterWindowMus(window); |
594 | 594 |
595 DCHECK(window_manager_delegate_ || !IsRoot(window)); | 595 DCHECK(window_manager_delegate_ || !IsRoot(window)); |
596 | 596 |
597 std::unordered_map<std::string, std::vector<uint8_t>> transport_properties; | 597 std::unordered_map<std::string, std::vector<uint8_t>> transport_properties; |
598 std::set<const void*> property_keys = | 598 std::set<const void*> property_keys = |
599 window->GetWindow()->GetAllPropertKeys(); | 599 window->GetWindow()->GetAllPropertyKeys(); |
600 PropertyConverter* property_converter = delegate_->GetPropertyConverter(); | 600 PropertyConverter* property_converter = delegate_->GetPropertyConverter(); |
601 for (const void* key : property_keys) { | 601 for (const void* key : property_keys) { |
602 std::string transport_name; | 602 std::string transport_name; |
603 std::unique_ptr<std::vector<uint8_t>> transport_value; | 603 std::unique_ptr<std::vector<uint8_t>> transport_value; |
604 if (!property_converter->ConvertPropertyForTransport( | 604 if (!property_converter->ConvertPropertyForTransport( |
605 window->GetWindow(), key, &transport_name, &transport_value)) { | 605 window->GetWindow(), key, &transport_name, &transport_value)) { |
606 continue; | 606 continue; |
607 } | 607 } |
608 if (!transport_value) { | 608 if (!transport_value) { |
609 transport_properties[transport_name] = std::vector<uint8_t>(); | 609 transport_properties[transport_name] = std::vector<uint8_t>(); |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
708 } | 708 } |
709 | 709 |
710 void WindowTreeClient::OnWindowMusSetVisible(WindowMus* window, bool visible) { | 710 void WindowTreeClient::OnWindowMusSetVisible(WindowMus* window, bool visible) { |
711 // TODO: add checks to ensure this can work. | 711 // TODO: add checks to ensure this can work. |
712 DCHECK(tree_); | 712 DCHECK(tree_); |
713 const uint32_t change_id = ScheduleInFlightChange( | 713 const uint32_t change_id = ScheduleInFlightChange( |
714 base::MakeUnique<InFlightVisibleChange>(this, window, !visible)); | 714 base::MakeUnique<InFlightVisibleChange>(this, window, !visible)); |
715 tree_->SetWindowVisibility(change_id, window->server_id(), visible); | 715 tree_->SetWindowVisibility(change_id, window->server_id(), visible); |
716 } | 716 } |
717 | 717 |
718 std::unique_ptr<WindowPortPropertyData> | 718 std::unique_ptr<ui::PropertyData> |
719 WindowTreeClient::OnWindowMusWillChangeProperty(WindowMus* window, | 719 WindowTreeClient::OnWindowMusWillChangeProperty(WindowMus* window, |
720 const void* key) { | 720 const void* key) { |
721 if (IsInternalProperty(key)) | 721 if (IsInternalProperty(key)) |
722 return nullptr; | 722 return nullptr; |
723 | 723 |
724 std::unique_ptr<WindowPortPropertyDataMus> data( | 724 std::unique_ptr<WindowPortPropertyDataMus> data( |
725 base::MakeUnique<WindowPortPropertyDataMus>()); | 725 base::MakeUnique<WindowPortPropertyDataMus>()); |
726 if (!delegate_->GetPropertyConverter()->ConvertPropertyForTransport( | 726 if (!delegate_->GetPropertyConverter()->ConvertPropertyForTransport( |
727 window->GetWindow(), key, &data->transport_name, | 727 window->GetWindow(), key, &data->transport_name, |
728 &data->transport_value)) { | 728 &data->transport_value)) { |
729 return nullptr; | 729 return nullptr; |
730 } | 730 } |
731 return std::move(data); | 731 return std::move(data); |
732 } | 732 } |
733 | 733 |
734 void WindowTreeClient::OnWindowMusPropertyChanged( | 734 void WindowTreeClient::OnWindowMusPropertyChanged( |
735 WindowMus* window, | 735 WindowMus* window, |
736 const void* key, | 736 const void* key, |
737 std::unique_ptr<WindowPortPropertyData> data) { | 737 std::unique_ptr<ui::PropertyData> data) { |
738 if (HandleInternalPropertyChanged(window, key) || !data) | 738 if (HandleInternalPropertyChanged(window, key) || !data) |
739 return; | 739 return; |
740 | 740 |
741 WindowPortPropertyDataMus* data_mus = | 741 WindowPortPropertyDataMus* data_mus = |
742 static_cast<WindowPortPropertyDataMus*>(data.get()); | 742 static_cast<WindowPortPropertyDataMus*>(data.get()); |
743 | 743 |
744 std::string transport_name; | 744 std::string transport_name; |
745 std::unique_ptr<std::vector<uint8_t>> transport_value; | 745 std::unique_ptr<std::vector<uint8_t>> transport_value; |
746 if (!delegate_->GetPropertyConverter()->ConvertPropertyForTransport( | 746 if (!delegate_->GetPropertyConverter()->ConvertPropertyForTransport( |
747 window->GetWindow(), key, &transport_name, &transport_value)) { | 747 window->GetWindow(), key, &transport_name, &transport_value)) { |
(...skipping 1003 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1751 return ScheduleInFlightChange(base::MakeUnique<InFlightCaptureChange>( | 1751 return ScheduleInFlightChange(base::MakeUnique<InFlightCaptureChange>( |
1752 this, capture_synchronizer_.get(), window)); | 1752 this, capture_synchronizer_.get(), window)); |
1753 } | 1753 } |
1754 | 1754 |
1755 uint32_t WindowTreeClient::CreateChangeIdForFocus(WindowMus* window) { | 1755 uint32_t WindowTreeClient::CreateChangeIdForFocus(WindowMus* window) { |
1756 return ScheduleInFlightChange(base::MakeUnique<InFlightFocusChange>( | 1756 return ScheduleInFlightChange(base::MakeUnique<InFlightFocusChange>( |
1757 this, focus_synchronizer_.get(), window)); | 1757 this, focus_synchronizer_.get(), window)); |
1758 } | 1758 } |
1759 | 1759 |
1760 } // namespace aura | 1760 } // namespace aura |
OLD | NEW |