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 transport_properties[transport_name] = | 608 transport_properties[transport_name] = |
609 transport_value ? std::move(*transport_value) : std::vector<uint8_t>(); | 609 transport_value ? std::move(*transport_value) : std::vector<uint8_t>(); |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
705 } | 705 } |
706 | 706 |
707 void WindowTreeClient::OnWindowMusSetVisible(WindowMus* window, bool visible) { | 707 void WindowTreeClient::OnWindowMusSetVisible(WindowMus* window, bool visible) { |
708 // TODO: add checks to ensure this can work. | 708 // TODO: add checks to ensure this can work. |
709 DCHECK(tree_); | 709 DCHECK(tree_); |
710 const uint32_t change_id = ScheduleInFlightChange( | 710 const uint32_t change_id = ScheduleInFlightChange( |
711 base::MakeUnique<InFlightVisibleChange>(this, window, !visible)); | 711 base::MakeUnique<InFlightVisibleChange>(this, window, !visible)); |
712 tree_->SetWindowVisibility(change_id, window->server_id(), visible); | 712 tree_->SetWindowVisibility(change_id, window->server_id(), visible); |
713 } | 713 } |
714 | 714 |
715 std::unique_ptr<WindowPortPropertyData> | 715 std::unique_ptr<ui::PropertyData> |
716 WindowTreeClient::OnWindowMusWillChangeProperty(WindowMus* window, | 716 WindowTreeClient::OnWindowMusWillChangeProperty(WindowMus* window, |
717 const void* key) { | 717 const void* key) { |
718 if (IsInternalProperty(key)) | 718 if (IsInternalProperty(key)) |
719 return nullptr; | 719 return nullptr; |
720 | 720 |
721 std::unique_ptr<WindowPortPropertyDataMus> data( | 721 std::unique_ptr<WindowPortPropertyDataMus> data( |
722 base::MakeUnique<WindowPortPropertyDataMus>()); | 722 base::MakeUnique<WindowPortPropertyDataMus>()); |
723 if (!delegate_->GetPropertyConverter()->ConvertPropertyForTransport( | 723 if (!delegate_->GetPropertyConverter()->ConvertPropertyForTransport( |
724 window->GetWindow(), key, &data->transport_name, | 724 window->GetWindow(), key, &data->transport_name, |
725 &data->transport_value)) { | 725 &data->transport_value)) { |
726 return nullptr; | 726 return nullptr; |
727 } | 727 } |
728 return std::move(data); | 728 return std::move(data); |
729 } | 729 } |
730 | 730 |
731 void WindowTreeClient::OnWindowMusPropertyChanged( | 731 void WindowTreeClient::OnWindowMusPropertyChanged( |
732 WindowMus* window, | 732 WindowMus* window, |
733 const void* key, | 733 const void* key, |
734 std::unique_ptr<WindowPortPropertyData> data) { | 734 std::unique_ptr<ui::PropertyData> data) { |
735 if (HandleInternalPropertyChanged(window, key) || !data) | 735 if (HandleInternalPropertyChanged(window, key) || !data) |
736 return; | 736 return; |
737 | 737 |
738 WindowPortPropertyDataMus* data_mus = | 738 WindowPortPropertyDataMus* data_mus = |
739 static_cast<WindowPortPropertyDataMus*>(data.get()); | 739 static_cast<WindowPortPropertyDataMus*>(data.get()); |
740 | 740 |
741 std::string transport_name; | 741 std::string transport_name; |
742 std::unique_ptr<std::vector<uint8_t>> transport_value; | 742 std::unique_ptr<std::vector<uint8_t>> transport_value; |
743 if (!delegate_->GetPropertyConverter()->ConvertPropertyForTransport( | 743 if (!delegate_->GetPropertyConverter()->ConvertPropertyForTransport( |
744 window->GetWindow(), key, &transport_name, &transport_value)) { | 744 window->GetWindow(), key, &transport_name, &transport_value)) { |
(...skipping 1077 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1822 return ScheduleInFlightChange(base::MakeUnique<InFlightCaptureChange>( | 1822 return ScheduleInFlightChange(base::MakeUnique<InFlightCaptureChange>( |
1823 this, capture_synchronizer_.get(), window)); | 1823 this, capture_synchronizer_.get(), window)); |
1824 } | 1824 } |
1825 | 1825 |
1826 uint32_t WindowTreeClient::CreateChangeIdForFocus(WindowMus* window) { | 1826 uint32_t WindowTreeClient::CreateChangeIdForFocus(WindowMus* window) { |
1827 return ScheduleInFlightChange(base::MakeUnique<InFlightFocusChange>( | 1827 return ScheduleInFlightChange(base::MakeUnique<InFlightFocusChange>( |
1828 this, focus_synchronizer_.get(), window)); | 1828 this, focus_synchronizer_.get(), window)); |
1829 } | 1829 } |
1830 | 1830 |
1831 } // namespace aura | 1831 } // namespace aura |
OLD | NEW |