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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 namespace { | 58 namespace { |
59 | 59 |
60 Id MakeTransportId(ClientSpecificId client_id, ClientSpecificId local_id) { | 60 Id MakeTransportId(ClientSpecificId client_id, ClientSpecificId local_id) { |
61 return (client_id << 16) | local_id; | 61 return (client_id << 16) | local_id; |
62 } | 62 } |
63 | 63 |
64 inline uint16_t HiWord(uint32_t id) { | 64 inline uint16_t HiWord(uint32_t id) { |
65 return static_cast<uint16_t>((id >> 16) & 0xFFFF); | 65 return static_cast<uint16_t>((id >> 16) & 0xFFFF); |
66 } | 66 } |
67 | 67 |
68 struct WindowPortPropertyDataMus : public WindowPortPropertyData { | 68 struct WindowPortPropertyDataMus : public ui::PropertyData { |
69 std::string transport_name; | 69 std::string transport_name; |
70 std::unique_ptr<std::vector<uint8_t>> transport_value; | 70 std::unique_ptr<std::vector<uint8_t>> transport_value; |
71 }; | 71 }; |
72 | 72 |
73 // Handles acknowledgment of an input event, either immediately when a nested | 73 // Handles acknowledgment of an input event, either immediately when a nested |
74 // message loop starts, or upon destruction. | 74 // message loop starts, or upon destruction. |
75 class EventAckHandler : public base::MessageLoop::NestingObserver { | 75 class EventAckHandler : public base::MessageLoop::NestingObserver { |
76 public: | 76 public: |
77 explicit EventAckHandler(std::unique_ptr<EventResultCallback> ack_callback) | 77 explicit EventAckHandler(std::unique_ptr<EventResultCallback> ack_callback) |
78 : ack_callback_(std::move(ack_callback)) { | 78 : ack_callback_(std::move(ack_callback)) { |
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
694 } | 694 } |
695 | 695 |
696 void WindowTreeClient::OnWindowMusSetVisible(WindowMus* window, bool visible) { | 696 void WindowTreeClient::OnWindowMusSetVisible(WindowMus* window, bool visible) { |
697 // TODO: add checks to ensure this can work. | 697 // TODO: add checks to ensure this can work. |
698 DCHECK(tree_); | 698 DCHECK(tree_); |
699 const uint32_t change_id = ScheduleInFlightChange( | 699 const uint32_t change_id = ScheduleInFlightChange( |
700 base::MakeUnique<InFlightVisibleChange>(this, window, !visible)); | 700 base::MakeUnique<InFlightVisibleChange>(this, window, !visible)); |
701 tree_->SetWindowVisibility(change_id, window->server_id(), visible); | 701 tree_->SetWindowVisibility(change_id, window->server_id(), visible); |
702 } | 702 } |
703 | 703 |
704 std::unique_ptr<WindowPortPropertyData> | 704 std::unique_ptr<ui::PropertyData> |
705 WindowTreeClient::OnWindowMusWillChangeProperty(WindowMus* window, | 705 WindowTreeClient::OnWindowMusWillChangeProperty(WindowMus* window, |
706 const void* key) { | 706 const void* key) { |
707 if (IsInternalProperty(key)) | 707 if (IsInternalProperty(key)) |
708 return nullptr; | 708 return nullptr; |
709 | 709 |
710 std::unique_ptr<WindowPortPropertyDataMus> data( | 710 std::unique_ptr<WindowPortPropertyDataMus> data( |
711 base::MakeUnique<WindowPortPropertyDataMus>()); | 711 base::MakeUnique<WindowPortPropertyDataMus>()); |
712 if (!delegate_->GetPropertyConverter()->ConvertPropertyForTransport( | 712 if (!delegate_->GetPropertyConverter()->ConvertPropertyForTransport( |
713 window->GetWindow(), key, &data->transport_name, | 713 window->GetWindow(), key, &data->transport_name, |
714 &data->transport_value)) { | 714 &data->transport_value)) { |
715 return nullptr; | 715 return nullptr; |
716 } | 716 } |
717 return std::move(data); | 717 return std::move(data); |
718 } | 718 } |
719 | 719 |
720 void WindowTreeClient::OnWindowMusPropertyChanged( | 720 void WindowTreeClient::OnWindowMusPropertyChanged( |
721 WindowMus* window, | 721 WindowMus* window, |
722 const void* key, | 722 const void* key, |
723 std::unique_ptr<WindowPortPropertyData> data) { | 723 std::unique_ptr<ui::PropertyData> data) { |
724 if (HandleInternalPropertyChanged(window, key) || !data) | 724 if (HandleInternalPropertyChanged(window, key) || !data) |
725 return; | 725 return; |
726 | 726 |
727 WindowPortPropertyDataMus* data_mus = | 727 WindowPortPropertyDataMus* data_mus = |
728 static_cast<WindowPortPropertyDataMus*>(data.get()); | 728 static_cast<WindowPortPropertyDataMus*>(data.get()); |
729 | 729 |
730 std::string transport_name; | 730 std::string transport_name; |
731 std::unique_ptr<std::vector<uint8_t>> transport_value; | 731 std::unique_ptr<std::vector<uint8_t>> transport_value; |
732 if (!delegate_->GetPropertyConverter()->ConvertPropertyForTransport( | 732 if (!delegate_->GetPropertyConverter()->ConvertPropertyForTransport( |
733 window->GetWindow(), key, &transport_name, &transport_value)) { | 733 window->GetWindow(), key, &transport_name, &transport_value)) { |
(...skipping 959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1693 return ScheduleInFlightChange(base::MakeUnique<InFlightCaptureChange>( | 1693 return ScheduleInFlightChange(base::MakeUnique<InFlightCaptureChange>( |
1694 this, capture_synchronizer_.get(), window)); | 1694 this, capture_synchronizer_.get(), window)); |
1695 } | 1695 } |
1696 | 1696 |
1697 uint32_t WindowTreeClient::CreateChangeIdForFocus(WindowMus* window) { | 1697 uint32_t WindowTreeClient::CreateChangeIdForFocus(WindowMus* window) { |
1698 return ScheduleInFlightChange(base::MakeUnique<InFlightFocusChange>( | 1698 return ScheduleInFlightChange(base::MakeUnique<InFlightFocusChange>( |
1699 this, focus_synchronizer_.get(), window)); | 1699 this, focus_synchronizer_.get(), window)); |
1700 } | 1700 } |
1701 | 1701 |
1702 } // namespace aura | 1702 } // namespace aura |
OLD | NEW |