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> | 7 #include <stddef.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "components/mus/common/util.h" | 11 #include "components/mus/common/util.h" |
12 #include "components/mus/public/cpp/input_event_handler.h" | 12 #include "components/mus/public/cpp/input_event_handler.h" |
13 #include "components/mus/public/cpp/lib/in_flight_change.h" | 13 #include "components/mus/public/cpp/lib/in_flight_change.h" |
14 #include "components/mus/public/cpp/lib/window_private.h" | 14 #include "components/mus/public/cpp/lib/window_private.h" |
15 #include "components/mus/public/cpp/window_manager_delegate.h" | 15 #include "components/mus/public/cpp/window_manager_delegate.h" |
16 #include "components/mus/public/cpp/window_observer.h" | 16 #include "components/mus/public/cpp/window_observer.h" |
17 #include "components/mus/public/cpp/window_tracker.h" | 17 #include "components/mus/public/cpp/window_tracker.h" |
18 #include "components/mus/public/cpp/window_tree_connection.h" | 18 #include "components/mus/public/cpp/window_tree_connection.h" |
19 #include "components/mus/public/cpp/window_tree_connection_observer.h" | 19 #include "components/mus/public/cpp/window_tree_connection_observer.h" |
20 #include "components/mus/public/cpp/window_tree_delegate.h" | 20 #include "components/mus/public/cpp/window_tree_delegate.h" |
21 #include "mojo/converters/geometry/geometry_type_converters.h" | 21 #include "mojo/converters/geometry/geometry_type_converters.h" |
| 22 #include "mojo/converters/input_events/input_events_type_converters.h" |
22 #include "mojo/shell/public/cpp/connector.h" | 23 #include "mojo/shell/public/cpp/connector.h" |
| 24 #include "ui/events/event.h" |
23 #include "ui/gfx/geometry/insets.h" | 25 #include "ui/gfx/geometry/insets.h" |
24 #include "ui/gfx/geometry/size.h" | 26 #include "ui/gfx/geometry/size.h" |
25 | 27 |
26 namespace mus { | 28 namespace mus { |
27 | 29 |
28 Id MakeTransportId(ConnectionSpecificId connection_id, | 30 Id MakeTransportId(ConnectionSpecificId connection_id, |
29 ConnectionSpecificId local_id) { | 31 ConnectionSpecificId local_id) { |
30 return (connection_id << 16) | local_id; | 32 return (connection_id << 16) | local_id; |
31 } | 33 } |
32 | 34 |
(...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
818 Window* window = GetWindowById(window_id); | 820 Window* window = GetWindowById(window_id); |
819 if (!window || !window->input_event_handler_) { | 821 if (!window || !window->input_event_handler_) { |
820 tree_->OnWindowInputEventAck(event_id, false); | 822 tree_->OnWindowInputEventAck(event_id, false); |
821 return; | 823 return; |
822 } | 824 } |
823 | 825 |
824 scoped_ptr<base::Callback<void(bool)>> ack_callback( | 826 scoped_ptr<base::Callback<void(bool)>> ack_callback( |
825 new base::Callback<void(bool)>( | 827 new base::Callback<void(bool)>( |
826 base::Bind(&mojom::WindowTree::OnWindowInputEventAck, | 828 base::Bind(&mojom::WindowTree::OnWindowInputEventAck, |
827 base::Unretained(tree_), event_id))); | 829 base::Unretained(tree_), event_id))); |
828 window->input_event_handler_->OnWindowInputEvent(window, std::move(event), | 830 window->input_event_handler_->OnWindowInputEvent( |
829 &ack_callback); | 831 window, *event.To<scoped_ptr<ui::Event>>().get(), &ack_callback); |
830 | 832 |
831 // The handler did not take ownership of the callback, so we send the ack, | 833 // The handler did not take ownership of the callback, so we send the ack, |
832 // marking the event as not consumed. | 834 // marking the event as not consumed. |
833 if (ack_callback) | 835 if (ack_callback) |
834 ack_callback->Run(false); | 836 ack_callback->Run(false); |
835 } | 837 } |
836 | 838 |
837 void WindowTreeClientImpl::OnWindowFocused(Id focused_window_id) { | 839 void WindowTreeClientImpl::OnWindowFocused(Id focused_window_id) { |
838 Window* focused_window = GetWindowById(focused_window_id); | 840 Window* focused_window = GetWindowById(focused_window_id); |
839 InFlightFocusChange new_change(this, focused_window); | 841 InFlightFocusChange new_change(this, focused_window); |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
980 | 982 |
981 void WindowTreeClientImpl::SetUnderlaySurfaceOffsetAndExtendedHitArea( | 983 void WindowTreeClientImpl::SetUnderlaySurfaceOffsetAndExtendedHitArea( |
982 Window* window, | 984 Window* window, |
983 const gfx::Vector2d& offset, | 985 const gfx::Vector2d& offset, |
984 const gfx::Insets& hit_area) { | 986 const gfx::Insets& hit_area) { |
985 window_manager_internal_client_->SetUnderlaySurfaceOffsetAndExtendedHitArea( | 987 window_manager_internal_client_->SetUnderlaySurfaceOffsetAndExtendedHitArea( |
986 window->id(), offset.x(), offset.y(), mojo::Insets::From(hit_area)); | 988 window->id(), offset.x(), offset.y(), mojo::Insets::From(hit_area)); |
987 } | 989 } |
988 | 990 |
989 } // namespace mus | 991 } // namespace mus |
OLD | NEW |