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

Side by Side Diff: services/ui/public/cpp/lib/window_tree_client.cc

Issue 2179083002: mash: Fix system tray bubble not closing for clicks outside its bounds (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 4 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
« no previous file with comments | « no previous file | services/ui/public/cpp/tests/window_tree_client_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "services/ui/public/cpp/window_tree_client.h" 5 #include "services/ui/public/cpp/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 575 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 bool completed) { 586 bool completed) {
587 if (window_manager_internal_client_) 587 if (window_manager_internal_client_)
588 window_manager_internal_client_->WmResponse(change_id, completed); 588 window_manager_internal_client_->WmResponse(change_id, completed);
589 589
590 if (change_id == current_wm_move_loop_change_) { 590 if (change_id == current_wm_move_loop_change_) {
591 current_wm_move_loop_change_ = 0; 591 current_wm_move_loop_change_ = 0;
592 current_wm_move_loop_window_id_ = 0; 592 current_wm_move_loop_window_id_ = 0;
593 } 593 }
594 } 594 }
595 595
596 void WindowTreeClient::SendToEventObserver(const ui::Event& event,
597 Window* target) {
598 // TODO(moshayedi): crbug.com/617222. No need to convert to ui::MouseEvent or
599 // ui::TouchEvent once we have proper support for pointer events.
600 if (event.IsMousePointerEvent())
601 delegate_->OnEventObserved(ui::MouseEvent(*event.AsPointerEvent()), target);
602 else if (event.IsTouchPointerEvent())
603 delegate_->OnEventObserved(ui::TouchEvent(*event.AsPointerEvent()), target);
604 else
605 delegate_->OnEventObserved(event, target);
606 }
607
596 //////////////////////////////////////////////////////////////////////////////// 608 ////////////////////////////////////////////////////////////////////////////////
597 // WindowTreeClient, WindowTreeClient implementation: 609 // WindowTreeClient, WindowTreeClient implementation:
598 610
599 void WindowTreeClient::SetDeleteOnNoRoots(bool value) { 611 void WindowTreeClient::SetDeleteOnNoRoots(bool value) {
600 delete_on_no_roots_ = value; 612 delete_on_no_roots_ = value;
601 } 613 }
602 614
603 const std::set<Window*>& WindowTreeClient::GetRoots() { 615 const std::set<Window*>& WindowTreeClient::GetRoots() {
604 return roots_; 616 return roots_;
605 } 617 }
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
973 Id window_id, 985 Id window_id,
974 std::unique_ptr<ui::Event> event, 986 std::unique_ptr<ui::Event> event,
975 uint32_t event_observer_id) { 987 uint32_t event_observer_id) {
976 DCHECK(event); 988 DCHECK(event);
977 Window* window = GetWindowByServerId(window_id); // May be null. 989 Window* window = GetWindowByServerId(window_id); // May be null.
978 990
979 // Non-zero event_observer_id means it matched an event observer on the 991 // Non-zero event_observer_id means it matched an event observer on the
980 // server. 992 // server.
981 if (event_observer_id != 0 && has_event_observer_ && 993 if (event_observer_id != 0 && has_event_observer_ &&
982 event_observer_id == event_observer_id_) 994 event_observer_id == event_observer_id_)
983 delegate_->OnEventObserved(*event.get(), window); 995 SendToEventObserver(*event, window);
984 996
985 if (!window || !window->input_event_handler_) { 997 if (!window || !window->input_event_handler_) {
986 tree_->OnWindowInputEventAck(event_id, mojom::EventResult::UNHANDLED); 998 tree_->OnWindowInputEventAck(event_id, mojom::EventResult::UNHANDLED);
987 return; 999 return;
988 } 1000 }
989 1001
990 std::unique_ptr<base::Callback<void(mojom::EventResult)>> ack_callback( 1002 std::unique_ptr<base::Callback<void(mojom::EventResult)>> ack_callback(
991 new base::Callback<void(mojom::EventResult)>( 1003 new base::Callback<void(mojom::EventResult)>(
992 base::Bind(&mojom::WindowTree::OnWindowInputEventAck, 1004 base::Bind(&mojom::WindowTree::OnWindowInputEventAck,
993 base::Unretained(tree_), event_id))); 1005 base::Unretained(tree_), event_id)));
(...skipping 14 matching lines...) Expand all
1008 // The handler did not take ownership of the callback, so we send the ack, 1020 // The handler did not take ownership of the callback, so we send the ack,
1009 // marking the event as not consumed. 1021 // marking the event as not consumed.
1010 if (ack_callback) 1022 if (ack_callback)
1011 ack_callback->Run(mojom::EventResult::UNHANDLED); 1023 ack_callback->Run(mojom::EventResult::UNHANDLED);
1012 } 1024 }
1013 1025
1014 void WindowTreeClient::OnEventObserved(std::unique_ptr<ui::Event> event, 1026 void WindowTreeClient::OnEventObserved(std::unique_ptr<ui::Event> event,
1015 uint32_t event_observer_id) { 1027 uint32_t event_observer_id) {
1016 DCHECK(event); 1028 DCHECK(event);
1017 if (has_event_observer_ && event_observer_id == event_observer_id_) 1029 if (has_event_observer_ && event_observer_id == event_observer_id_)
1018 delegate_->OnEventObserved(*event.get(), nullptr /* target */); 1030 SendToEventObserver(*event, nullptr /* target */);
1019 } 1031 }
1020 1032
1021 void WindowTreeClient::OnWindowFocused(Id focused_window_id) { 1033 void WindowTreeClient::OnWindowFocused(Id focused_window_id) {
1022 Window* focused_window = GetWindowByServerId(focused_window_id); 1034 Window* focused_window = GetWindowByServerId(focused_window_id);
1023 InFlightFocusChange new_change(this, focused_window); 1035 InFlightFocusChange new_change(this, focused_window);
1024 if (ApplyServerChangeToExistingInFlightChange(new_change)) 1036 if (ApplyServerChangeToExistingInFlightChange(new_change))
1025 return; 1037 return;
1026 1038
1027 LocalSetFocus(focused_window); 1039 LocalSetFocus(focused_window);
1028 } 1040 }
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
1250 Window* window, 1262 Window* window,
1251 const gfx::Vector2d& offset, 1263 const gfx::Vector2d& offset,
1252 const gfx::Insets& hit_area) { 1264 const gfx::Insets& hit_area) {
1253 if (window_manager_internal_client_) { 1265 if (window_manager_internal_client_) {
1254 window_manager_internal_client_->SetUnderlaySurfaceOffsetAndExtendedHitArea( 1266 window_manager_internal_client_->SetUnderlaySurfaceOffsetAndExtendedHitArea(
1255 server_id(window), offset.x(), offset.y(), hit_area); 1267 server_id(window), offset.x(), offset.y(), hit_area);
1256 } 1268 }
1257 } 1269 }
1258 1270
1259 } // namespace ui 1271 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | services/ui/public/cpp/tests/window_tree_client_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698