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

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: 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()),
602 nullptr /* target */);
Hadi 2016/07/25 19:01:42 Why are we ignoring the |target| function paramete
James Cook 2016/07/25 20:23:37 Good catch - that was a mistake. Fixed it and exte
603 } else if (event.IsTouchPointerEvent()) {
604 delegate_->OnEventObserved(ui::TouchEvent(*event.AsPointerEvent()),
605 nullptr /* target */);
606 } else {
607 delegate_->OnEventObserved(event, nullptr /* target */);
608 }
609 }
610
596 //////////////////////////////////////////////////////////////////////////////// 611 ////////////////////////////////////////////////////////////////////////////////
597 // WindowTreeClient, WindowTreeClient implementation: 612 // WindowTreeClient, WindowTreeClient implementation:
598 613
599 void WindowTreeClient::SetDeleteOnNoRoots(bool value) { 614 void WindowTreeClient::SetDeleteOnNoRoots(bool value) {
600 delete_on_no_roots_ = value; 615 delete_on_no_roots_ = value;
601 } 616 }
602 617
603 const std::set<Window*>& WindowTreeClient::GetRoots() { 618 const std::set<Window*>& WindowTreeClient::GetRoots() {
604 return roots_; 619 return roots_;
605 } 620 }
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
973 Id window_id, 988 Id window_id,
974 std::unique_ptr<ui::Event> event, 989 std::unique_ptr<ui::Event> event,
975 uint32_t event_observer_id) { 990 uint32_t event_observer_id) {
976 DCHECK(event); 991 DCHECK(event);
977 Window* window = GetWindowByServerId(window_id); // May be null. 992 Window* window = GetWindowByServerId(window_id); // May be null.
978 993
979 // Non-zero event_observer_id means it matched an event observer on the 994 // Non-zero event_observer_id means it matched an event observer on the
980 // server. 995 // server.
981 if (event_observer_id != 0 && has_event_observer_ && 996 if (event_observer_id != 0 && has_event_observer_ &&
982 event_observer_id == event_observer_id_) 997 event_observer_id == event_observer_id_)
983 delegate_->OnEventObserved(*event.get(), window); 998 SendToEventObserver(*event, window);
984 999
985 if (!window || !window->input_event_handler_) { 1000 if (!window || !window->input_event_handler_) {
986 tree_->OnWindowInputEventAck(event_id, mojom::EventResult::UNHANDLED); 1001 tree_->OnWindowInputEventAck(event_id, mojom::EventResult::UNHANDLED);
987 return; 1002 return;
988 } 1003 }
989 1004
990 std::unique_ptr<base::Callback<void(mojom::EventResult)>> ack_callback( 1005 std::unique_ptr<base::Callback<void(mojom::EventResult)>> ack_callback(
991 new base::Callback<void(mojom::EventResult)>( 1006 new base::Callback<void(mojom::EventResult)>(
992 base::Bind(&mojom::WindowTree::OnWindowInputEventAck, 1007 base::Bind(&mojom::WindowTree::OnWindowInputEventAck,
993 base::Unretained(tree_), event_id))); 1008 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, 1023 // The handler did not take ownership of the callback, so we send the ack,
1009 // marking the event as not consumed. 1024 // marking the event as not consumed.
1010 if (ack_callback) 1025 if (ack_callback)
1011 ack_callback->Run(mojom::EventResult::UNHANDLED); 1026 ack_callback->Run(mojom::EventResult::UNHANDLED);
1012 } 1027 }
1013 1028
1014 void WindowTreeClient::OnEventObserved(std::unique_ptr<ui::Event> event, 1029 void WindowTreeClient::OnEventObserved(std::unique_ptr<ui::Event> event,
1015 uint32_t event_observer_id) { 1030 uint32_t event_observer_id) {
1016 DCHECK(event); 1031 DCHECK(event);
1017 if (has_event_observer_ && event_observer_id == event_observer_id_) 1032 if (has_event_observer_ && event_observer_id == event_observer_id_)
1018 delegate_->OnEventObserved(*event.get(), nullptr /* target */); 1033 SendToEventObserver(*event, nullptr /* target */);
1019 } 1034 }
1020 1035
1021 void WindowTreeClient::OnWindowFocused(Id focused_window_id) { 1036 void WindowTreeClient::OnWindowFocused(Id focused_window_id) {
1022 Window* focused_window = GetWindowByServerId(focused_window_id); 1037 Window* focused_window = GetWindowByServerId(focused_window_id);
1023 InFlightFocusChange new_change(this, focused_window); 1038 InFlightFocusChange new_change(this, focused_window);
1024 if (ApplyServerChangeToExistingInFlightChange(new_change)) 1039 if (ApplyServerChangeToExistingInFlightChange(new_change))
1025 return; 1040 return;
1026 1041
1027 LocalSetFocus(focused_window); 1042 LocalSetFocus(focused_window);
1028 } 1043 }
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
1250 Window* window, 1265 Window* window,
1251 const gfx::Vector2d& offset, 1266 const gfx::Vector2d& offset,
1252 const gfx::Insets& hit_area) { 1267 const gfx::Insets& hit_area) {
1253 if (window_manager_internal_client_) { 1268 if (window_manager_internal_client_) {
1254 window_manager_internal_client_->SetUnderlaySurfaceOffsetAndExtendedHitArea( 1269 window_manager_internal_client_->SetUnderlaySurfaceOffsetAndExtendedHitArea(
1255 server_id(window), offset.x(), offset.y(), hit_area); 1270 server_id(window), offset.x(), offset.y(), hit_area);
1256 } 1271 }
1257 } 1272 }
1258 1273
1259 } // namespace ui 1274 } // 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