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

Side by Side Diff: components/mus/ws/window_tree.cc

Issue 1939133002: StructTraits to map mus::mojom::Event to unique_ptr<ui::Event> (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed feedback. Created 4 years, 6 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/ws/window_tree.h" 5 #include "components/mus/ws/window_tree.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 host->AddActivationParent(window); 392 host->AddActivationParent(window);
393 } 393 }
394 394
395 void WindowTree::OnChangeCompleted(uint32_t change_id, bool success) { 395 void WindowTree::OnChangeCompleted(uint32_t change_id, bool success) {
396 client()->OnChangeCompleted(change_id, success); 396 client()->OnChangeCompleted(change_id, success);
397 } 397 }
398 398
399 void WindowTree::OnAccelerator(uint32_t accelerator_id, 399 void WindowTree::OnAccelerator(uint32_t accelerator_id,
400 const ui::Event& event) { 400 const ui::Event& event) {
401 DCHECK(window_manager_internal_); 401 DCHECK(window_manager_internal_);
402 // TODO(moshayedi): crbug.com/617167. Don't clone even once we map
403 // mojom::Event directly to ui::Event.
402 window_manager_internal_->OnAccelerator(accelerator_id, 404 window_manager_internal_->OnAccelerator(accelerator_id,
403 mojom::Event::From(event)); 405 ui::Event::Clone(event));
404 } 406 }
405 407
406 void WindowTree::ClientJankinessChanged(WindowTree* tree) { 408 void WindowTree::ClientJankinessChanged(WindowTree* tree) {
407 tree->janky_ = !tree->janky_; 409 tree->janky_ = !tree->janky_;
408 if (window_manager_internal_) { 410 if (window_manager_internal_) {
409 window_manager_internal_->WmClientJankinessChanged( 411 window_manager_internal_->WmClientJankinessChanged(
410 tree->id(), tree->janky()); 412 tree->id(), tree->janky());
411 } 413 }
412 } 414 }
413 415
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after
957 // randomly. 959 // randomly.
958 // TODO(moshayedi): Find a faster way to generate ids. 960 // TODO(moshayedi): Find a faster way to generate ids.
959 event_ack_id_ = 0x1000000 | (rand() & 0xffffff); 961 event_ack_id_ = 0x1000000 | (rand() & 0xffffff);
960 event_source_wms_ = GetWindowManagerState(target); 962 event_source_wms_ = GetWindowManagerState(target);
961 // Should only get events from windows attached to a host. 963 // Should only get events from windows attached to a host.
962 DCHECK(event_source_wms_); 964 DCHECK(event_source_wms_);
963 bool matched_observer = 965 bool matched_observer =
964 event_observer_matcher_ && event_observer_matcher_->MatchesEvent(event); 966 event_observer_matcher_ && event_observer_matcher_->MatchesEvent(event);
965 client()->OnWindowInputEvent( 967 client()->OnWindowInputEvent(
966 event_ack_id_, ClientWindowIdForWindow(target).id, 968 event_ack_id_, ClientWindowIdForWindow(target).id,
967 mojom::Event::From(event), matched_observer ? event_observer_id_ : 0); 969 ui::Event::Clone(event), matched_observer ? event_observer_id_ : 0);
968 } 970 }
969 971
970 void WindowTree::SendToEventObserver(const ui::Event& event) { 972 void WindowTree::SendToEventObserver(const ui::Event& event) {
971 if (event_observer_matcher_ && event_observer_matcher_->MatchesEvent(event)) 973 if (event_observer_matcher_ && event_observer_matcher_->MatchesEvent(event))
972 client()->OnEventObserved(mojom::Event::From(event), event_observer_id_); 974 client()->OnEventObserved(ui::Event::Clone(event), event_observer_id_);
973 } 975 }
974 976
975 void WindowTree::NewWindow( 977 void WindowTree::NewWindow(
976 uint32_t change_id, 978 uint32_t change_id,
977 Id transport_window_id, 979 Id transport_window_id,
978 mojo::Map<mojo::String, mojo::Array<uint8_t>> transport_properties) { 980 mojo::Map<mojo::String, mojo::Array<uint8_t>> transport_properties) {
979 std::map<std::string, std::vector<uint8_t>> properties; 981 std::map<std::string, std::vector<uint8_t>> properties;
980 if (!transport_properties.is_null()) { 982 if (!transport_properties.is_null()) {
981 properties = 983 properties =
982 transport_properties.To<std::map<std::string, std::vector<uint8_t>>>(); 984 transport_properties.To<std::map<std::string, std::vector<uint8_t>>>();
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
1498 } 1500 }
1499 1501
1500 bool WindowTree::IsWindowRootOfAnotherTreeForAccessPolicy( 1502 bool WindowTree::IsWindowRootOfAnotherTreeForAccessPolicy(
1501 const ServerWindow* window) const { 1503 const ServerWindow* window) const {
1502 WindowTree* tree = window_server_->GetTreeWithRoot(window); 1504 WindowTree* tree = window_server_->GetTreeWithRoot(window);
1503 return tree && tree != this; 1505 return tree && tree != this;
1504 } 1506 }
1505 1507
1506 } // namespace ws 1508 } // namespace ws
1507 } // namespace mus 1509 } // namespace mus
OLDNEW
« no previous file with comments | « components/mus/ws/window_manager_state_unittest.cc ('k') | components/mus/ws/window_tree_client_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698