Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(51)

Side by Side Diff: components/mus/public/cpp/lib/window_tree_client_impl.cc

Issue 1909733002: mus: Add EventObserver to allow passively listening to UI events (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
(...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after
858 858
859 InFlightPropertyChange new_change(window, name, new_data); 859 InFlightPropertyChange new_change(window, name, new_data);
860 if (ApplyServerChangeToExistingInFlightChange(new_change)) 860 if (ApplyServerChangeToExistingInFlightChange(new_change))
861 return; 861 return;
862 862
863 WindowPrivate(window).LocalSetSharedProperty(name, std::move(new_data)); 863 WindowPrivate(window).LocalSetSharedProperty(name, std::move(new_data));
864 } 864 }
865 865
866 void WindowTreeClientImpl::OnWindowInputEvent(uint32_t event_id, 866 void WindowTreeClientImpl::OnWindowInputEvent(uint32_t event_id,
867 Id window_id, 867 Id window_id,
868 mojom::EventPtr event) { 868 mojom::EventPtr event,
869 uint32_t event_observer_id) {
870 // TODO(jamescook): If event_observer_id is non-zero, also route the event to
871 // PointerWatchers.
872
869 Window* window = GetWindowByServerId(window_id); 873 Window* window = GetWindowByServerId(window_id);
870 if (!window || !window->input_event_handler_) { 874 if (!window || !window->input_event_handler_) {
871 tree_->OnWindowInputEventAck(event_id, mojom::EventResult::UNHANDLED); 875 tree_->OnWindowInputEventAck(event_id, mojom::EventResult::UNHANDLED);
872 return; 876 return;
873 } 877 }
874 878
875 std::unique_ptr<base::Callback<void(mojom::EventResult)>> ack_callback( 879 std::unique_ptr<base::Callback<void(mojom::EventResult)>> ack_callback(
876 new base::Callback<void(mojom::EventResult)>( 880 new base::Callback<void(mojom::EventResult)>(
877 base::Bind(&mojom::WindowTree::OnWindowInputEventAck, 881 base::Bind(&mojom::WindowTree::OnWindowInputEventAck,
878 base::Unretained(tree_), event_id))); 882 base::Unretained(tree_), event_id)));
879 window->input_event_handler_->OnWindowInputEvent( 883 window->input_event_handler_->OnWindowInputEvent(
880 window, *event.To<std::unique_ptr<ui::Event>>().get(), &ack_callback); 884 window, *event.To<std::unique_ptr<ui::Event>>().get(), &ack_callback);
881 885
882 // The handler did not take ownership of the callback, so we send the ack, 886 // The handler did not take ownership of the callback, so we send the ack,
883 // marking the event as not consumed. 887 // marking the event as not consumed.
884 if (ack_callback) 888 if (ack_callback)
885 ack_callback->Run(mojom::EventResult::UNHANDLED); 889 ack_callback->Run(mojom::EventResult::UNHANDLED);
886 } 890 }
887 891
892 void WindowTreeClientImpl::OnEventObserved(mojom::EventPtr event_in,
893 uint32_t event_observer_id) {
894 // TODO(jamescook): Route the observed event to PointerWatchers.
895 }
896
888 void WindowTreeClientImpl::OnWindowFocused(Id focused_window_id) { 897 void WindowTreeClientImpl::OnWindowFocused(Id focused_window_id) {
889 Window* focused_window = GetWindowByServerId(focused_window_id); 898 Window* focused_window = GetWindowByServerId(focused_window_id);
890 InFlightFocusChange new_change(this, focused_window); 899 InFlightFocusChange new_change(this, focused_window);
891 if (ApplyServerChangeToExistingInFlightChange(new_change)) 900 if (ApplyServerChangeToExistingInFlightChange(new_change))
892 return; 901 return;
893 902
894 LocalSetFocus(focused_window); 903 LocalSetFocus(focused_window);
895 } 904 }
896 905
897 void WindowTreeClientImpl::OnWindowPredefinedCursorChanged( 906 void WindowTreeClientImpl::OnWindowPredefinedCursorChanged(
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
1032 1041
1033 void WindowTreeClientImpl::SetUnderlaySurfaceOffsetAndExtendedHitArea( 1042 void WindowTreeClientImpl::SetUnderlaySurfaceOffsetAndExtendedHitArea(
1034 Window* window, 1043 Window* window,
1035 const gfx::Vector2d& offset, 1044 const gfx::Vector2d& offset,
1036 const gfx::Insets& hit_area) { 1045 const gfx::Insets& hit_area) {
1037 window_manager_internal_client_->SetUnderlaySurfaceOffsetAndExtendedHitArea( 1046 window_manager_internal_client_->SetUnderlaySurfaceOffsetAndExtendedHitArea(
1038 server_id(window), offset.x(), offset.y(), mojo::Insets::From(hit_area)); 1047 server_id(window), offset.x(), offset.y(), mojo::Insets::From(hit_area));
1039 } 1048 }
1040 1049
1041 } // namespace mus 1050 } // namespace mus
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698