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

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

Issue 1949823002: WIP: Eliminate event.target() usage from TrayEventFilter (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: container delegate Created 4 years, 7 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 893 matching lines...) Expand 10 before | Expand all | Expand 10 after
904 return; 904 return;
905 905
906 WindowPrivate(window).LocalSetSharedProperty(name, std::move(new_data)); 906 WindowPrivate(window).LocalSetSharedProperty(name, std::move(new_data));
907 } 907 }
908 908
909 void WindowTreeClientImpl::OnWindowInputEvent(uint32_t event_id, 909 void WindowTreeClientImpl::OnWindowInputEvent(uint32_t event_id,
910 Id window_id, 910 Id window_id,
911 mojom::EventPtr event, 911 mojom::EventPtr event,
912 uint32_t event_observer_id) { 912 uint32_t event_observer_id) {
913 std::unique_ptr<ui::Event> ui_event = event.To<std::unique_ptr<ui::Event>>(); 913 std::unique_ptr<ui::Event> ui_event = event.To<std::unique_ptr<ui::Event>>();
914 Window* window = GetWindowByServerId(window_id); // May be null.
914 915
915 // Non-zero event_observer_id means it matched an event observer on the 916 // Non-zero event_observer_id means it matched an event observer on the
916 // server. 917 // server.
917 if (event_observer_id != 0 && has_event_observer_ && 918 if (event_observer_id != 0 && has_event_observer_ &&
918 event_observer_id == event_observer_id_) 919 event_observer_id == event_observer_id_)
919 delegate_->OnEventObserved(*ui_event); 920 delegate_->OnEventObserved(*ui_event, window);
920 921
921 Window* window = GetWindowByServerId(window_id);
922 if (!window || !window->input_event_handler_) { 922 if (!window || !window->input_event_handler_) {
923 tree_->OnWindowInputEventAck(event_id, mojom::EventResult::UNHANDLED); 923 tree_->OnWindowInputEventAck(event_id, mojom::EventResult::UNHANDLED);
924 return; 924 return;
925 } 925 }
926 926
927 std::unique_ptr<base::Callback<void(mojom::EventResult)>> ack_callback( 927 std::unique_ptr<base::Callback<void(mojom::EventResult)>> ack_callback(
928 new base::Callback<void(mojom::EventResult)>( 928 new base::Callback<void(mojom::EventResult)>(
929 base::Bind(&mojom::WindowTree::OnWindowInputEventAck, 929 base::Bind(&mojom::WindowTree::OnWindowInputEventAck,
930 base::Unretained(tree_), event_id))); 930 base::Unretained(tree_), event_id)));
931 window->input_event_handler_->OnWindowInputEvent( 931 window->input_event_handler_->OnWindowInputEvent(
932 window, *event.To<std::unique_ptr<ui::Event>>().get(), &ack_callback); 932 window, *event.To<std::unique_ptr<ui::Event>>().get(), &ack_callback);
933 933
934 // The handler did not take ownership of the callback, so we send the ack, 934 // The handler did not take ownership of the callback, so we send the ack,
935 // marking the event as not consumed. 935 // marking the event as not consumed.
936 if (ack_callback) 936 if (ack_callback)
937 ack_callback->Run(mojom::EventResult::UNHANDLED); 937 ack_callback->Run(mojom::EventResult::UNHANDLED);
938 } 938 }
939 939
940 void WindowTreeClientImpl::OnEventObserved(mojom::EventPtr event, 940 void WindowTreeClientImpl::OnEventObserved(mojom::EventPtr event,
941 uint32_t event_observer_id) { 941 uint32_t event_observer_id) {
942 if (has_event_observer_ && event_observer_id == event_observer_id_) { 942 if (has_event_observer_ && event_observer_id == event_observer_id_) {
943 std::unique_ptr<ui::Event> ui_event = 943 std::unique_ptr<ui::Event> ui_event =
944 event.To<std::unique_ptr<ui::Event>>(); 944 event.To<std::unique_ptr<ui::Event>>();
945 delegate_->OnEventObserved(*ui_event); 945 delegate_->OnEventObserved(*ui_event, nullptr /* target */);
946 } 946 }
947 } 947 }
948 948
949 void WindowTreeClientImpl::OnWindowFocused(Id focused_window_id) { 949 void WindowTreeClientImpl::OnWindowFocused(Id focused_window_id) {
950 Window* focused_window = GetWindowByServerId(focused_window_id); 950 Window* focused_window = GetWindowByServerId(focused_window_id);
951 InFlightFocusChange new_change(this, focused_window); 951 InFlightFocusChange new_change(this, focused_window);
952 if (ApplyServerChangeToExistingInFlightChange(new_change)) 952 if (ApplyServerChangeToExistingInFlightChange(new_change))
953 return; 953 return;
954 954
955 LocalSetFocus(focused_window); 955 LocalSetFocus(focused_window);
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
1093 1093
1094 void WindowTreeClientImpl::SetUnderlaySurfaceOffsetAndExtendedHitArea( 1094 void WindowTreeClientImpl::SetUnderlaySurfaceOffsetAndExtendedHitArea(
1095 Window* window, 1095 Window* window,
1096 const gfx::Vector2d& offset, 1096 const gfx::Vector2d& offset,
1097 const gfx::Insets& hit_area) { 1097 const gfx::Insets& hit_area) {
1098 window_manager_internal_client_->SetUnderlaySurfaceOffsetAndExtendedHitArea( 1098 window_manager_internal_client_->SetUnderlaySurfaceOffsetAndExtendedHitArea(
1099 server_id(window), offset.x(), offset.y(), mojo::Insets::From(hit_area)); 1099 server_id(window), offset.x(), offset.y(), mojo::Insets::From(hit_area));
1100 } 1100 }
1101 1101
1102 } // namespace mus 1102 } // namespace mus
OLDNEW
« no previous file with comments | « components/mus/demo/mus_demo.cc ('k') | components/mus/public/cpp/tests/window_server_test_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698